query-b7eef6922f41b6ffb76f9eddb575de07
each
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#>
SELECT ?age60 ?age70 ?age80 ?age90 ?items
(CONCAT(str(round(10000 * ?o/?items) / 100), "%") as ?O)
(CONCAT(str(round(10000 * ?a/?items) / 100), "%") as ?A)
(CONCAT(str(round(10000 * ?b/?items) / 100), "%") as ?B)
(CONCAT(str(round(10000 * ?ab/?items) / 100), "%") as ?AB) {
{
SELECT ?age60 ?age70 ?age80 ?age90 (count(?o_items) as ?o) (count(?a_items) as ?a) (count(?b_items) as ?b) (count(?ab_items) as ?ab) (count(?all_items) as ?items) {
{?o_items wdt:P1853 wd:Q19831451 ; wdt:P569 ?naissance ; wdt:P570 ?mort ; wdt:P31 wd:Q5 } UNION
{?a_items wdt:P1853 wd:Q19831453 ; wdt:P569 ?naissance ; wdt:P570 ?mort ; wdt:P31 wd:Q5 } UNION
{?b_items wdt:P1853 wd:Q19831454 ;wdt:P569 ?naissance ; wdt:P570 ?mort ; wdt:P31 wd:Q5 } UNION
{?ab_items wdt:P1853 wd:Q19831455 ; wdt:P569 ?naissance ; wdt:P570 ?mort ; wdt:P31 wd:Q5 } UNION
{?all_items wdt:P1853 ?group ; wdt:P569 ?naissance ; wdt:P570 ?mort ; wdt:P31 wd:Q5}
BIND(round((?mort - ?naissance)/365.2425) as ?age )
BIND ((60 < ?age && ?age < 70) as ?age60)
BIND ((70 < ?age && ?age < 80) as ?age70)
BIND ((80 < ?age && ?age < 90) as ?age80)
BIND ((90 < ?age && ?age < 100) as ?age90)
}
GROUP BY ?age60 ?age70 ?age80 ?age90
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v20("?A")
v22("?AB")
v21("?B")
v19("?O")
v15("?a"):::projected
v4("?a_items")
v17("?ab"):::projected
v6("?ab_items")
v9("?age")
v10("?age60"):::projected
v11("?age70"):::projected
v12("?age80"):::projected
v13("?age90"):::projected
v7("?all_items")
v16("?b"):::projected
v5("?b_items")
v8("?group")
v18("?items"):::projected
v3("?mort")
v2("?naissance")
v14("?o"):::projected
v1("?o_items")
c7(["wd:Q19831453"]):::iri
c2(["wd:Q19831451"]):::iri
c13(["en"]):::literal
c11(["bd:serviceParam"]):::iri
c6(["wd:Q5"]):::iri
c9(["wd:Q19831455"]):::iri
c8(["wd:Q19831454"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v7 --"wdt:P1853"--> v8
v7 --"wdt:P569"--> v2
v7 --"wdt:P570"--> v3
v7 --"wdt:P31"--> c6
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P1853"--> c9
v6 --"wdt:P569"--> v2
v6 --"wdt:P570"--> v3
v6 --"wdt:P31"--> c6
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P1853"--> c8
v5 --"wdt:P569"--> v2
v5 --"wdt:P570"--> v3
v5 --"wdt:P31"--> c6
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P1853"--> c7
v4 --"wdt:P569"--> v2
v4 --"wdt:P570"--> v3
v4 --"wdt:P31"--> c6
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P1853"--> c2
v1 --"wdt:P569"--> v2
v1 --"wdt:P570"--> v3
v1 --"wdt:P31"--> c6
end
union0r <== or ==> union0l
end
bind0[/"numeric-round(?mort - ?naissance / '365.2425^^xsd:decimal')"/]
v3 --o bind0
v2 --o bind0
bind0 --as--o v9
bind1[/"'60^^xsd:integer' < ?age?age < '70^^xsd:integer'"/]
v9 --o bind1
bind1 --as--o v10
bind2[/"'70^^xsd:integer' < ?age?age < '80^^xsd:integer'"/]
v9 --o bind2
bind2 --as--o v11
bind3[/"'80^^xsd:integer' < ?age?age < '90^^xsd:integer'"/]
v9 --o bind3
bind3 --as--o v12
bind4[/"'90^^xsd:integer' < ?age?age < '100^^xsd:integer'"/]
v9 --o bind4
bind4 --as--o v13
bind10[/"count(?o_items)"/]
v1 --o bind10
bind10 --as--o v14
bind11[/"count(?a_items)"/]
v4 --o bind11
bind11 --as--o v15
bind12[/"count(?b_items)"/]
v5 --o bind12
bind12 --as--o v16
bind13[/"count(?ab_items)"/]
v6 --o bind13
bind13 --as--o v17
bind14[/"count(?all_items)"/]
v7 --o bind14
bind14 --as--o v18
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end
bind15[/"concat(str(numeric-round('10000^^xsd:integer' * ?o / ?items) / '100^^xsd:integer'),'%')"/]
v14 --o bind15
v18 --o bind15
bind15 --as--o v19
bind16[/"concat(str(numeric-round('10000^^xsd:integer' * ?a / ?items) / '100^^xsd:integer'),'%')"/]
v15 --o bind16
v18 --o bind16
bind16 --as--o v20
bind17[/"concat(str(numeric-round('10000^^xsd:integer' * ?b / ?items) / '100^^xsd:integer'),'%')"/]
v16 --o bind17
v18 --o bind17
bind17 --as--o v21
bind18[/"concat(str(numeric-round('10000^^xsd:integer' * ?ab / ?items) / '100^^xsd:integer'),'%')"/]
v17 --o bind18
v18 --o bind18
bind18 --as--o v22