query-35a9d848e975cc15354ff63fff085b94
Finding all municipalities of Austria.I'm trying to find all municipalities of Austria with their coordinates and the population. This query:
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
SELECT DISTINCT ?itemLabel (AVG(?item_lat) AS ?lat) (AVG(?item_long) AS ?long) (AVG(?Einwohnerzahl) AS ?pop) WHERE {
?item wdt:P31 wd:Q667509.
?item rdfs:label ?itemLabel.
?item (p:P625/psv:P625) ?item_node.
?item_node wikibase:geoLatitude ?item_lat.
?item_node wikibase:geoLongitude ?item_long.
?item wdt:P1082 ?Einwohnerzahl.
FILTER((LANG(?itemLabel)) = "de")
}
GROUP BY ?itemLabel
ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?Einwohnerzahl"):::projected
v2("?item")
v1("?itemLabel"):::projected
v4("?item_lat"):::projected
v5("?item_long"):::projected
v3("?item_node")
v7("?lat")
v8("?long")
v9("?pop")
a1((" "))
c3(["wd:Q667509"]):::iri
f0[["?itemLabel = 'de'"]]
f0 --> v1
v2 --"p:direct/P31"--> c3
v2 --"rdfs:label"--> v1
v2 --"p:P625"--> a1
a1 --"p:statement/value/P625"--> v3
v3 --"wikibase:geoLatitude"--> v4
v3 --"wikibase:geoLongitude"--> v5
v2 --"p:direct/P1082"--> v6
bind4[/"average(?item_lat)"/]
v4 --o bind4
bind4 --as--o v7
bind5[/"average(?item_long)"/]
v5 --o bind5
bind5 --as--o v8
bind6[/"average(?Einwohnerzahl)"/]
v6 --o bind6
bind6 --as--o v9