query-f6113c7712aa07d231712785f50fc82d
working is great, but how i can add 9, 10, 11? If i’m use filter (see below) then query not working — timeout limit reached.
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?a ?aLabel ?birth_date ?death_date WHERE {
?a wdt:P21 wd:Q6581097 .
?a p:P569/psv:P569 ?birth_date_node .
?a p:P570/psv:P570 ?death_date_node .
?birth_date_node wikibase:timePrecision ?precision1 .
?death_date_node wikibase:timePrecision ?precision2 .
?birth_date_node wikibase:timeValue ?birth_date .
?death_date_node wikibase:timeValue ?death_date .
FILTER ( (year(?death_date) - year(?birth_date)) <= 20
&& (year(?death_date) - year(?birth_date)) >= 30 ) .
FILTER((?precision1 >= 7) && (?precision1 <= 11) && (?precision2 >= 7) && (?precision2 <= 11)).
SERVICE wikibase:label { bd:serviceParam wikibase:language "ru" }
}
ORDER BY ?birth_date ?aLabel
LIMIT 5000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?a"):::projected
v2("?aLabel"):::projected
v1("?birth_date"):::projected
v7("?birth_date_node")
v5("?death_date"):::projected
v8("?death_date_node")
v3("?precision1")
v4("?precision2")
a1((" "))
a2((" "))
c16(["ru"]):::literal
c6(["wd:Q6581097"]):::iri
c14(["bd:serviceParam"]):::iri
f0[["?precision1 >= '7^^xsd:integer'?precision1 <= '11^^xsd:integer'?precision2 >= '7^^xsd:integer'?precision2 <= '11^^xsd:integer'"]]
f0 --> v3
f0 --> v4
f1[["year-from-dateTime(?death_date) - year-from-dateTime(?birth_date) <= '20^^xsd:integer'year-from-dateTime(?death_date) - year-from-dateTime(?birth_date) >= '30^^xsd:integer'"]]
f1 --> v5
f1 --> v1
v6 --"p:direct/P21"--> c6
v6 --"p:P569"--> a1
a1 --"p:statement/value/P569"--> v7
v6 --"p:P570"--> a2
a2 --"p:statement/value/P570"--> v8
v7 --"wikibase:timePrecision"--> v3
v8 --"wikibase:timePrecision"--> v4
v7 --"wikibase:timeValue"--> v1
v8 --"wikibase:timeValue"--> v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end