Dates

When queries: Dates

These queries retrieve date information making it possible to present this information in the form of a timeline.

We recommend going over the introduction to Wikidata and learning about the structure of Wikidata, as well as the section regarding the simplest query before proceeding.

Let’s start with a simple example: The following query shows when the albums of the singer Madonna (Q1744) were released:

After running the query, scroll to the results. Above the table, click on the arrow next to the eye. A drop-down menu will pop up. Choose “Timeline” from the menu, and WDQS will display the results on a timeline.

Another way to display the results in the timeline view is to specify it in the query itself. The code on line 2, after the hashtag sign, tells the query that the query results should be shown not as a table, but as a timeline.

You don’t need to remember the exact code for the map view: thanks to the autocompletion function of WDQS, once you type a hashtag in the query window, a drop-down menu will suggest the different display options.

Linked dates

Retrieving dates linked to values

In the previous query, dates were directly linked to the items we selected. But dates are not always directly linked to the items of interest to us. Once you have learned to retrieve data linked to values, it is quite easy to retrieve date information related to items. For example, the following query shows the date of birth of the directors of the Star Wars movies on a time scale:

Note the query uses the DISTINCT modifier to remove duplicates from the results.

Exercise: dates

| Exercise: Write a query that shows when women who are heads of government of sovereign states were born.

Hint: select sovereign states (Q3624078) that have a head of government (P6) who is a woman (i.e., sex (P21) has the value female (Q6581072)), and retrieve their dates of birth.

show solution

Dates and qualifiers

Dates and qualifiers

If you have learned how to query statements with qualifiers, try this exercise:

| Exercise: Write a query to show on a timeline the date of birth of actors that played James Bond in the James Bond film series (Q2484680)

Hint: the cast member property (P161) has P453 (character role) property as a qualifier with the value Q2009573 (James Bond)

Tip: use DISTINCT to remove duplicates from the results

show solution

Exercise: date qualifers

Exercise: Write a query showing women Nobel prize winners in Literature and when they received the award.

Hint: the award received property (P166) has P585 (point in time) as qualifer

show solution

If you have already learned about instances and classes, try editing the query so it shows all women who have won a Nobel prize, which award it was, and when they received it.

Hint: the value of the award received property (P166) is a subclass (P279) of Nobel Prize (Q7191).

show solution

Skip to content