query-aae1bb803a500361c46484738af656bd
Einwohner gruppiert nach Gemeindenanfangsbuchstabe
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 bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?firstLetter (COUNT(?muni) AS ?munis) (ROUND(MIN(?pop)) AS ?min) (ROUND(AVG(?pop)) AS ?average) (ROUND(MAX(?pop)) AS ?max) (SUM(?pop) AS ?population) WHERE {
VALUES ?instance {wd:Q262166 wd:Q42744322} .
?muni wdt:P439 ?key .
?muni p:P31 ?instanceBlock .
?instanceBlock v:P31 ?instance .
FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
?muni wdt:P1082 ?pop .
?muni rdfs:label ?muniName . FILTER(lang(?muniName) = "de") .
BIND (SUBSTR(?muniName,1,1) AS ?firstLetter)
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?firstLetter
ORDER BY ?firstLetter
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?average")
v4("?end")
v9("?firstLetter"):::projected
v5("?instance")
v3("?instanceBlock")
v7("?key")
v12("?max")
v10("?min")
v6("?muni"):::projected
v2("?muniName")
v9("?munis")
v8("?pop"):::projected
v13("?population")
c1(["de"]):::literal
c9(["bd:serviceParam"]):::iri
f0[["?muniName = 'de'"]]
f0 --> v2
f1[["not "]]
subgraph f1e0["Exists Clause"]
e0v1 --"p:qualifier/P582"--> e0v2
e0v2("?end"):::projected
e0v1("?instanceBlock"):::projected
end
f1--EXISTS--> f1e0
f1 --> v3
f1 --> c2
f1 --> v4
v3 --"p:qualifier/P582"--> v4
bind2[/VALUES ?instance/]
bind2-->v5
bind20(["wd:Q262166"])
bind20 --> bind2
bind21(["wd:Q42744322"])
bind21 --> bind2
v6 --"p:direct/P439"--> v7
v6 --"p:P31"--> v3
v3 --"p:statement/P31"--> v5
v6 --"p:direct/P1082"--> v8
v6 --"rdfs:label"--> v2
bind3[/"substring(?muniName,'1^^xsd:integer','1^^xsd:integer')"/]
v2 --o bind3
bind3 --as--o v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c1
end
bind9[/"count(?muni)"/]
v6 --o bind9
bind9 --as--o v9
bind10[/"numeric-round()"/]
null --o bind10
bind10 --as--o v10
bind11[/"numeric-round()"/]
null --o bind11
bind11 --as--o v11
bind12[/"numeric-round()"/]
null --o bind12
bind12 --as--o v12
bind13[/"sum(?pop)"/]
v8 --o bind13
bind13 --as--o v13