query-37b4dc5c941f809e1c4e615a1df6d0b6
States and territories of Australia with capital
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 DISTINCT ?sOt ?sOtTypeLabel ?sOtLabel ?capitalLabel WHERE {
?sOt wdt:P31 ?sOtType .
?sOtType wdt:P279* wd:Q178712 .
?sOt wdt:P36 ?capital
FILTER NOT EXISTS {?sOt wdt:P576 ?dissolved}
FILTER(?sOtType NOT IN (wd:Q14192199))
SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
ORDER BY ?sOtTypeLabel ?sOt ?sOtLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?capital")
v5("?dissolved")
v2("?sOt"):::projected
v3("?sOtLabel"):::projected
v4("?sOtType")
v1("?sOtTypeLabel"):::projected
c5(["wd:Q178712"]):::iri
c8(["bd:serviceParam"]):::iri
c10(["en"]):::literal
f0[["?sOtType != 'wd:Q14192199'"]]
f0 --> v4
f1[["not "]]
subgraph f1e0["Exists Clause"]
e0v1 --"wdt:P576"--> e0v2
e0v2("?dissolved"):::projected
e0v1("?sOt"):::projected
end
f1--EXISTS--> f1e0
f1 --> v2
f1 --> c2
f1 --> v5
v2 --"wdt:P576"--> v5
v2 --"wdt:P31"--> v4
v4 --"wdt:P279"--> c5
v2 --"wdt:P36"--> v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end