query-16b46b4e967d477ff0ebe89fa66ce443
Propertiescause of death (P509)instance of (P31)date of death (P570)date of birth (P569)
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 bd: <http://www.bigdata.com/rdf#>
#defaultView:LineChart
SELECT ?age (COUNT(?person) AS ?count) WHERE {
{
SELECT ?person (SAMPLE(?age) AS ?age) WHERE {
?person wdt:P509 wd:Q84263196 ; wdt:P31 wd:Q5
OPTIONAL { ?person wdt:P570 ?d }
?person wdt:P569 ?dob ; wdt:P570 ?dod . BIND(YEAR(?dod)-YEAR(?dob) as ?age)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
GROUP BY ?person
}
}
GROUP BY ?age
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?age"):::projected
v6("?count")
v2("?d")
v3("?dob")
v4("?dod")
v1("?person"):::projected
c2(["wd:Q84263196"]):::iri
c8(["bd:serviceParam"]):::iri
c4(["wd:Q5"]):::iri
c10(["en"]):::literal
v1 --"wdt:P509"--> c2
v1 --"wdt:P31"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P570".-> v2
end
v1 --"wdt:P569"--> v3
v1 --"wdt:P570"--> v4
bind0[/"year-from-dateTime(?dod) - year-from-dateTime(?dob)"/]
v4 --o bind0
v3 --o bind0
bind0 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind2[/"sample(?age)"/]
v6 --o bind2
bind2 --as--o v6
bind4[/"count(?person)"/]
v1 --o bind4
bind4 --as--o v6