query-f6e60923c6c3d78ce57f21e95b94fe39
Scatterplot queryThe following query sort of works, but there's odd stuff going on. matches. It compares the main coordinates for a set of items with GB1900 coordinates stored as a qualifier on the GB1900 statement. It then turns the difference into an approximate x-offset (dx) and y-offset (dy) in kilometres, and plots dx and dy on a scatterplot. The idea is to see where the GB1900 points (which represent the start of labels on the map) occur relative to the location of the actual item (represented by the main coordinates?), and to try to surface any outliers. (P9284)GB1900 ID The query is a quality-control query for It does sort-of work, but Is there any way to add more information to the points -- ideally including their Qids, item labels, and a specially-constructed url to link to the OS1900 map. I seem to be getting a rogue point with a very large negative dx value, that doesn't correspond to anything in the table. (Could it be the sum of all the dx,dy values ?)It would also be nice to be able to force the axes to be the same scale.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:ScatterChart
#SELECT ?dx ?dy ?item ?itemLabel (?dx * ?dx + ?dy * ?dy AS ?r2)
SELECT ?dx ?dy ?itemLabel
WHERE {
{
SELECT ?item ?gb1900_stmt ?coord_stmt WHERE {
?item p:P9284 ?gb1900_stmt .
?item wdt:P31 wd:Q489357 .
?item p:P625 ?coord_stmt .
}
}.
?coord_stmt psv:P625/wikibase:geoLatitude ?wd_lat .
?coord_stmt psv:P625/wikibase:geoLongitude ?wd_lon .
?gb1900_stmt pqv:P625/wikibase:geoLatitude ?gb_lat .
?gb1900_stmt pqv:P625/wikibase:geoLongitude ?gb_lon .
BIND ( 111.2 * (?gb_lat - ?wd_lat) AS ?dy) . # one degree of latitude is about 111 km
BIND ( 65.4 * (?gb_lon - ?wd_lon) AS ?dx) . # one degree of longitude is about 63 km at 54 degrees North. (eg York)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY DESC(?r2)