query-e163e4e2e2fad205b3444a40de31ca31

rq turtle/ttl

Generating a list of oldest living US Presidents there's an interesting discussion on people who have been both the oldest living ex-President and oldest living ex-Vice President of the United States. I'm pretty sure Wikidata has complete and accurate enough data to be able to generate a list like this for the President (and, mostly also for the Vice President, although it looks like we have a few odd duplicate items, mostly via Malayalam Wikipedia, needing merged), but I'm struggling to work out how to formulate the query to list them. Getting the list of all presidents, with the end of their time in office, and date of death, is fairly trivial: https://nwhyte.livejournal.com/3409349.htmlAt

Use at

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 ?person ?personLabel ?end ?dod {
  ?person wdt:P31 wd:Q5; p:P39 [ ps:P39 wd:Q11696 ; pq:P582 ?end ] ; wdt:P569 ?dob ; wdt:P570 ?dod .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?end

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?dob") v4("?dod"):::projected v1("?end"):::projected v2("?person"):::projected a1((" ")) c10(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q11696"]):::iri v2 --"p:direct/P31"--> c2 a1 --"p:statement/P39"--> c4 a1 --"p:qualifier/P582"--> v1 v2 --"p:P39"--> a1 v2 --"p:direct/P569"--> v3 v2 --"p:direct/P570"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end