query-012108b2895d8e1c8a99d8cdf1f8d0c4
Verwaltungseinheiten in Bayern
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
#title: Verwaltungseinheiten in Bayern
SELECT DISTINCT ?item ?name (GROUP_CONCAT(?typ; SEPARATOR = ", ") AS ?ist_ein) ?article ?page_title ?einwohner ?location WHERE {
{
?item wdt:P17 wd:Q183;
wdt:P31 wd:Q85482556, ?einheit.
OPTIONAL {
?item p:P31 _:b15.
_:b15 pq:P582 ?end.
}
FILTER(!(BOUND(?end)))
}
UNION
{
?item wdt:P17 wd:Q183;
wdt:P31 wd:Q85631896, ?einheit.
}
UNION
{
?item wdt:P17 wd:Q183;
wdt:P31 wd:Q464235, ?einheit.
FILTER(!(EXISTS { ?item wdt:P576 ?demolished. }))
}
OPTIONAL {
?dewiki schema:about ?item;
schema:isPartOf <https://de.wikipedia.org/>;
schema:name ?page_title.
}
BIND(IF(BOUND(?dewiki), ?dewiki, ?enwiki) AS ?article)
OPTIONAL { ?item wdt:P625 ?location. }
OPTIONAL { ?item wdt:P1082 ?einwohner. }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?item rdfs:label ?name.
?einheit rdfs:label ?typ.
}
}
GROUP BY ?item ?name ?article ?page_title ?einwohner ?location
ORDER BY DESC (?einwohner)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?article"):::projected
v5("?demolished")
v6("?dewiki")
v4("?einheit")
v1("?einwohner"):::projected
v2("?end")
v12("?ist_ein")
v3("?item"):::projected
v9("?location"):::projected
v10("?name"):::projected
v7("?page_title"):::projected
v11("?typ"):::projected
a1((" "))
c12([https://de.wikipedia.org/]):::iri
c4(["wd:Q85482556"]):::iri
c9(["wd:Q464235"]):::iri
c17(["bd:serviceParam"]):::iri
c19(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q183"]):::iri
c7(["wd:Q85631896"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:direct/P576"--> e0v2
e0v2("?demolished"):::projected
e0v1("?item"):::projected
end
f0--EXISTS--> f0e0
f0 --> v3
f0 --> c8
f0 --> v5
v3 --"p:direct/P576"--> v5
v3 --"p:direct/P17"--> c2
v3 --"p:direct/P31"--> c9
v3 --"p:direct/P31"--> v4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"p:direct/P17"--> c2
v3 --"p:direct/P31"--> c7
v3 --"p:direct/P31"--> v4
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f1[["not bound(?end)"]]
f1 --> v2
v3 --"p:direct/P17"--> c2
v3 --"p:direct/P31"--> c4
v3 --"p:direct/P31"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P31".-> a1
a1 --"p:qualifier/P582"--> v2
end
end
union0r <== or ==> union0l
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."schema:about".-> v3
v6 --"schema:isPartOf"--> c12
v6 --"schema:name"--> v7
end
bind2[/"if(bound(?dewiki),?dewiki,?enwiki)"/]
v6 --o bind2
null --o bind2
bind2 --as--o v8
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P625".-> v9
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P1082".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c17 --"wikibase:language"--> c19
v3 --"rdfs:label"--> v10
v4 --"rdfs:label"--> v11
end
bind4[/"?typ"/]
v11 --o bind4
bind4 --as--o v12