query-4e562464a88d03561306cb0b76158947
TODO
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?coord ?rank ?coord2 ?rank2 ?dist
WHERE
{
?item wdt:P31/wdt:P279* wd:Q12323.
?item p:P625 ?stat . ?stat ps:P625 ?coord. ?stat wikibase:rank ?rank .
?item p:P625 ?stat2 . ?stat2 ps:P625 ?coord2. ?stat2 wikibase:rank ?rank2 .
?item wdt:P17 wd:Q17
filter(str(?stat) < str(?stat2))
BIND(geof:distance(?coord, ?coord2) as ?dist)
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;
v4("?coord"):::projected
v6("?coord2"):::projected
v8("?dist"):::projected
v3("?item"):::projected
v5("?rank"):::projected
v7("?rank2"):::projected
v1("?stat")
v2("?stat2")
a1((" "))
c8(["wd:Q17"]):::iri
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q12323"]):::iri
f0[["str(?stat) < str(?stat2)"]]
f0 --> v1
f0 --> v2
v3 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v3 --"p:P625"--> v1
v1 --"p:statement/P625"--> v4
v1 --"wikibase:rank"--> v5
v3 --"p:P625"--> v2
v2 --"p:statement/P625"--> v6
v2 --"wikibase:rank"--> v7
v3 --"p:direct/P17"--> c8
bind1[/"http://www.opengis.net/def/function/geosparql/distance(?coord,?coord2)"/]
v4 --o bind1
v6 --o bind1
bind1 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end