query-7b073f5b07b8c40a39f9bcfc5c2f4ff5
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
#defaultView:Map
SELECT ?i ?iLabel (SAMPLE(?c) as ?cs) (MAX(?dist) as ?layer) {
VALUES ?i { wd:Q26426 wd:Q984372 wd:Q2610570 }
?i p:P625 ?a ; p:P625 ?b. FILTER(STR(?a) < STR(?b))
?a ps:P625 ?c . ?b ps:P625 ?d.
BIND(geof:distance(?c,?d) as ?dist)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?i ?iLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?a")
v2("?b")
v4("?c"):::projected
v7("?cs")
v5("?d")
v6("?dist"):::projected
v3("?i"):::projected
v8("?layer")
c4(["bd:serviceParam"]):::iri
c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["str(?a) < str(?b)"]]
f0 --> v1
f0 --> v2
bind1[/VALUES ?i/]
bind1-->v3
bind10(["wd:Q26426"])
bind10 --> bind1
bind11(["wd:Q984372"])
bind11 --> bind1
bind12(["wd:Q2610570"])
bind12 --> bind1
v3 --"p:P625"--> v1
v3 --"p:P625"--> v2
v1 --"p:statement/P625"--> v4
v2 --"p:statement/P625"--> v5
bind2[/"http://www.opengis.net/def/function/geosparql/distance(?c,?d)"/]
v4 --o bind2
v5 --o bind2
bind2 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end
bind5[/"sample(?c)"/]
v4 --o bind5
bind5 --as--o v7
bind6[/"max(?dist)"/]
v6 --o bind6
bind6 --as--o v8