query-faecf2d145ffe47d84f3a560d7161ab2
Get LatLng of Administrative territorial entity if availableHi, I would like to get the LatLng of "contains administrative territorial entity (P150)" of a city. This works fine as long there are P150:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?ort ?ortLabel ?wappen ?coord ?ortsteile ?ortsteileLabel ?ortsteileLatLng
WHERE
{
?ort wdt:P439 '02000000'. #HH: 02000000. WGT:08215090, Stutensee:08215109, Berlin:11000000
OPTIONAL{?ort wdt:P94 ?wappen .}
OPTIONAL{?ort wdt:P625 ?coord .}
OPTIONAL{?ort wdt:P150 ?ortsteile .}
OPTIONAL{?ortsteile wdt:P625 ?ortsteileLatLng .}
#BIND(if(bound(?ortsteileTmp), ?ortsteileTmp, ?o_tmp) AS ?ortsteile)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?coord"):::projected
v1("?ort"):::projected
v4("?ortsteile"):::projected
v5("?ortsteileLatLng"):::projected
v2("?wappen"):::projected
c2(["02000000"]):::literal
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;"]):::literal
v1 --"wdt:P439"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P94".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P625".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P150".-> v4
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P625".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end