Modify

Opened 9 years ago

Closed 8 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 Don-vip, 9 years ago

Component: CoreCore validator
Keywords: mapcss added

comment:2 by Klumbumbus, 9 years ago

comment:3 by Klumbumbus, 9 years ago

Owner: changed from team to Dakon
Status: newneedinfo

comment:4 by anonymous, 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 Klumbumbus, 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:6 by Klumbumbus, 9 years ago

So you example should be *[highway=primary][foo=baz][foo=*bar]

comment:8 by Dakon, 9 years ago

At least [foo=*bar] works. I still need a way to do that for ∈ matches.

comment:9 by simon04, 8 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:10 by simon04, 8 years ago

In 8784/josm:

see #11278 - Add test case w.r.t. parent_tag

This checks whether the child's tag equals the parent's tag.

comment:11 by simon04, 8 years ago

Resolution: worksforme
Status: needinfoclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Dakon.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.