query-2eed43fbe502f492c3e69b33a1d0280b
Label of OPTIONAL
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 ?country ?countryLabel ?capital WHERE {
?country wdt:P31 wd:Q3624078 .
FILTER NOT EXISTS { ?country wdt:P31 wd:Q3024240 } .
OPTIONAL { ?country wdt:P36 ?capital} .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY ?countryLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?capital"):::projected
v2("?country"):::projected
v1("?countryLabel"):::projected
c2(["wd:Q3024240"]):::iri
c3(["wd:Q3624078"]):::iri
c6(["bd:serviceParam"]):::iri
c8(["en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?country"):::projected
e0c2(["wd:Q3024240"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> c2
v2 --"wdt:P31"--> c2
v2 --"wdt:P31"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P36".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end