query-c007b7311f208610a243b06f13f8fe51
All UK Heads of Government
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?ordinal ?person ?personLabel ?start_date ?end_date ?prev ?prevLabel ?next ?nextLabel ?office ?officeLabel
WHERE {
wd:Q145 wdt:P1313 ?office .
?person p:P39 ?posn ; wdt:P31 wd:Q5 .
?posn ps:P39 ?office .
OPTIONAL { ?posn pq:P580 ?start_date }
OPTIONAL { ?posn pq:P582 ?end_date }
OPTIONAL { ?posn pq:P1365 ?prev }
OPTIONAL { ?posn pq:P155 ?prev }
OPTIONAL { ?posn pq:P1366 ?next }
OPTIONAL { ?posn pq:P156 ?next }
OPTIONAL { ?posn pq:P1545 ?next }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY DESC(?start_date)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?end_date"):::projected
v7("?next"):::projected
v2("?office"):::projected
v3("?person"):::projected
v4("?posn")
v6("?prev"):::projected
v1("?start_date"):::projected
c17(["en"]):::literal
c15(["bd:serviceParam"]):::iri
c5(["wd:Q5"]):::iri
c1(["wd:Q145"]):::iri
c1 --"p:direct/P1313"--> v2
v3 --"p:P39"--> v4
v3 --"p:direct/P31"--> c5
v4 --"p:statement/P39"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P580".-> v1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P1365".-> v6
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P155".-> v6
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P1366".-> v7
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P156".-> v7
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P1545".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end