query-c990137e82d90fe68382a3822f4b8395
QZanden(P710)participant Andrew Gray
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 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 ?event ?eventLabel ?eventtime (SUM(?age) AS ?age_sum)
WHERE
{
?event wdt:P361 wd:Q41174436 .
?event p:P710 [ps:P710 ?item ; pq:P1352 ?rank] .
?event wdt:P585 ?eventtime .
?item wdt:P569 ?dob .
BIND(xsd:integer(FLOOR((?eventtime - ?dob)/365.25)) AS ?age)
FILTER ( ?rank in (1, 2, 3) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
GROUP BY ?event ?eventLabel ?eventtime
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?age"):::projected
v7("?age_sum")
v5("?dob")
v2("?event"):::projected
v4("?eventtime"):::projected
v3("?item")
v1("?rank")
a1((" "))
c12(["bd:serviceParam"]):::iri
c5(["wd:Q41174436"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
list0c1(["1^^xsd:integer"]):::literal
list0c2(["2^^xsd:integer"]):::literal
list0c3(["3^^xsd:integer"]):::literal
list0c1 --o f0
list0c2 --o f0
list0c3 --o f0
f0[[" in "]]
f0 --> v1
v2 --"p:direct/P361"--> c5
a1 --"p:statement/P710"--> v3
a1 --"p:qualifier/P1352"--> v1
v2 --"p:P710"--> a1
v2 --"p:direct/P585"--> v4
v3 --"p:direct/P569"--> v5
bind1[/"http://www.w3.org/2001/XMLSchema#integer(numeric-floor(?eventtime - ?dob / '365.25^^xsd:decimal'))"/]
v4 --o bind1
v5 --o bind1
bind1 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind3[/"sum(?age)"/]
v6 --o bind3
bind3 --as--o v7