query-cd68346734d3c59ea5add5f74921e5e4
Ambassadors who died in the same year they left office
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 ?person ?personLabel ?positionLabel ?startyear ?endyear ?birthyear ?deathyear
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
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
filter (?deathyear = ?endyear )
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?birthyear"):::projected
v9("?born")
v12("?deathyear"):::projected
v11("?died")
v8("?end")
v9("?endyear"):::projected
v4("?person"):::projected
v3("?position")
v5("?positionStatement")
v6("?start")
v7("?startyear"):::projected
c2(["wd:Q18115939"]):::iri
c3(["wd:Q56760832"]):::iri
c11(["bd:serviceParam"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?deathyear = ?endyear"]]
f0 --> v12
f0 --> v9
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"p:direct/P31"--> c3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"p:direct/P31"--> c2
end
union0r <== or ==> union0l
end
v4 --"p:P39"--> v5
v5 --"p:statement/P39"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P580".-> v6
bind1[/"year-from-dateTime(?start)"/]
v6 --o bind1
bind1 --as--o v7
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P582".-> v8
bind2[/"year-from-dateTime(?end)"/]
v8 --o bind2
bind2 --as--o v9
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P569".-> v9
bind3[/"year-from-dateTime(?born)"/]
v9 --o bind3
bind3 --as--o v10
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P570".-> v11
bind4[/"year-from-dateTime(?died)"/]
v11 --o bind4
bind4 --as--o v12
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end