query-9d9067ab24023d005dfc4c3f7c2c0df7

rq turtle/ttl

Adjacent constituencies 13:37, 6 February 2020 (UTC) Andy's edits; Talk to Andy); Pigsonthewing (Andy MabbettIs it yet possible, for a given UK parliamentary constituency; to list (or map) all the adjacent constituencies, please. 14:01, 6 February 2020 (UTC)) talk (Dipsacus fullonumThey have geographic coordinates on Wikidata so you can see them as dots on a map (code below). But I cannot see a way to deduce from that which are adjacent to each other. --

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE
{
  ?item wdt:P31 wd:Q27971968.
  ?item wdt:P625 ?coord.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?coord"):::projected v1("?item"):::projected c5(["bd:serviceParam"]):::iri c2(["wd:Q27971968"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wdt:P31"--> c2 v1 --"wdt:P625"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end