Descendants timeline tutorial Part 2: Combining Wikidata query statements

New tutorial now available:
Create instant location based timelines using Wikidata queries

Our previous tutorial showed you how to use a Wikidata query to create a “descendants of” timeline. This time we are going to look at how we can combine some of the examples from the previous post to make more refined timelines and explore some other properties you can use to refine the query.


If you haven’t read the previous post you probably want to take a look at it before continuing.
Tutorial: How to make a “descendants of” timeline using Wikidata.


I have filled in the templates below  with the Wikidata item number for Queen Victoria Q9439. To simply use one of these queries for a different person replace the numbers in blue with the Wikidata item number for the person of interest.


You must remove the letter from the beginning of the Wikidata item (Q) or Wikidata property (P) before using it in a query.

9439 – ✓ correct             Q9439  – X incorrect 


Here are the link templates we gave you last time

  1. Descendants of:[9439][40]

  1. Female Descendants of:[9439][40] AND claim[21: 6581072]

  1. Male Descendants of:[9439][40] AND claim[21: 6581097]

  1. Living Descendants:[9439][40] AND noclaim[570]

  1. Relatives of:[9439][25,22,40,26,7,9,1038]


And here are some new templates we are going to look at today

  1. Deceased Descendants of:[9439][40] AND claim[570]

  1. Descendants Born in the UK:[9439][40] AND claim[19:(tree[145][150][17,131])]

  1. Descendants Born in Germany:[9439][40] AND claim[19:(tree[183][150][17,131])]

  1. Descendants Born in Italy:[9439][40] AND claim[19:(tree[38][150][17,131])]

  1. Descendants Born in Spain:[9439][40] AND claim[19:(tree[29][150][17,131])]

  1. Descendants Born in Greece:[9439][40] AND claim[19:(tree[41][150][17,131])]

  1. Descendants Born in Denmark:[9439][40] AND claim[19:(tree[35][150][17,131])]

  1. Descendants who died during WWII:[9439][40] AND between[570,1939-09-01,1945-09-02]


The main thing you will learn from this post is how to combine these different queries for example

  1. Living male descendants born in United Kingdom[9439][40] AND claim[21: 6581097] AND noclaim[570] AND claim[19:(tree[145][150][17,131])]

  1. Deceased female descendants born in Greece[9439][40] AND claim[21: 6581072] AND claim[570] AND claim[19:(tree[41][150][17,131])]

  1. Male descendants who died during WWII[9439][40] AND claim[21:6581097] AND between[570, 1939-09-01,1945-09-02]


We will continue to use Queen Victoria as the person of interest for the purpose of the tutorial.

First we are going to look more closely at the structure of the link, and then see how we can combine these templates to create new queries.


If you want to go to straight to the source and learn more about the Wikidata query language the best place to start is the API documentation page 



We will start with the most basic query to show all the descendants of Queen Victoria[9439][40]

The first part of the link can be ignored, that’s just the Histropedia URL. The next part ?q= is the instruction that tells Histropedia you want to run a query. The rest of the template tree[9439][40] is the Wikidata query that creates the timeline. You can run this query on Autolist to see the results of the query as a list of Wikidata items.




The query can be split into 3 parts, the first part treedefines the type of search. The second part [9439] is the Wikidata item number for the person of interest (Queen Victoria). The final part [40] is the property child.

The property child refers to son, daughter, kid, is parent of, has child, children, father of, mother of, parent of.

The query starts at the person of interest and searches down the tree of the child property, finding all the children, and children of children all the way up to the modern day.


You must remove the letter from the beginning of the Wikidata item (Q) or Wikidata property (P) before using it in a query.

9439 – ✓ correct             Q9439  – X incorrect 


AND Claim

We can further refine the results by adding additional claims. In the template below we have added a claim to only show female descendants.

Female descendants[9439][40] AND claim[21: 6581072]

To add properties we use the command AND claim followed by the property for sex or gender P21 equal to the Wikidata item for female Q6581072.

The letters in front of the Item and property numbers should be removed before they are used in a query.


AND noclaim

We can do the same thing to only show descendants who are still alive. We do this by only showing results that do not have a date of death. We do this using the command noclaim

Living descendants[9439][40]AND noclaim[570]

The template for living descendants uses the AND noclaim command to only show results that do not have the property for date of death P570.



Living female relatives[9439][40] AND claim[21: 6581072] AND noclaim[570]

By using both examples above we can create a query that shows only female descendants AND claim[21: 6581072] who are still alive AND noclaim[570]

You can swap female to male by changing the first part to AND claim[21: 6581097].

To show only deceased descendants we would change the second part to   AND claim[570] to only show results that do have a date of death.



To refine the query by place of birth we need to add a location based claim to the query. If we want this to include an entire country we also have use the tree command to include all cities and regions in that country. We can use this type of claim to show us only descendants who were born in the UK

Descendants born in the UK[9439][40] AND claim[19:(tree[145][150][17,131])]


Here we have added the AND claim command with the property for place of birth P19 and the item for the united kingdom Q145. Because most people have their place of birth set as a town or city we need to add the tree command to make sure our query includes anyone who was born in a location that is within the UK.

To create a claim for a different location, you need to find the Wikidata item number for the country you want to filter by and replace the blue text in the link below with the new location.[9439][40] AND claim[19:(tree[145][150][17,131])]

Now we can combine the location based claim with the other claims we were looking at to give us another one of our examples

Living male descendants born in United Kingdom[9439][40]  AND claim[21: 6581097] AND noclaim[570] AND claim[19:(tree[145][150][17,131])]




Our final example uses a date range to further refine the query

Male descendants who died during WWII[9439][40] AND claim[21:6581097] AND between[570,1939-09-01,1945-09-02]

In this case we only want to see male descendants who died during the Second World war. To do this we need to use the AND between command to show us only people with the date of death property P570 that is between the dates 1939-09-01 and 1945-09-02.




You can add as many claims as you like to your query and use any of the properties available on Wikidata to define the claim. However, Wikidata is still a work in progress and although its growing at an amazing rate certain claims, or combinations of claims won’t give great results yet. The more you try and refine the query the less likely you are to get a meaningful number of results.

For example I wanted to add a claim to only show descendants of Queen Victoria who became a king or Queen (currently her descendants sit on the thrones of 5 different European countries). Unfortunately the not all of the Kings and Queens have the correct properties to make the query work. The good news is anyone can help improve Wikidata and new items and properties are being added all the time. I am going to look at trying to do some bulk editing to try and fix this particular issue. If successful I should be able to add the correct property to all of the kings and queens of Europe.



Even with the current limitations I believe this is an excellent example of how the interlinking of freely available data can produce incredible results and rather than be put off by any limitations that currently exist I am inspired to help improve the data so we can really see just how powerful these tools can be. I hope you all feel the same way


Just a reminder, if you want to go to straight to the source and learn more about the Wikidata query language the best place to start is the API documentation page 


Please let me know in the comments if you would like help creating a descendants of timeline, will help is I can.


NEXT UP: The next tutorial will be on how to use Wikidata queries to create location based timelines.


Related stuff and other links:

Tutorial: How to make a “descendants of” timeline using Wikidata. Part 1.

Automatic timelines from Wikidata queries Knowledge base article

Autolist Tool created by Magnus Manske ro run Wikidata queries and return a list of items.

Autolist API documentation

The Amazing power of Wikidata Blog post from April about how we are using Wikidata

Why Wikidata is so important to Histropedia Guest post on the blog with an update on how we are using Wikidata

Sean McBirnie

Co-Founder at Histropedia

Latest posts by Sean McBirnie (see all)


  • Excellent blogpost and good looking tool

    • Many Thanks Magnus,

      Really glad you enjoyed the post! Have you had any luck making other descendants timelines? Let me know if you need any help or would like us to create some particular descendants timelines for you.

      thanks again for you comment


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.