query-f57fea83fd8a69f88b2ac386c61cd3be

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?dob ?dod ?days ?span 
WHERE 
{ ?item wdt:P106 wd:Q520549.       # occupation=geologist
  ?item wdt:P569 ?dob .            # must have DoB
  ?item wdt:P570 ?dod .            # must have DoD
  bind ((?dod - ?dob) as ?days)    # date maths to get lifespan in days
  bind (floor(?days/365) as ?span) # convert to years
  FILTER (?span <= 73)              # filter for 73-year olds or younger
  FILTER (?span > 63)              # filter for 64-year olds or older
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # get labels
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?days"):::projected v3("?dob"):::projected v4("?dod"):::projected v2("?item"):::projected v6("?span"):::projected c8(["bd:serviceParam"]):::iri c4(["wd:Q520549"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?span > '63^^xsd:integer'"]] f0 --> v6 f1[["?span <= '73^^xsd:integer'"]] f1 --> v6 v2 --"wdt:P106"--> c4 v2 --"wdt:P569"--> v3 v2 --"wdt:P570"--> v4 bind2[/"?dod - ?dob"/] v4 --o bind2 v3 --o bind2 bind2 --as--o v5 bind3[/"numeric-floor(?days / '365^^xsd:integer')"/] v5 --o bind3 bind3 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end