query-54460dd204937ad49eac2af2094521df
Die 10688 kreisangehörigen Gemeinden Deutschlands mit Landkreis nach amtlichem Gemeindeschlüssel
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 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 ?ruralKey ?ruralLabel ?rural WHERE {
VALUES ?instance {wd:Q262166 wd:Q42744322} .
?muni p:P31 ?instanceBlock .
?instanceBlock v:P31 ?instance .
FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
?muni wdt:P439 ?key .
BIND (SUBSTR(?key,6,3) AS ?keyEnd) . FILTER(?keyEnd!="000") .
BIND (SUBSTR(?key,1,5) AS ?ruralKey) .
?rural wdt:P440 ?ruralKey
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;
v4("?end")
v5("?instance")
v3("?instanceBlock")
v1("?key"):::projected
v7("?keyEnd")
v6("?muni"):::projected
v8("?rural"):::projected
v7("?ruralKey"):::projected
c10(["de"]):::literal
c8(["bd:serviceParam"]):::iri
f0[["?keyEnd != '000'"]]
f0 --> v7
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:P31"--> v3
v3 --"p:statement/P31"--> v5
v6 --"p:direct/P439"--> v1
bind3[/"substring(?key,'6^^xsd:integer','3^^xsd:integer')"/]
v1 --o bind3
bind3 --as--o v7
bind4[/"substring(?key,'1^^xsd:integer','5^^xsd:integer')"/]
v1 --o bind4
bind4 --as--o v7
v8 --"p:direct/P440"--> v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end