query-3e224381b60a457460079cc2557d2317
German municipalities grouped by population date
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
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 ?populationDate (COUNT(?muni) as ?count) WHERE {
VALUES ?instance {wd:Q262166 wd:Q42744322} .
?muni p:P31 ?instanceBlock .
?instanceBlock v:P31 ?instance .
FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
?muni p:P1082 ?populationBlock .
?populationBlock v:P1082 ?population .
?populationBlock wikibase:rank wikibase:PreferredRank .
?populationBlock pq:P585 ?populationDate
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?populationDate
ORDER BY DESC(?count) ?populationDate
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?count")
v4("?end")
v5("?instance")
v3("?instanceBlock")
v6("?muni"):::projected
v8("?population")
v7("?populationBlock")
v2("?populationDate"):::projected
c12(["de"]):::literal
c10(["bd:serviceParam"]):::iri
c7(["wikibase:PreferredRank"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:qualifier/P582"--> e0v2
e0v2("?end"):::projected
e0v1("?instanceBlock"):::projected
end
f0--EXISTS--> f0e0
f0 --> v3
f0 --> c1
f0 --> v4
v3 --"p:qualifier/P582"--> v4
bind1[/VALUES ?instance/]
bind1-->v5
bind10(["wd:Q262166"])
bind10 --> bind1
bind11(["wd:Q42744322"])
bind11 --> bind1
v6 --"p:P31"--> v3
v3 --"p:statement/P31"--> v5
v6 --"p:P1082"--> v7
v7 --"p:statement/P1082"--> v8
v7 --"wikibase:rank"--> c7
v7 --"p:qualifier/P585"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
bind3[/"count(?muni)"/]
v6 --o bind3
bind3 --as--o v9