query-6cb79913ef68f45cbb26d9002a380da5
upd: etwas überarbeitet kommt zwar was raus, aber eher wenig sinnvolles:
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemlabel ?GKZ ?bürgermeister
WHERE {
?item wdt:P31/wdt:P279* wd:Q486972; # Städte und Gemeinden in Bayern
wdt:P131/wdt:P279* wd:Q980. # in Bayern
OPTIONAL { ?item p:P6 ?statement .
?statement ps:P6 ?bürgermeister .
?statement pq:P580 ?start .
}
OPTIONAL { ?item wdt:P439 ?GKZ . } # Gemeindekennzahl
SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?GKZ"):::projected
v3("?bürgermeister"):::projected
v1("?item"):::projected
v4("?start")
v2("?statement")
a1((" "))
a2((" "))
c13(["de"]):::literal
c3(["wd:Q486972"]):::iri
c11(["bd:serviceParam"]):::iri
c5(["wd:Q980"]):::iri
v1 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v1 --"p:direct/P131"--> a2
a2 --"p:direct/P279"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P6".-> v2
v2 --"p:statement/P6"--> v3
v2 --"p:qualifier/P580"--> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P439".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end