query-f4d03c33f4e98efd550484041d24b285

rq turtle/ttl

Wikidata entries for British ambassadors and high commissioners

showing the number of those who have been deceased more than three years (=eligible for ODNB coverage)

and the proportion of those in the ODNB, a first-order approximation of "historical significance"

it is filtered so there must be ten or more deceased holders of a post (otherwise ones with low matching rates dominate)

bear in mind that Wikidata does not have complete matching to many of these posts yet so percentages may drop

select distinct ?item ?itemLabel ?number_of_deceased_holders ?percent_odnb where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . # ambassador or high commissioner

{ select distinct ?item (count(distinct ?holder) as ?number_of_deceased_holders) where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . ?holder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item . ?holder wdt:P570 ?died . FILTER (?died < "2015-01-01T00:00:00Z"^^xsd:dateTime) . # ie this person died before 1/1/2015 and so is theoretically ODNB-eligible } group by ?item } { select distinct ?item (count(distinct ?holder) as ?odnbcount) where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . ?holder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item . ?holder wdt:P1415 ?odnb . } group by ?item } filter(?number_of_deceased_holders >= 10) BIND(ROUND(100*(?odnbcount/?number_of_deceased_holders)) as ?percent_odnb) . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } order by desc(?percent_odnb) desc(?number_of_deceased_holders)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Wikidata entries for British ambassadors and high commissioners
# showing the number of those who have been deceased more than three years (=eligible for ODNB coverage)
# and the proportion of those in the ODNB, a first-order approximation of "historical significance"
# it is filtered so there must be ten or more deceased holders of a post (otherwise ones with low matching rates dominate)
# bear in mind that Wikidata does not have *complete* matching to many of these posts yet so percentages may drop

select distinct ?item ?itemLabel ?number_of_deceased_holders ?percent_odnb where
{
  { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . # ambassador or high commissioner

   { select distinct ?item (count(distinct ?holder) as ?number_of_deceased_holders) 
             where
                    {
                      { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } .
                      ?holder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item . 
                      ?holder wdt:P570 ?died . FILTER (?died < "2015-01-01T00:00:00Z"^^xsd:dateTime) .
                      # ie this person died before 1/1/2015 and so is theoretically ODNB-eligible
                    } group by ?item
            }
  { select distinct ?item (count(distinct ?holder) as ?odnbcount) 
             where
                    {
                      { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } .
                      ?holder p:P39 ?positionStatement . ?positionStatement ps:P39 ?item . 
                      ?holder wdt:P1415 ?odnb .
                    } group by ?item
            }
  filter(?number_of_deceased_holders >= 10)
  BIND(ROUND(100*(?odnbcount/?number_of_deceased_holders)) as ?percent_odnb) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by desc(?percent_odnb) desc(?number_of_deceased_holders)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?died") v5("?holder") v3("?item"):::projected v7("?number_of_deceased_holders"):::projected v7("?odnb") v8("?odnbcount") v9("?percent_odnb"):::projected v6("?positionStatement") c3(["wd:Q18115939"]):::iri c4(["wd:Q56760832"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?number_of_deceased_holders >= '10^^xsd:integer'"]] f0 --> v7 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c3 end union0r <== or ==> union0l end f1[["?died < '2015-01-01T00:00:00Z^^xsd:dateTime'"]] f1 --> v4 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c4 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c3 end union1r <== or ==> union1l end v5 --"p:P39"--> v6 v6 --"p:statement/P39"--> v3 v5 --"p:direct/P570"--> v4 bind3[/"count(?holder)"/] v5 --o bind3 bind3 --as--o v7 subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c4 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c3 end union2r <== or ==> union2l end v5 --"p:P39"--> v6 v6 --"p:statement/P39"--> v3 v5 --"p:direct/P1415"--> v7 bind5[/"count(?holder)"/] v5 --o bind5 bind5 --as--o v8 bind6[/"numeric-round('100^^xsd:integer' * ?odnbcount / ?number_of_deceased_holders)"/] v8 --o bind6 v7 --o bind6 bind6 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end