Index: src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java	(revision 15746)
+++ src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java	(working copy)
@@ -148,4 +148,22 @@
     private static OsmPrimitiveType getOsmPrimitiveType(char firstChar) {
         return firstChar == 'n' ? OsmPrimitiveType.NODE : firstChar == 'w' ? OsmPrimitiveType.WAY : OsmPrimitiveType.RELATION;
     }
+
+    /**
+     * Convert a primitive to a simple id
+     *
+     * @param primitive The primitive to convert
+     * @return The type (may be n, w, or r, or something else) + the id (e.g., w42)
+     * @since xxx
+     */
+    public static String toSimpleId(IPrimitive primitive) {
+        if (primitive instanceof Relation) {
+            return "r" + primitive.getOsmId();
+        } else if (primitive instanceof Way) {
+            return "w" + primitive.getOsmId();
+        } else if (primitive instanceof Node) {
+            return "n" + primitive.getOsmId();
+        }
+        return primitive.getType().toString() + primitive.getOsmId();
+    }
 }
Index: src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java	(revision 15746)
+++ src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java	(working copy)
@@ -24,6 +24,7 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match;
@@ -515,6 +516,79 @@
     }
 
     /**
+     * Gets a list of all OSM id's of the object's parent(s) with a specified key.
+     *
+     * @param env      the environment
+     * @param key      the OSM key
+     * @param keyValue the regex value of the OSM key
+     * @return a list of non-null values of the OSM id's from the object's parent(s)
+     * @since xxx
+     */
+    public static List<IPrimitive> parent_osm_primitives(final Environment env, String key, String keyValue) {
+        if (env.parent == null) {
+            if (env.osm != null) {
+                final ArrayList<IPrimitive> parents = new ArrayList<>();
+                for (IPrimitive parent : env.osm.getReferrers()) {
+                    if ((key == null || parent.get(key) != null)
+                            && (keyValue == null || regexp_test(keyValue, parent.get(key)))) {
+                        parents.add(parent);
+                    }
+                }
+                return new ArrayList<>(parents);
+            }
+            return Collections.emptyList();
+        }
+        return Collections.singletonList(env.parent);
+    }
+
+    /**
+     * Gets a list of all OSM id's of the object's parent(s) with a specified key.
+     *
+     * @param env the environment
+     * @param key the OSM key
+     * @return a list of non-null values of the OSM id's from the object's parent(s)
+     * @since xxx
+     */
+    public static List<IPrimitive> parent_osm_primitives(final Environment env, String key) { // NO_UCD (unused code)
+        return parent_osm_primitives(env, key, null);
+    }
+
+    /**
+     * Gets a list of all OSM id's of the object's parent(s).
+     *
+     * @param env the environment
+     * @return a list of non-null values of the OSM id's from the object's parent(s)
+     * @since xxx
+     */
+    public static List<IPrimitive> parent_osm_primitives(final Environment env) { // NO_UCD (unused code)
+        return parent_osm_primitives(env, null, null);
+    }
+
+    /**
+     * Convert Primitives to a string
+     *
+     * @param primitives The primitives to convert
+     * @return A list of strings in the format type + id (in the list order)
+     * @see SimplePrimitiveId#toSimpleId
+     * @since xxx
+     */
+    public static List<String> convert_primitives_to_string(List<IPrimitive> primitives) {
+        return primitives.stream().map(Functions::convert_primitive_to_string).collect(Collectors.toList());
+    }
+
+    /**
+     * Convert a primitive to a string
+     *
+     * @param primitive The primitive to convert
+     * @return A string in the format type + id
+     * @see SimplePrimitiveId#toSimpleId
+     * @since xxx
+     */
+    public static String convert_primitive_to_string(IPrimitive primitive) {
+        return SimplePrimitiveId.toSimpleId(primitive);
+    }
+
+    /**
      * Returns the lowest distance between the OSM object and a GPX point
      * <p>
      * @param env the environment
