Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#15264 closed enhancement (fixed)

Add support for OSM+Wikidata SPARQL queries

Reported by: nyurik Owned by: team
Priority: normal Milestone:
Component: Plugin wikipedia Version:
Keywords: Cc:

Description (last modified by nyurik)

The new OSM+Wikidata service offers a new approach to improve the quality of existing OSM data.

The service has both OSM data as well as a full copy of Wikidata database, plus it includes information for the Wikipedia pageviews - allowing queries for the popularity of articles. The service uses SPARQL - a well known, standardized SQL-like language for graph databases. Numerous example queries, accessible directly from the service, would show some of the service capabilities. While the service can show things as a graph or a map, JOSM's integration would only need a simple table output. The service is actually an adaptation of Wikidata's existing storage, plus some OSM-specific features and data.


The easiest would be to simply look at all the returned columns, and use all value URIs that begin with a known prefix, e.g. <> -- and then perform "download objects by IDs".

Geometry info:

Unlike OverpassTurbo, this service does not store or process geometries. Instead, it stores object centroids as a single point. There are several functions for geo searching, listed in

An example
has a few wikidata examples for using bounding box - JOSM could expand {{bbox}} into

bd:serviceParam wikibase:cornerWest "Point(2.295 48.8738)"geo:wktLiteral .
bd:serviceParam wikibase:cornerEast "Point(2.33575 48.861088888)"geo:wktLiteral .

and it could expand {{center}} into "Point(2.33575 48.861088888)"geo:wktLiteral constant.

Attachments (0)

Change History (10)

comment:1 by nyurik, 6 years ago

Description: modified (diff)

comment:2 by nyurik, 6 years ago

Resolution: fixed
Status: newclosed

implemented as part of Wikipedia plugin

comment:3 by Don-vip, 6 years ago

Component: CorePlugin wikipedia

comment:4 by Don-vip, 6 years ago

Thank you! When dealing with plugins it is good practice to mention the related commits in the bugtracker, as follows: [o33621:33629].

The changes seemed to have impacted the integration test, which now fails in headless mode:

2017-09-18 21:28:47.784 GRAVE: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin wikipedia. Cause: java.lang.reflect.InvocationTargetException. Cause: java.awt.HeadlessException
org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin wikipedia
	at org.openstreetmap.josm.plugins.PluginInformation.load(
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugin(
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugins(
	at org.openstreetmap.josm.plugins.PluginHandler.loadLatePlugins(
	at org.openstreetmap.josm.plugins.PluginHandlerTestIT.testValidityOfAvailablePlugins(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(
	at org.openstreetmap.josm.testutils.JOSMTestRules$
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.lang.reflect.Constructor.newInstance(
	at org.openstreetmap.josm.plugins.PluginInformation.load(
	... 13 more
Caused by: java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(
	at java.awt.Window.init(
	at java.awt.Window.<init>(
	at java.awt.Window.<init>(
	at java.awt.Dialog.<init>(
	at javax.swing.JDialog.<init>(
	at org.wikipedia.WikipediaPlugin.<init>(
	... 18 more

Dialogs are generally built in the mapFrameInitialized method, not in the constructor.

comment:5 by nyurik, 6 years ago

Thanks for the heads up! Is there a way I can run these tests locally? I cannot initialize dialog in mapFrameInitialized because it gets called only after the first layer is created. If the user starts JOSM and immediately opens the download data dialog, they won't see the new tab. Is there another way to initialize it?

comment:6 by Don-vip, 6 years ago

You're right I'll see if I can make this method static.

comment:7 by Don-vip, 6 years ago

In 12878/josm:

see #15264 - change DownloadDialog.addDownloadSource() to a static method so that plugins can add their own sources without creating an instance of the download dialog

comment:8 by Don-vip, 6 years ago

plugin updated in [o33635:33636].

comment:9 by simon04, 6 years ago

In 12880/josm:

see #15057, see #15264 - Rename OverpassQueryList to UserQueryList

This allows to use it also in the wikipedia plugin without name confusion.

comment:10 by simon04, 6 years ago

[o33641] - reuse UserQueryList (drops massive code duplication) - see #josm15264

Modify Ticket

Change Properties
Set your email in Preferences
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.