query-a5119a5e645b597331132262420b9484
National Heads of Government redux-level position in them (with blanks where none exist), I can do this fairly simply with: (Q7614320)finance minister If I want to generate a list of every country, and the
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:Q7614320 ; # find any subclass of "finance minister"
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:Q7614320"]):::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