query-146472e9f9789efd635e78bfc98bf0d0
Wikidata entries for British ambassadors and high commissioners
count is number of distinct individuals in Wikidata known to hold the role
and number sourced to the FCO database
select distinct ?item ?itemLabel ?count ?importedcount where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . # ambassador or high commissioner
optional { select distinct ?item (count(distinct ?holder) as ?count) where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . ?holder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item . } group by ?item } optional { select distinct ?item (count(distinct ?importedholder) as ?importedcount) where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . ?importedholder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item . ?positionStatement prov:wasDerivedFrom ?ref . ?ref pr:P248 wd:Q56808876 . } group by ?item } 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 prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Wikidata entries for British ambassadors and high commissioners
# count is number of distinct individuals in Wikidata known to hold the role
# and number sourced to the FCO database
select distinct ?item ?itemLabel ?count ?importedcount where
{
{ ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . # ambassador or high commissioner
optional { select distinct ?item (count(distinct ?holder) as ?count)
where
{
{ ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } .
?holder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item .
} group by ?item
}
optional { select distinct ?item (count(distinct ?importedholder) as ?importedcount)
where
{
{ ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } .
?importedholder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item .
?positionStatement prov:wasDerivedFrom ?ref . ?ref pr:P248 wd:Q56808876 .
} group by ?item
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}