Modify

Opened 3 years ago

Closed 3 years ago

#20843 closed defect (invalid)

Tagging presets: "match_expression" does not work

Reported by: skyper Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: template_report tagging preset match_expression Cc: simon04

Description

Testing the new feature, I am either too stupid or it does not work. I tried to remove yes from the value list of residential buildings, see #20526.

What steps will reproduce the problem?

  1. Have an item with match_expression="" as option, example see below
  2. Tag an object with a matching tag, e.g. building=yes or building=hut
<item name="Residential Building" icon="presets/landmark/building.svg" type="node,closedway,multipolygon" preset_name_label="true" match_expression="building=(yes|residential|apartments|ger|house|hotel|hut|bungalow|dormitory|terrace|detached|farm)">

What is the expected result?

The tagging preset links is displayed on top of the property list panel

What happens instead?

No link

Please provide any additional information below. Attach a screenshot if possible.

The search in JOSM works and finds all appropriate matches but I was not able to get any link displayed using the new feature.

I careful looked at the code to make sure there is no other match="" within the item as I am not sure if keyvalue! is able to overwrite my expression.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-05-03 19:51:10 +0200 (Mon, 03 May 2021)
Revision:17858
Build-Date:2021-05-04 01:31:01
URL:https://josm.openstreetmap.de/svn/trunk

Tagging presets:
+ ${HOME}/JOSM/new/resources/data/defaultpresets_17833_residential_building_20526.xml

Attachments (0)

Change History (12)

in reply to:  description ; comment:1 by Don-vip, 3 years ago

Replying to skyper:

<item match_expression="building=(yes|residential|apartments|ger|house|hotel|hut|bungalow|dormitory|terrace|detached|farm)">

The search in JOSM works and finds all appropriate matches

No it doesn't. I don't understand fully how this query is understood by JOSM but it doesn't work. It catches tags like living_street=yes for example.

This works as you would expect:

(building=yes|building=residential|building=apartments|building=ger|building=house|building=hotel|building=hut|building=bungalow|building=dormitory|building=terrace|building=detached|building=farm)
Last edited 3 years ago by Don-vip (previous) (diff)

comment:2 by Famlam, 3 years ago

No it doesn't. I don't understand fully how this query is understood by JOSM but it doesn't work.

I think part of the attempts to understand this was accidentally committed in https://josm.openstreetmap.de/changeset/18038/josm ;)

comment:3 by Don-vip, 3 years ago

oops

comment:4 by Don-vip, 3 years ago

In 18039/josm:

see #20843 - see #21123 - revert accidental change

comment:5 by Don-vip, 3 years ago

thanks for the notice.

in reply to:  1 comment:6 by skyper, 3 years ago

Replying to Don-vip:

Replying to skyper:

<item match_expression="building=(yes|residential|apartments|ger|house|hotel|hut|bungalow|dormitory|terrace|detached|farm)">

The search in JOSM works and finds all appropriate matches

No it doesn't. I don't understand fully how this query is understood by JOSM but it doesn't work. It catches tags like living_street=yes for example.

Strange, did something change over the last two month?

This works as you would expect:

(building=yes|building=residential|building=apartments|building=ger|building=house|building=hotel|building=hut|building=bungalow|building=dormitory|building=terrace|building=detached|building=farm)

Thanks, I take another look.

A proper documentation would help me a lot. Which search syntax can be used and how does it work together with match=* or does the combination not work at all?

In the end, I simply tried to remove the value yes from the building=* combo but still get the preset link for residential buildings for building=yes.

comment:7 by skyper, 3 years ago

Please, help.
Working on #21398 I tried to have own presets per plant:source and a general one for unknown/missing/multiple plant:source=*

I found two different expressions in Search dialog which work either using "OR" or "|" but the preset does not load. I noticed that I have to use quotes in the search dialog but I can not add them in xml.

power=plant -("plant:source"=biofuel OR "plant:source"=biogas OR "plant:source"=biomass OR "plant:source"=coal OR "plant:source"=diesel OR "plant:source"=gas OR "plant:source"=wave OR "plant:source"=wind)
    <item name="Power Plant" icon="presets/power/plant.svg" type="closedway,multipolygon,relation" preset_name_label="true" match_expression="power=plant -(plant:source=biofuel|plant:source=biogas|plant:source=biomass|plant:source=coal|plant:source=diesel|plant:source=gas|plant:source=gasoline|plant:source=geothermal|plant:source=hydro|plant:source=nuclear|plant:source=oil|plant:source=osmotic|plant:source=solar|plant:source=tidal|plant:source=waste|plant:source=wave|plant:source=wind)">
SEVERE: org.openstreetmap.josm.tools.XmlParsingException: java.lang.reflect.InvocationTargetException (at line 6 187, column 500). Cause: java.lang.reflect.InvocationTargetException. Cause: org.xml.sax.SAXException: org.openstreetmap.josm.data.osm.search.SearchParseError: Unexpected token. Expected <right parent>, found <equals>. Cause: org.openstreetmap.josm.data.osm.search.SearchParseError: Unexpected token. Expected <right parent>, found <equals>

I tried backslash (\) and single quote ' as escape characters without success.

Last edited 3 years ago by skyper (previous) (diff)

comment:8 by skyper, 3 years ago

I have the same problem in Presets/MastAndTower with the two general presets for mast resp. tower. Again, I have a : a key and want to exclude certain values of this subkey.

comment:9 by marcello@…, 3 years ago

How about using &quot;?

match_expression="power=plant -(&quot;plant:source&quot;=biofuel|...

comment:10 by skyper, 3 years ago

Oh thanks, I always forget about &quot;. I need to document it!
Think I got it to work but without the ( as this is not accepted:

2021-10-11 14:10:21.138 SEVERE: org.openstreetmap.josm.tools.XmlParsingException: java.lang.reflect.InvocationTargetException (at line 234, column 501). Cause: java.lang.reflect.InvocationTargetException. Cause: org.xml.sax.SAXException: org.openstreetmap.josm.data.osm.search.SearchParseError: Unexpected token. Expected <right parent>, found <end-of-file>. Cause: org.openstreetmap.josm.data.osm.search.SearchParseError: Unexpected token. Expected <right parent>, found <end-of-file>
org.openstreetmap.josm.tools.XmlParsingException: java.lang.reflect.InvocationTargetException (at line 234, column 501)

in reply to:  10 comment:11 by skyper, 3 years ago

Replying to skyper:

Think I got it to work but without the ( as this is not accepted:

Strange, now it works with (, too.

comment:12 by skyper, 3 years ago

Resolution: invalid
Status: newclosed

@simon04:
I am sorry, everything is working. It was just me not finding the correct search to use and being to dumb to find the correct quote symbol to use.

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.