Modify

Opened 15 years ago

Closed 15 years ago

#2602 closed enhancement (fixed)

[PATCH] Search keywords "child" and "parent"

Reported by: Matt Owned by: team
Priority: minor Milestone:
Component: Core Version:
Keywords: search Cc:

Description

It has been noted that search keywords for parent/child relationships would be useful, http://www.mail-archive.com/josm-dev@openstreetmap.org/msg01869.html

Attachments (3)

josm.child-parent-search.patch (3.7 KB ) - added by Matt 15 years ago.
Patch to add "child" and "parent" keywords to search.
josm.child-parent-search.2.patch (4.1 KB ) - added by Matt 15 years ago.
A better patch for parent/child relationship search.
josm.child-parent-search.3.patch (4.5 KB ) - added by avarab@… 15 years ago.
attachment:josm.child-parent-search.3.patch with minor fixes

Download all attachments as: .zip

Change History (8)

by Matt, 15 years ago

Patch to add "child" and "parent" keywords to search.

comment:1 by smsm1, 15 years ago

Summary: Search keywords "child" and "parent"[PATCH] Search keywords "child" and "parent"

in reply to:  1 comment:2 by avarab@…, 15 years ago

Nice patch, but the child and parent operators can't be used in conjunction with any other search terms. I.e. "type:way" and then "child" works for finding all nodes which belong to ways, but "type:way child" doesn't. Neither does combining them with anything else.

And "parent child" doesn't work, which I would expect to find all relations a way belongs to and all of its nodes when I have a way selected that's a member of a relation.

comment:3 by Matt, 15 years ago

Here's a better patch, which allows expression "arguments" to the parent and child keywords. For example, to select all neighbouring ways of a selected way, "parent(child(selected)) type:way" works nicely. The parentheses are optional for single-argument expressions, but its more readable to keep them. (i.e: the above could have been "parent child selected type:way")

by Matt, 15 years ago

A better patch for parent/child relationship search.

in reply to:  3 comment:4 by avarab@…, 15 years ago

Replying to Matt:

Here's a better patch, which allows expression "arguments" to the parent and child keywords. For example, to select all neighbouring ways of a selected way, "parent(child(selected)) type:way" works nicely. The parentheses are optional for single-argument expressions, but its more readable to keep them. (i.e: the above could have been "parent child selected type:way")

This minor patch improves upon your patch:

  • "child" or "parent" i.e. without argument is no longer a NullPointerException but equivalent to "parent()" or "child()" respectively. I.e. it'll match everything that's the child or parent of some other object. I thought about making it an error about "child/parent without argument" but that would be inconsistent with the rest of the search syntax where omitting optional expressions always means "match everything".
  • The operators now stringify to child() and parent() instead of childof() and parentof()

Other than that I've tested this patch extensively and it's working just as expected. I can now do, for example:

parent(parent(type:node ^highway$:^traffic_signals$) ^highway$:^trunk$) ^type$:^route$

To select all route relations which cover trunk ways which have a traffic signal.

comment:5 by stoecker, 15 years ago

Resolution: fixed
Status: newclosed

In r1603.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
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.