query-a0a18d8a3719b0c43f6d4483e3a48294

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 ?age WHERE 
{ 
  ?item wdt:P27 wd:Q20 .
  ?item wdt:P569 ?dob .
  optional {?item wdt:P570 ?dod .}
  filter(year(?dod) > 1938|| !bound(?dod))
  filter(year(?dob) > 1839 )
  filter(year(?dob) < 1946 )
  bind(coalesce(year(?dod),2018) as ?dod2)      
  bind(?dod2-year(?dob) as ?age)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],no". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?age"):::projected v1("?dob"):::projected v2("?dod"):::projected v4("?dod2") v3("?item"):::projected c11(["#91;AUTO_LANGUAGE#93;,no"]):::literal c9(["bd:serviceParam"]):::iri c5(["wd:Q20"]):::iri f0[["year-from-dateTime(?dob) < '1946^^xsd:integer'"]] f0 --> v1 f1[["year-from-dateTime(?dob) > '1839^^xsd:integer'"]] f1 --> v1 f2[["(year-from-dateTime(?dod) > '1938^^xsd:integer' || not bound(?dod))"]] f2 --> v2 v3 --"wdt:P27"--> c5 v3 --"wdt:P569"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P570".-> v2 end bind3[/"year-from-dateTime(?dod)'2018^^xsd:integer'"/] v2 --o bind3 bind3 --as--o v4 bind4[/"?dod2 - year-from-dateTime(?dob)"/] v4 --o bind4 v1 --o bind4 bind4 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end