query-98674340503d5e8609f6419daba4ca28
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ((xsd:integer(1000* SUM(?sub85)/COUNT(?item))/10.0) AS ?pct) WHERE {
SERVICE bd:sample {
?item wdt:P31 wd:Q5 .
bd:serviceParam bd:sample.limit 100000 .
bd:serviceParam bd:sample.sampleType "RANDOM" .
}
MINUS {?item wdt:P570 []} .
?item wdt:P569 ?dob .
FILTER(year(?dob) > 1901) .
BIND(IF((year(?dob) > 1936), 1.0, 0.0) AS ?sub85) .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?dob")
v2("?item")
v4("?pct")
v3("?sub85")
a1((" "))
c5(["bd:serviceParam"]):::iri
c9(["RANDOM"]):::literal
c7(["100000^^xsd:integer"]):::literal
c4(["wd:Q5"]):::iri
f0[["year-from-dateTime(?dob) > '1901^^xsd:integer'"]]
f0 --> v1
subgraph s1["http://www.bigdata.com/rdf#sample"]
style s1 stroke-width:4px;
v2 --"wdt:P31"--> c4
c5 --"bd:sample.limit"--> c7
c5 --"bd:sample.sampleType"--> c9
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P570"--> a1
end
v2 --"wdt:P569"--> v1
bind2[/"if(year-from-dateTime(?dob) > '1936^^xsd:integer','1.0^^xsd:decimal','0.0^^xsd:decimal')"/]
v1 --o bind2
bind2 --as--o v3
bind5[/"http://www.w3.org/2001/XMLSchema#integer('1000^^xsd:integer' * / ) / '10.0^^xsd:decimal'"/]
null --o bind5
null --o bind5
bind5 --as--o v4