query-4fa0422673b1deba8a1166f8f646ea18
it times out: (Q2285706)head of government However, if it try to do the equivalent with
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 ?country ?countryLabel ?office ?officeLabel
WHERE {
?country wdt:P31 wd:Q6256 . # for all countries
OPTIONAL {
?office wdt:P279* wd:Q2285706 ; # find any subclass of "head of government"
wdt:P1001 ?country . # with that jurisdiction
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?countryLabel ?officeLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?country"):::projected
v1("?countryLabel"):::projected
v4("?office"):::projected
v2("?officeLabel"):::projected
c7(["bd:serviceParam"]):::iri
c4(["wd:Q2285706"]):::iri
c9(["en"]):::literal
c2(["wd:Q6256"]):::iri
v3 --"wdt:P31"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P279".-> c4
v4 --"wdt:P1001"--> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end