query-00a5d02190fb72184d4f8f076060da8e
Die 16 Bundesländer mit ihrem Schlüssel und ihrer Hauptstadt
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#>
SELECT ?state ?prefix ?key ?stateLabel ?capitalLabel ?capitalKey ?capital WHERE{
?state wdt:P31 wd:Q1221156 .
?state wdt:P1388 ?key .
BIND (SUBSTR(?key,1,2) AS ?prefix) .
OPTIONAL{?state wdt:P36 ?capital . ?capital wdt:P439 ?capitalKey}
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?prefix
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?capital"):::projected
v5("?capitalKey"):::projected
v3("?key"):::projected
v4("?prefix"):::projected
v2("?state"):::projected
c9(["de"]):::literal
c7(["bd:serviceParam"]):::iri
c2(["wd:Q1221156"]):::iri
v2 --"wdt:P31"--> c2
v2 --"wdt:P1388"--> v3
bind0[/"substring(?key,'1^^xsd:integer','2^^xsd:integer')"/]
v3 --o bind0
bind0 --as--o v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P36".-> v4
v4 --"wdt:P439"--> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end