query-e57bff9c942e73fb1e7955b86c0bfb53
Decades for counts
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
#title:Authors in IRIS SNS by decade of birth
#defaultView:BubbleChart
SELECT ?decennio (COUNT(?item) AS ?count)
WHERE {
?item wdt:P9761 [] ; p:P569/psv:P569 [ wikibase:timePrecision ?prec ; wikibase:timeValue ?birth ] .
FILTER(?prec IN ("9"^^xsd:integer, "10"^^xsd:integer, "11"^^xsd:integer))
BIND(YEAR(?birth) AS ?year).
FILTER(BOUND(?year)).
BIND(FLOOR(?year/10)*10 AS ?decade).
BIND(REPLACE(STR(?decade), "0","0s") AS ?decennio)
} GROUP BY ?decennio
ORDER BY ?decennio
Query found at
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/Queries
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/sandbox
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?birth")
v7("?count")
v6("?decade")
v7("?decennio"):::projected
v4("?item"):::projected
v3("?prec")
v6("?year")
a1((" "))
a3((" "))
a2((" "))
f0[["bound(?year)"]]
f0 --> v6
list0c3(["11^^xsd:integer"]):::literal
list0c1(["9^^xsd:integer"]):::literal
list0c2(["10^^xsd:integer"]):::literal
list0c1 --o f1
list0c2 --o f1
list0c3 --o f1
f1[[" in "]]
f1 --> v3
v4 --"p:direct/P9761"--> a1
a2 --"wikibase:timePrecision"--> v3
a2 --"wikibase:timeValue"--> v5
v4 --"p:P569"--> a3
a3 --"p:statement/value/P569"--> a2
bind2[/"year-from-dateTime(?birth)"/]
v5 --o bind2
bind2 --as--o v6
bind3[/"numeric-floor(?year / '10^^xsd:integer') * '10^^xsd:integer'"/]
v6 --o bind3
bind3 --as--o v6
bind4[/"replace(str(?decade),'0','0s')"/]
v6 --o bind4
bind4 --as--o v7
bind6[/"count(?item)"/]
v4 --o bind6
bind6 --as--o v7