Posts
Refine a descendants timeline: generations, dates and missing data
Rewritten on 28 October 2026 for the current Histropedia Query Timeline tool. The original publication date is retained above.
Once a family timeline works, the useful next step is usually a smaller question. “Victoria’s children and grandchildren born before 1870” is easier to interpret and query than every recorded descendant. This follows the first descendants walkthrough and uses the same Query Timeline mappings.
Open this example in Query Timeline · Download the SPARQL query
# Victoria's children and grandchildren with recorded births before 1870.
SELECT DISTINCT ?item ?itemLabel ?itemDescription
?start ?startPrecision ?end ?endPrecision ?deathData
WHERE {
wd:Q9439 (wdt:P40|wdt:P40/wdt:P40) ?item .
?item p:P569 ?birthStatement .
?birthStatement a wikibase:BestRank ; psv:P569 ?birthValue .
?birthValue wikibase:timeValue ?start ;
wikibase:timePrecision ?startPrecision .
FILTER(?start < "1870-01-01T00:00:00Z"^^xsd:dateTime)
OPTIONAL {
?item p:P570 ?deathStatement .
?deathStatement a wikibase:BestRank ; psv:P570 ?deathValue .
?deathValue wikibase:timeValue ?end ;
wikibase:timePrecision ?endPrecision .
}
BIND(IF(BOUND(?end), "Death date recorded", "No death date returned") AS ?deathData)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?start ?item
LIMIT 500
Open Configure Timeline to see the query. Title is itemLabel; start and end are start and end, with startPrecision and endPrecision. Leave duplicate merging disabled so competing lifespan dates remain visible, and use deathData as a colour or filter category.
Bound the family relationship first
The path (wdt:P40|wdt:P40/wdt:P40) means either one child link or two. The | joins alternatives; / follows a sequence. This bounds the search to children and grandchildren. It does not infer a relationship from names, nationality or dates, and it cannot find a connection absent from Wikidata.
To ask for children only, use wdt:P40. For grandchildren only, use wdt:P40/wdt:P40. A person can be reached through multiple branches; SELECT DISTINCT removes identical result rows, while Query Timeline’s optional merging combines a matching group key and displayed start date. It does not compare end dates or precision, so it stays off in this example.
Filter the date you mean
The query’s cutoff is on ?start, the birth date:
FILTER(?start < "1870-01-01T00:00:00Z"^^xsd:dateTime)
For births during the 1860s, use an inclusive lower bound and exclusive upper bound:
FILTER(?start >= "1860-01-01T00:00:00Z"^^xsd:dateTime &&
?start < "1870-01-01T00:00:00Z"^^xsd:dateTime)
These compare stored timestamps, not uncertainty intervals. A decade-precision date can overlap a boundary even if its stored timestamp falls on one side. Keep the precision columns and inspect borderline records. Do not convert coarse dates into exact birthdays just to make filtering convenient.
Add facts without multiplying the timeline accidentally
For people with a recorded citizenship, add a condition inside WHERE, for example:
FILTER EXISTS { ?item wdt:P27 wd:Q145 . }
This selects a recorded citizenship of the United Kingdom; it does not establish where someone lived or their citizenship at birth. FILTER EXISTS tests membership without adding a row for every matching statement. If you instead select all citizenships for a colour legend, one person may have several rows. Keep item as the merge key and inspect the categories rather than silently choosing one citizenship.
To find data needing attention, filter on a missing returned death date:
FILTER(!BOUND(?end))
Place it after the optional death block. Label this group “No death date returned”, never “Living descendants”. OPTIONAL followed by a filter requiring its variable to exist effectively makes that value mandatory; check whether excluding missing values is actually your aim.
Query filters and viewing filters serve different purposes
A SPARQL condition changes which rows are downloaded. A legend or filter control helps explore the rows already loaded. A narrower query is useful for performance and a stable research question; an interactive category is useful for comparing groups without rewriting the query. A query limit caps rows before the timeline’s grouping, so it is not a guarantee of a particular number of people.
After each change, generate the timeline again and inspect several source records, including one you expected to be excluded. Save the query, mappings and retrieval date with exported data when the result will support research or publication.