query-39910d907e3ae685e61f5c58eab7fa33

rq turtle/ttl

German municipalities without current population

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?key ?muniLabel ?instanceLabel 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} .
  FILTER NOT EXISTS {
    ?muni p:P1082 ?populationBlock .
    ?populationBlock v:P1082 ?population .
    ?populationBlock wikibase:rank wikibase:PreferredRank .
    ?populationBlock pq:P585 "2019-09-30"^^xsd:date
  }
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?end") v7("?instance") v5("?instanceBlock") v1("?key"):::projected v2("?muni"):::projected v4("?population") v3("?populationBlock") c14(["de"]):::literal c4(["wikibase:PreferredRank"]):::iri c6(["2019-09-30^^xsd:date"]):::literal c12(["bd:serviceParam"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:P1082"--> e0v2 e0v2 --"p:statement/P1082"--> e0v3 e0v2 --"wikibase:rank"--> e0c4 e0v2 --"p:qualifier/P585"--> e0c6 e0v1("?muni"):::projected e0v3("?population"):::projected e0v2("?populationBlock"):::projected e0c4(["wikibase:PreferredRank"]):::iri e0c6(["2019-09-30^^xsd:date"]):::literal end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> v3 f0 --> c2 f0 --> v4 f0 --> c3 f0 --> c4 f0 --> c5 f0 --> c6 v2 --"p:P1082"--> v3 v3 --"p:statement/P1082"--> v4 v3 --"wikibase:rank"--> c4 v3 --"p:qualifier/P585"--> c6 f1[["not "]] subgraph f1e1["Exists Clause"] e1v1 --"p:qualifier/P582"--> e1v2 e1v2("?end"):::projected e1v1("?instanceBlock"):::projected end f1--EXISTS--> f1e1 f1 --> v5 f1 --> c7 f1 --> v6 v5 --"p:qualifier/P582"--> v6 bind2[/VALUES ?instance/] bind2-->v7 bind20(["wd:Q262166"]) bind20 --> bind2 bind21(["wd:Q42744322"]) bind21 --> bind2 v2 --"p:direct/P439"--> v1 v2 --"p:P31"--> v5 v5 --"p:statement/P31"--> v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end