query-07ce2660fdf32a5d3f809f58cff476b7
Wikidata entries for British ambassadors and high commissioners
all people who held at least one such position
one line per position held (so many people appear repeatedly)
start/end dates for that particular position
select distinct ?person ?personLabel ?positionLabel ?startyear ?endyear ?birthyear ?deathyear ?image ?otherpositionLabel ?otherstartyear ?otherendyear where { { ?position wdt:P31 wd:Q18115939 . } union { ?position wdt:P31 wd:Q56760832 } . # position is UK ambassador or high commissioner
?person p:P39 ?positionStatement . ?positionStatement ps:P39 ?position . # find positions they held
{ ?person wdt:P18 ?image . } .
optional { ?positionStatement pq:P580 ?start . bind(year(?start) as ?startyear) } # id start year
optional { ?positionStatement pq:P582 ?end . bind(year(?end) as ?endyear) } # id end year
optional { ?person wdt:P569 ?born . bind(year(?born) as ?birthyear) } # id start year
optional { ?person wdt:P570 ?died . bind(year(?died) as ?deathyear) } # id end year
optional { ?person p:P39 ?otherpositionStatement . ?otherpositionStatement ps:P39 ?otherposition .
filter not exists { ?otherposition wdt:P31 wd:Q18115939 . }
filter not exists { ?otherposition wdt:P31 wd:Q56760832 . }
filter not exists { ?otherpositionStatement ps:P39 wd:Q121998 . }
optional { ?otherpositionStatement pq:P580 ?otherstart . bind(year(?otherstart) as ?otherstartyear) }
optional { ?otherpositionStatement pq:P580 ?otherend . bind(year(?otherend) as ?otherendyear) }
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
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#>
# Wikidata entries for British ambassadors and high commissioners
# all people who held at least one such position
# one line per position held (so many people appear repeatedly)
# start/end dates for that particular position
select distinct ?person ?personLabel ?positionLabel ?startyear ?endyear ?birthyear ?deathyear ?image ?otherpositionLabel ?otherstartyear ?otherendyear where
{
{ ?position wdt:P31 wd:Q18115939 . } union { ?position wdt:P31 wd:Q56760832 } . # position is UK ambassador or high commissioner
?person p:P39 ?positionStatement . ?positionStatement ps:P39 ?position . # find positions they held
{ ?person wdt:P18 ?image . } .
optional { ?positionStatement pq:P580 ?start . bind(year(?start) as ?startyear) } # id start year
optional { ?positionStatement pq:P582 ?end . bind(year(?end) as ?endyear) } # id end year
optional { ?person wdt:P569 ?born . bind(year(?born) as ?birthyear) } # id start year
optional { ?person wdt:P570 ?died . bind(year(?died) as ?deathyear) } # id end year
optional { ?person p:P39 ?otherpositionStatement . ?otherpositionStatement ps:P39 ?otherposition .
filter not exists { ?otherposition wdt:P31 wd:Q18115939 . }
filter not exists { ?otherposition wdt:P31 wd:Q56760832 . }
filter not exists { ?otherpositionStatement ps:P39 wd:Q121998 . }
optional { ?otherpositionStatement pq:P580 ?otherstart . bind(year(?otherstart) as ?otherstartyear) }
optional { ?otherpositionStatement pq:P580 ?otherend . bind(year(?otherend) as ?otherendyear) }
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}