Domain Chapter

Temporal Queries

Master time-based queries in SPARQL. From filtering by dates to building timelines, explore how to work with temporal data across programming language history, cultural heritage events, and urban development.

5
Topics
15+
Examples
Intermediate
Level

Time in Knowledge Graphs

Wikidata contains rich temporal information: when programming languages were created, when historical buildings were constructed, when cities were founded, and when cultural movements flourished. Understanding how to query temporal data unlocks powerful historical analysis and timeline generation.

Temporal queries involve:

Temporal Topics

Temporal Queries by Domain

Programming Languages Timeline

Languages Created by Decade
Run ↗
SELECT ?decade (COUNT(?lang) AS ?count)
       (GROUP_CONCAT(DISTINCT ?langLabel; SEPARATOR=", ") AS ?languages)
WHERE {
  ?lang wdt:P31 wd:Q9143 ;
        wdt:P571 ?inception .
  BIND(FLOOR(YEAR(?inception) / 10) * 10 AS ?decade)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
GROUP BY ?decade
ORDER BY ?decade

Cultural Heritage Through Time

UNESCO World Heritage Sites by Century
Run ↗
SELECT ?century (COUNT(?site) AS ?count)
WHERE {
  ?site wdt:P1435 wd:Q9259 .  # UNESCO World Heritage Site
  ?site wdt:P571 ?inception .
  BIND(FLOOR((YEAR(?inception) - 1) / 100) + 1 AS ?century)
  FILTER(?century > 0)  # Only AD dates
}
GROUP BY ?century
ORDER BY ?century

Urban Development Timeline

Cities Founded in Different Eras
Run ↗
SELECT ?era (COUNT(?city) AS ?count)
       (SAMPLE(?cityLabel) AS ?example)
WHERE {
  ?city wdt:P31/wdt:P279* wd:Q515 ;  # city or subclass
        wdt:P571 ?founded .
  BIND(YEAR(?founded) AS ?year)
  BIND(
    IF(?year < -500, "Ancient (before 500 BC)",
    IF(?year < 500, "Classical (500 BC - 500 AD)",
    IF(?year < 1500, "Medieval (500 - 1500)",
    IF(?year < 1800, "Early Modern (1500 - 1800)",
    IF(?year < 1900, "Industrial (1800 - 1900)",
    "Modern (1900+)")))))
  AS ?era)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
GROUP BY ?era
ORDER BY ?era

Key Temporal Properties in Wikidata

Property ID Description
inception wdt:P571 Date when entity was created/founded
dissolved/abolished wdt:P576 Date when entity ceased to exist
start time wdt:P580 When something started
end time wdt:P582 When something ended
point in time wdt:P585 When an event occurred
date of birth wdt:P569 Birth date of a person
date of death wdt:P570 Death date of a person
publication date wdt:P577 When something was published

Continue Learning

🌐

← Federation

Query multiple SPARQL endpoints.

Go Back
🗺️

Geospatial →

Work with locations, coordinates, and maps.

Continue