#18164 closed enhancement (fixed)
Migrate OverpassTurboQueryWizard to Java or something else
Reported by: | simon04 | Owned by: | simon04 |
---|---|---|---|
Priority: | normal | Milestone: | 20.05 |
Component: | Core | Version: | |
Keywords: | overpass javascript nashorn sotm19 java15 | Cc: | Don-vip, tyr_asd |
Description
Currently, the query wizard is based on JavaScript and executed using java's Nashorn engine. To get rid of the already deprecated Nashorn dependency, we should implement the query wizard in Java.
Within overpass-turbo, the parsing is implemented in PEG.js, see the file https://github.com/tyrasd/overpass-turbo/blob/master/js/ffs/ffs.pegjs
Attachments (1)
Change History (32)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Keywords: | sotm19 added |
---|
comment:3 by , 5 years ago
Keywords: | java15 added |
---|
comment:4 by , 5 years ago
Cc: | added |
---|---|
Milestone: | → 20.03 |
Hosted overpass-wizard? · Issue #11
· https://github.com/tyrasd/overpass-wizard/issues/11
comment:5 by , 5 years ago
Summary: | Migrate OverpassTurboQueryWizard to Java → Migrate OverpassTurboQueryWizard to Java or something else |
---|
follow-up: 10 comment:6 by , 5 years ago
Implement overpass-wizard-server by simon04 · Pull Request #12
· https://github.com/tyrasd/overpass-wizard/pull/12
Running instance on my computer: https://overpass-wizard.josm.eu/wizard/?search=amenity=drinking_water&comment=false
@Don-vip, can we deploy a Node.js application on the JOSM server? Here are the instructions: https://github.com/tyrasd/overpass-wizard/tree/master/server
comment:7 by , 5 years ago
Cc: | added |
---|
comment:8 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 5 years ago
Attachment: | 18164.patch added |
---|
comment:9 by , 5 years ago
Next step: (a) deploy overpass-wizard-server, or (b) setup https://josm.openstreetmap.de/remote/overpass-wizard/ to https://overpass-wizard.josm.eu/wizard/
follow-up: 14 comment:10 by , 5 years ago
Replying to simon04:
@Don-vip, can we deploy a Node.js application on the JOSM server? Here are the instructions: https://github.com/tyrasd/overpass-wizard/tree/master/server
Sure, I can do that. But do we really need it? If I understand the ticket correctly, only https://github.com/tyrasd/overpass-turbo/blob/master/js/ffs/ffs.pegjs would need to be migrated to Java? It seems doable, no?
comment:11 by , 5 years ago
Two additional JavaScript files/modules are required: https://github.com/tyrasd/overpass-turbo/blob/master/js/ffs.js plus https://github.com/tyrasd/overpass-turbo/blob/master/js/ffs/free.js
comment:12 by , 5 years ago
So around 800 lines of JavaScript. I'll give a try if you don't beat me to it :) I'd like to keep it simple and Java-only :)
follow-up: 15 comment:13 by , 5 years ago
A different approach we could investigate: sparse the query using your SearchCompiler` and turn the parsed AST into an Overpass Query. Advantages: not yet another parser for key=value; reused code; same syntax as used for search within JOSM; disadvantages: likely a slightly different syntax than accepted by overpass-wizard.
Vincent, what do you think?
follow-up: 16 comment:14 by , 5 years ago
The most up to date wizard code would be at https://github.com/tyrasd/overpass-wizard/. If you think about porting it to Java, probably everything should be ported (also tests, documentation, etc.). It's probably not too hard to do, but keep in mind that some queries might involve geocoder loopups (e.g. "tourism=hotel in Heidelberg"). Also, the auto-generated parser (https://github.com/tyrasd/overpass-wizard/blob/master/parser.js – currently about 1500 lines of code) would need to be ported as well (and again every time the base grammar is modified), if you don't want to port pegjs to java as well.
comment:15 by , 5 years ago
Replying to simon04:
A different approach we could investigate: sparse the query using your SearchCompiler` and turn the parsed AST into an Overpass Query. Advantages: not yet another parser for key=value; reused code; same syntax as used for search within JOSM; disadvantages: likely a slightly different syntax than accepted by overpass-wizard.
Vincent, what do you think?
Here, one potential issue comes to my mind: Probably not all features of the JOSM search are possible to translate to an Overpass Query easily. And some features of the wizard syntax are not yet present in the search functionality (e.g. "… in Heidelberg" to search in a given region). While these are easy to translate into an Overpass query, these features would not be easy to implement on the JOSM search itself. So you would probably end up with two different dialects of a query syntax again. ¯\_(ツ)_/¯
comment:16 by , 5 years ago
Replying to tyr_asd:
Also, the auto-generated parser (https://github.com/tyrasd/overpass-wizard/blob/master/parser.js – currently about 1500 lines of code) would need to be ported as well (and again every time the base grammar is modified), if you don't want to port pegjs to java as well.
I guess we can translate the pegjs parser definition using JavaCC. The parser itself would be generated like MapCSS.
follow-up: 18 comment:17 by , 5 years ago
Ah, yes. That sounds like a better approach. I would be interested to see how you would translate the grammar of the parser to JavaCC. :)
Out of curiousity: You didn't use JavaCC for the "search compiler", right? Is that just because of legacy reasons, or did you encounter problems when defining a grammar for it?
comment:18 by , 5 years ago
Replying to tyr_asd:
Out of curiousity: You didn't use JavaCC for the "search compiler", right? Is that just because of legacy reasons, or did you encounter problems when defining a grammar for it?
The SearchCompiler
has been introduced in 2008 via r513. We started using JavaCC in 2013 for MapCSS (introduced in r3848).
comment:19 by , 5 years ago
Milestone: | 20.03 → 20.04 |
---|
comment:22 by , 5 years ago
This is not supported by JOSM, but the wizard at http://overpass-turbo.eu/ converts it:
type:relation and type=restriction and ~"restr.*"~"no.*"
In 15370/josm: