query-c7af8afac608f8beeb9b8c6e69463583
Get all the americans politicians born after 1950 which have as father a politician
From https://youtu.be/kJph4q0Im98?t=4961
SELECT ?child ?childLabel ?fatherLabel ?dob WHERE { ?child wdt:P31 wd:Q5 . # item must be instance of human ?child wdt:P27 wd:Q30 . # also citizenship USA ?child wdt:P106 wd:Q82955 . # has occupation politician ?child wdt:P22 ?father . # and has father ?father wdt:P106 wd:Q82955 . # which is a politician
?child wdt:P569 ?dob . FILTER (YEAR(?dob) > 1950)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO LANGUAGE],en" . } }
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#>
# Get all the americans politicians born after 1950 which have as father a politician
# From https://youtu.be/kJph4q0Im98?t=4961
SELECT ?child ?childLabel ?fatherLabel ?dob
WHERE {
?child wdt:P31 wd:Q5 . # item must be instance of human
?child wdt:P27 wd:Q30 . # also citizenship USA
?child wdt:P106 wd:Q82955 . # has occupation politician
?child wdt:P22 ?father . # and has father
?father wdt:P106 wd:Q82955 . # which is a politician
?child wdt:P569 ?dob .
FILTER (YEAR(?dob) > 1950)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO LANGUAGE],en" . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?child"):::projected
v1("?dob"):::projected
v3("?father")
c5(["wd:Q30"]):::iri
c7(["wd:Q82955"]):::iri
c11(["bd:serviceParam"]):::iri
c3(["wd:Q5"]):::iri
c13(["#91;AUTO LANGUAGE#93;,en"]):::literal
f0[["year-from-dateTime(?dob) > '1950^^xsd:integer'"]]
f0 --> v1
v2 --"wdt:P31"--> c3
v2 --"wdt:P27"--> c5
v2 --"wdt:P106"--> c7
v2 --"wdt:P22"--> v3
v3 --"wdt:P106"--> c7
v2 --"wdt:P569"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end