Page MenuHomePhabricator

Create a SPARQL query for events
Open, Needs TriagePublic

Description

Create a list of events for any Wikidata item for creating a timeline. Craft a SPARQL query that reads all the statements for an item that have dates as values and as qualifier values. Combine with statements from important linked items with dates as values (such as family members' birthdays or creation dates of works).

Some thoughts of how this could be broken up to parts

  1. Events that are directly declared in the topic, such as birth, death, creation dates etc.
  2. Every statement on the topic that has a date as a qualifier
  3. Related items via significant event (P793). There are two types of them: event instances (such as "the funeral of X" and classes "funeral". The classes usually have date information directly as a qualifier. The dates for the instances are in the linked item.
  4. Directly declared events from significant linked topics such as the birth and death days of close family, creation dates of works as an author --> how to define significant related events? It is also possible to separate the events of the linked items and display all of them on a timeline in their own components. For example events of related people, works, related locations, organizations etc. They could be filtered and added to the same timeline at will.

Example results for Akseli Gallen-Kallela (Q170068)

Link to other item labelLink propertyProperty labelPropertyObject labelObjectDate / Start dateEnd dateDesired displayType
date of birthP5691865-04-26Birth1
first nameP735AkseliQ192743181907(deathdate)First name Akseli2
spouseP26Mary SlöörQ230404441890(deathdate)Marriage with Mary Slöör2
medical conditionP1050diphtheriaQ1346491886Diphtheria2
significant eventP793funeralQ201676Funeral3
significant eventP793point in timeP585funeral of XQxxxxFuneral of X3
child / father (inverse), child (inverse label item)P40 / P22 (inverse)date of birthP569Kirsti GallénQ173803151896Birth of (daughter) Kirsti Gallén4
creator (inverse), creator of (inverse label item)P170 (inverse)inceptionP571Lemminkäinen's MotherQ35410511897Lemminkäinen's Mother4

Event Timeline

Kyrksök significant events search can be used for a part of the query type 3
https://kyrksok.se/Q10496884.html

#defaultView:Timeline{"hide":["?eventDate"]}
SELECT DISTINCT ?label ?dateLabel ?eventDate WHERE {

{
  SELECT * WHERE {
    wd:Q10496884 p:P793 ?event.
    ?event ps:P793 ?eventType.
    { ?event pqv:P580 ?eventNode. } UNION { ?event pqv:P585 ?eventNode. }
    ?eventNode wikibase:timeValue ?eventDate;
               wikibase:timePrecision ?eventPrecision.

    OPTIONAL { ?event pq:P518 ?part }

    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "sv".
      ?part rdfs:label ?partLabel .
      ?eventType rdfs:label ?eventTypeLabel .
    }
  }
}

BIND(YEAR(?eventDate) AS ?year)
BIND(IF(?eventPrecision < 9, "-talet", "") AS ?yearSuffix)
BIND(CONCAT(STR(?year), ?yearSuffix) AS ?dateLabel)

BIND(IF(BOUND(?part), CONCAT(?eventTypeLabel, " (", ?partLabel, ")"), ?eventTypeLabel) AS ?label)

}