query-5f3b27aa93cc3966e43b742c5f42b832
Query to find male Americans born after 1875 and before 1930
with day-specific date of death, but only year-specific date of birth
SELECT ?a ?aLabel ?birth_date ?death_date WHERE { ?a wdt:P27 wd:Q30 . ?a wdt:P21 wd:Q6581097 . ?a p:P569/psv:P569 ?birth_date_node . ?birth_date_node wikibase:timePrecision "9"^^xsd:integer . ?a p:P570/psv:P570 ?death_date_node . ?death_date_node wikibase:timePrecision "11"^^xsd:integer . ?birth_date_node wikibase:timeValue ?birth_date . ?death_date_node wikibase:timeValue ?death_date . FILTER (year(?birth_date) > 1875) . FILTER (year(?birth_date) < 1930)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?birth_date ?aLabel
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Query to find male Americans born after 1875 and before 1930
# with day-specific date of death, but only year-specific date of birth
SELECT ?a ?aLabel ?birth_date ?death_date WHERE {
?a wdt:P27 wd:Q30 .
?a wdt:P21 wd:Q6581097 .
?a p:P569/psv:P569 ?birth_date_node .
?birth_date_node wikibase:timePrecision "9"^^xsd:integer .
?a p:P570/psv:P570 ?death_date_node .
?death_date_node wikibase:timePrecision "11"^^xsd:integer .
?birth_date_node wikibase:timeValue ?birth_date .
?death_date_node wikibase:timeValue ?death_date .
FILTER (year(?birth_date) > 1875) .
FILTER (year(?birth_date) < 1930)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY ?birth_date ?aLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?a"):::projected
v2("?aLabel"):::projected
v1("?birth_date"):::projected
v4("?birth_date_node")
v6("?death_date"):::projected
v5("?death_date_node")
a1((" "))
a2((" "))
c13(["11^^xsd:integer"]):::literal
c6(["wd:Q6581097"]):::iri
c4(["wd:Q30"]):::iri
c18(["en"]):::literal
c16(["bd:serviceParam"]):::iri
c10(["9^^xsd:integer"]):::literal
f0[["year-from-dateTime(?birth_date) < '1930^^xsd:integer'"]]
f0 --> v1
f1[["year-from-dateTime(?birth_date) > '1875^^xsd:integer'"]]
f1 --> v1
v3 --"p:direct/P27"--> c4
v3 --"p:direct/P21"--> c6
v3 --"p:P569"--> a1
a1 --"p:statement/value/P569"--> v4
v4 --"wikibase:timePrecision"--> c10
v3 --"p:P570"--> a2
a2 --"p:statement/value/P570"--> v5
v5 --"wikibase:timePrecision"--> c13
v4 --"wikibase:timeValue"--> v1
v5 --"wikibase:timeValue"--> v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
end