User:Mcarondiotte/Descendants of Monarchs

From Wikidata
Jump to navigation Jump to search

These SPARQL snippets allow to retrieve the descendants of a person (here, monarchs). They are adapted from the "Descendants of Bach" SPARQL query example.

Caution: Most of these snippets will not return any data as the time limit will be exceeded (add LIMIT 100 to return 100 results).

Charlemagne[edit]

# descendants of Charlemagne
SELECT ?human ?humanLabel ?sexLabel ?fatherLabel ?motherLabel ?famLabel ?dob ?pobLabel ?dod ?podLabel ?geni
WHERE
{
wd:Q3044 wdt:P40/wdt:P40* ?human .
    ?human wdt:P31 wd:Q5 .
    OPTIONAL{?human wdt:P21 ?sex .}
    OPTIONAL{?human wdt:P22 ?father .}
    OPTIONAL{?human wdt:P25 ?mother .}
    OPTIONAL{?human wdt:P53 ?fam .}
    OPTIONAL{?human wdt:P569 ?dob .}
    OPTIONAL{?human wdt:P19 ?pob .}
    OPTIONAL{?human wdt:P570 ?dod .}
    OPTIONAL{?human wdt:P20 ?pod .}
    OPTIONAL{?human wdt:P2600 ?geni .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!

Charles Martel[edit]

# descendants of Charles Martel
SELECT ?human ?humanLabel ?sexLabel ?fatherLabel ?motherLabel ?famLabel ?dob ?pobLabel ?dod ?podLabel ?geni
WHERE
{
wd:Q3301 wdt:P40/wdt:P40* ?human .
    ?human wdt:P31 wd:Q5 .
    OPTIONAL{?human wdt:P21 ?sex .}
    OPTIONAL{?human wdt:P22 ?father .}
    OPTIONAL{?human wdt:P25 ?mother .}
    OPTIONAL{?human wdt:P53 ?fam .}
    OPTIONAL{?human wdt:P569 ?dob .}
    OPTIONAL{?human wdt:P19 ?pob .}
    OPTIONAL{?human wdt:P570 ?dod .}
    OPTIONAL{?human wdt:P20 ?pod .}
    OPTIONAL{?human wdt:P2600 ?geni .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!

William the Conqueror[edit]

# descendants of William the Conqueror
SELECT ?human ?humanLabel ?sexLabel ?fatherLabel ?motherLabel ?famLabel ?dob ?pobLabel ?dod ?podLabel ?geni
WHERE
{
wd:Q37594 wdt:P40/wdt:P40* ?human .
    ?human wdt:P31 wd:Q5 .
    OPTIONAL{?human wdt:P21 ?sex .}
    OPTIONAL{?human wdt:P22 ?father .}
    OPTIONAL{?human wdt:P25 ?mother .}
    OPTIONAL{?human wdt:P53 ?fam .}
    OPTIONAL{?human wdt:P569 ?dob .}
    OPTIONAL{?human wdt:P19 ?pob .}
    OPTIONAL{?human wdt:P570 ?dod .}
    OPTIONAL{?human wdt:P20 ?pod .}
    OPTIONAL{?human wdt:P2600 ?geni .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!

Napoléon Bonaparte[edit]

# descendants of Napoléon Bonaparte
SELECT ?human ?humanLabel ?sexLabel ?fatherLabel ?motherLabel ?famLabel ?dob ?pobLabel ?dod ?podLabel ?geni
WHERE
{
wd:Q517 wdt:P40/wdt:P40* ?human .
    ?human wdt:P31 wd:Q5 .
    OPTIONAL{?human wdt:P21 ?sex .}
    OPTIONAL{?human wdt:P22 ?father .}
    OPTIONAL{?human wdt:P25 ?mother .}
    OPTIONAL{?human wdt:P53 ?fam .}
    OPTIONAL{?human wdt:P569 ?dob .}
    OPTIONAL{?human wdt:P19 ?pob .}
    OPTIONAL{?human wdt:P570 ?dod .}
    OPTIONAL{?human wdt:P20 ?pod .}
    OPTIONAL{?human wdt:P2600 ?geni .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!

Queen Elizabeth II[edit]

# descendants of Queen Elizabeth II
SELECT ?human ?humanLabel ?sexLabel ?fatherLabel ?motherLabel ?famLabel ?dob ?pobLabel ?dod ?podLabel ?geni
WHERE
{
wd:Q9682 wdt:P40/wdt:P40* ?human .
    ?human wdt:P31 wd:Q5 .
    OPTIONAL{?human wdt:P21 ?sex .}
    OPTIONAL{?human wdt:P22 ?father .}
    OPTIONAL{?human wdt:P25 ?mother .}
    OPTIONAL{?human wdt:P53 ?fam .}
    OPTIONAL{?human wdt:P569 ?dob .}
    OPTIONAL{?human wdt:P19 ?pob .}
    OPTIONAL{?human wdt:P570 ?dod .}
    OPTIONAL{?human wdt:P20 ?pod .}
    OPTIONAL{?human wdt:P2600 ?geni .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!