Posts
Use colour and filters to explore a Wikidata timeline
Rewritten on 28 October 2026 for the current Histropedia Query Timeline tool. The original publication date is retained above.
Colour is most useful when it answers a question. For a timeline of paintings, colouring by collection helps explore where the works are recorded; filtering lets you concentrate on one collection while retaining the chronology. You can build this in Query Timeline without custom drawing code.
A working example: paintings by Vincent van Gogh
Open this example in Query Timeline · Download the SPARQL query
# Dated paintings by Vincent van Gogh, grouped visually by collection.
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?start ?startPrecision
?image ?collectionLabel
WHERE {
hint:Query hint:optimizer "None" .
?item wdt:P170 wd:Q5582 ; wdt:P31 wd:Q3305213 ;
p:P571 ?dateStatement .
?dateStatement a wikibase:BestRank ; psv:P571 ?dateValue .
?dateValue wikibase:timeValue ?start ;
wikibase:timePrecision ?startPrecision .
OPTIONAL { ?item wdt:P195 ?collection . }
OPTIONAL { ?item wdt:P18 ?image . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?start ?item
LIMIT 200
This query selects dated paintings by Q5582, Vincent van Gogh. It requires a direct painting classification (P31 → Q3305213), so works classified only under a subclass will not appear. It uses inception dates with their recorded precision. The image and collection are optional, so missing metadata does not by itself exclude a painting.
In Configure Timeline, the supplied link sets:
| Setting | Variable |
|---|---|
| Title / Description | itemLabel / itemDescription |
| Start date / Start precision | start / startPrecision |
| Image URL | image |
| URL / Wikidata | item / item |
| Merge duplicate results / Group by | enabled / item |
| Colour code by / Filter categories | collectionLabel / collectionLabel |
Keep the end date empty. These cards represent creation dates, not the painting’s lifetime in a collection.
Distinguish a category from an event
The collection is attached to the work’s record; it is not a collection-acquisition date. A colour change along the timeline does not show that a museum acquired works in that sequence. For an acquisition history, you would need a separate query of dated acquisition or ownership statements.
Open the colour legend and use its category controls to compare collections. Use the filter controls to narrow the loaded data. A work can have more than one collection statement, and its record can change. Inspect the source before interpreting a colour as a unique, current physical location. Missing collection data means unknown here, not “private collection”. If the legend groups excess categories into “Other”, increase the maximum number of colours or use the category filter to inspect the actual values.
Repeated rows are not necessarily repeated works
Two images and two collections can create four query rows for one painting. DISTINCT removes identical rows, not every repetition of an item. Merge duplicate results with item as the key so equal-start-date rows combine. Different displayed start dates remain separate and deserve investigation. Dates that normalize to the same start can still differ in precision, which merging does not compare; disable merging when investigating those differences. Grouping is not a way to choose which date is correct. Where records have several images, inspect which image the resulting card uses rather than treating a merged card as an image gallery.
The example caps the response at 200 rows ordered by date, so it shows an early slice of the returned records and may contain fewer than 200 works. The cap was reached in our check. It is not Van Gogh’s complete catalogue. To study a particular period, add a date filter before the label service, for example:
FILTER(?start >= "1888-01-01T00:00:00Z"^^xsd:dateTime &&
?start < "1889-01-01T00:00:00Z"^^xsd:dateTime)
This tests stored timestamps; inspect coarse dates at the boundaries. Replace wd:Q5582 with another creator’s item to reuse the query. Works without a recorded creator, painting classification or inception date will not appear.
Choose categorical or numeric colour deliberately
A collection name is a category. A numeric measurement, such as the distanceKm in the location walkthrough, can instead drive a scale. Return a real numeric value from SPARQL, rather than text such as "2 km", if you want numeric behaviour. The variable name can carry the unit.
Add another selected variable to Colour code by to offer another scheme. Test the legend and filters before sharing: colour should complement labels and source links, not be the only way to identify an item. Use Share → Export to keep a data snapshot, or the shared query URL when you want future viewers to run the query again.
If you need application-specific styling, lane layouts or custom interaction, use HistropediaJS directly. Query Timeline is a useful place to establish the data question and mappings first.