query-d5d043aba1399ccdab5f08ffe3bd81ab

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?coord1 ?coord2 ?distance WHERE {
   {
SELECT DISTINCT ?item ?coord1 ?coord2 WHERE {
    ?item wdt:P17 wd:Q35 . # in Denmark
    ?item wdt:P31/wdt:P279* wd:Q486972 . # settlement
    ?item wdt:P625 ?coord1 .
    ?item wdt:P625 ?coord2 . 
  filter ( ?coord1 < ?coord2 ) . # not the same
} 
}  BIND(geof:distance(?coord1, ?coord2) as ?distance)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en,[AUTO_LANGUAGE]". }
}
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?coord1"):::projected v3("?coord2"):::projected v5("?distance"):::projected v4("?item"):::projected v1("?itemLabel"):::projected a1((" ")) c5(["wd:Q486972"]):::iri c8(["bd:serviceParam"]):::iri c10(["da,en,#91;AUTO_LANGUAGE#93;"]):::literal c2(["wd:Q35"]):::iri f0[["?coord1 < ?coord2"]] f0 --> v2 f0 --> v3 v4 --"wdt:P17"--> c2 v4 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 v4 --"wdt:P625"--> v2 v4 --"wdt:P625"--> v3 bind1[/"http://www.opengis.net/def/function/geosparql/distance(?coord1,?coord2)"/] v2 --o bind1 v3 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end