Modify

Opened 5 years ago

Closed 4 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 Changed 5 years ago by Don-vip

Component: CoreCore validator
Keywords: mapcss added

comment:2 Changed 5 years ago by Klumbumbus

comment:3 Changed 5 years ago by Klumbumbus

Owner: changed from team to Dakon
Status: newneedinfo

comment:4 Changed 4 years ago by anonymous

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 Changed 4 years ago by Klumbumbus

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 Changed 4 years ago by Klumbumbus

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

comment:8 Changed 4 years ago by Dakon

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

comment:9 Changed 4 years ago by simon04

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 Changed 4 years ago by simon04

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 Changed 4 years ago by simon04

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.