Opened 10 years ago
Closed 9 years ago
#11278 closed enhancement (worksforme)
Allow references to previous matches in validator rules
Reported by: | Dakon | Owned by: | Dakon |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core validator | Version: | tested |
Keywords: | template_report mapcss | Cc: |
Description
I would like to do the following checks in validator:
-match everything that has the same foo and bar values:
*[foo][bar={1.value}]
-match something that has the same tag as it's parent
way[foo] € node[{1}]
One probably needs a different notation for the second one to allow referencing both own matches as well as parent ones: way[foo] € node[{parent.1}][bar][baz={2.value}]
Attachments (0)
Change History (11)
comment:1 by , 10 years ago
Component: | Core → Core validator |
---|---|
Keywords: | mapcss added |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
comment:4 by , 9 years ago
I don't get how I could create validator rules that way. Could you give me an example of a rule that matches e.g. highways that have identical foo and bar tags (highway=primary foo=baz bar=baz)?
comment:5 by , 9 years ago
ok, not with classes, but should be possible. See the text below the table at https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Conditionselector (However I'm not sure if this is availible for rules. I did not test)
comment:7 by , 9 years ago
You might also be looking for https://josm.openstreetmap.de/doc/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.Functions.html#tag(org.openstreetmap.josm.gui.mappaint.Environment,%20java.lang.String)
Give *[highway=primary][tag("foo")=tag("bar")]
a try …
comment:9 by , 9 years ago
We have the MapCSS functions parent_tag(key)
as well as child_tag(key)
. It should be possible using those, e.g. way[foo] > node[tag("foo")=parent_tag("foo")] {}
.
comment:11 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | needinfo → closed |
This should work with classes, shouldn't it?
https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Classes