query-64c08b2caf877850fc64f3157a835711
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?yob (COUNT(?item) as ?count) (AVG(?dod - ?dob)/365.25 AS ?avgAge)
WHERE
{
?item wdt:P31 wd:Q5 .
?item wdt:P106 wd:Q49757 .
?item p:P569/psv:P569 [wikibase:timePrecision "11"^^xsd:integer ; wikibase:timeValue ?dob ] .
?item p:P570/psv:P570 [wikibase:timePrecision "11"^^xsd:integer ; wikibase:timeValue ?dod ] .
BIND (YEAR(?dob) AS ?yob)
}
GROUP BY ?yob
HAVING (?count >= 50)
ORDER BY ?yob
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?avgAge")
v6("?count")
v4("?dob")
v5("?dod")
v3("?item"):::projected
v6("?yob"):::projected
a2((" "))
a1((" "))
a4((" "))
a3((" "))
c7(["11^^xsd:integer"]):::literal
c3(["wd:Q5"]):::iri
c5(["wd:Q49757"]):::iri
f0[["?count >= '50^^xsd:integer'"]]
f0 --> v6
v3 --"p:direct/P31"--> c3
v3 --"p:direct/P106"--> c5
a1 --"wikibase:timePrecision"--> c7
a1 --"wikibase:timeValue"--> v4
v3 --"p:P569"--> a2
a2 --"p:statement/value/P569"--> a1
a3 --"wikibase:timePrecision"--> c7
a3 --"wikibase:timeValue"--> v5
v3 --"p:P570"--> a4
a4 --"p:statement/value/P570"--> a3
bind1[/"year-from-dateTime(?dob)"/]
v4 --o bind1
bind1 --as--o v6
bind4[/"count(?item)"/]
v3 --o bind4
bind4 --as--o v6
bind5[/" / '365.25^^xsd:decimal'"/]
null --o bind5
bind5 --as--o v6