query-2e60a6e5c11d7f123c6bebe76d6d3955
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?coord ?place ?placeLabel ?location ?dist
WHERE
{
?item wdt:P31/wdt:P279* wd:Q12323.
?item wdt:P625 ?coord.
?item wdt:P17 wd:Q17
SERVICE wikibase:around {
?place wdt:P625 ?location .
bd:serviceParam wikibase:center ?coord .
bd:serviceParam wikibase:radius "1.00001" .
bd:serviceParam wikibase:distance ?dist.
}
?place wdt:P31/wdt:P279* wd:Q12323.
filter(str(?item) < str(?place))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?dist
Query found at
- https://www.wikidata.org/wiki/User:MSGJ/queries
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/08
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?coord"):::projected
v1("?dist"):::projected
v2("?item"):::projected
v5("?location"):::projected
v3("?place"):::projected
a1((" "))
a2((" "))
c6(["wd:Q17"]):::iri
c8(["bd:serviceParam"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q12323"]):::iri
c11(["1.00001"]):::literal
f0[["str(?item) < str(?place)"]]
f0 --> v2
f0 --> v3
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P625"--> v4
v2 --"wdt:P17"--> c6
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v3 --"wdt:P625"--> v5
c8 --"wikibase:center"--> v4
c8 --"wikibase:radius"--> c11
c8 --"wikibase:distance"--> v1
end
v3 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c3
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c8 --"wikibase:language"--> c15
end