Ogen
Ogen

Reputation: 6709

What is the difference between a temporal and a non-temporal query

I have read some resources that talk about temporal and non-temporal queries, specifically with SPARQL. What is the difference between these two kinds of queries?

Upvotes: 2

Views: 1639

Answers (2)

Jörn Hees
Jörn Hees

Reputation: 3428

As you don't refer to a specific document that talks about temporal queries, i can only give a pretty broad answer:

There are many approaches on how to model temporally constrained facts in RDF. As RDF itself is only concerned with triples/quads (subject, predicate, object(, graph)), many simple mapping approaches generate triples which are true at the time of mapping, but are prone to be outdated and wrong soon. One example is

dbpedia:Barack_Obama dbpedia-owl:office "President of the United States" .

While this is true at the moment, it will very likely be wrong in 2017 as he's already in his second term. Nevertheless as stated above it would always be true, which causes a lot of complications.

What is the difference between these two kinds of queries?

In general this can be answered by looking at your SPARQL query. If it somehow asks for a statement valid at a time / during a period, then it's a "temporal" query. If it doesn't contain any of that timing information it usually isn't (though your endpoint might implicitly add a "only facts valid now" constraint).

How such timing information is included depends on your SPARQL endpoint and how the data you're querying is modeled.

Some Modeling Approaches:

Qualified Relation Pattern

One approach to model temporal limited statements (that is actually used by DBpedia) is by using a qualified relation pattern / "role model":

dbpedia:Barack_Obama dbpedia-owl:termPeriod dbpedia:Barack_Obama__1 .
dbpedia:Barack_Obama__1 dbpedia-owl:activeYearsStartDate "2009-01-20"^^xsd:date .
dbpedia:Barack_Obama__1 dbpedia-owl:office "President of the United States" .
...

Reification

Another approach would be to use reification to make statements about the statement like this:

ex:Barack_Obama_presidency_stmt rdf:type rdf:Statement .
ex:Barack_Obama_presidency_stmt rdf:subject dbpedia:Barack_Obama .
ex:Barack_Obama_presidency_stmt rdf:predicate dbpedia-owl:office .
ex:Barack_Obama_presidency_stmt rdf:object "President of the United States" .
ex:Barack_Obama_presidency_stmt ex:activeYearsStartDate "2009-01-20"^^xsd:date .

Provenance timing on whole graphs

Yet another approach is to provide provenance information for each graph that is accessible on the endpoint, e.g. with http://www.w3.org/TR/prov-o/#generatedAtTime . In those cases you can use such information within your SPARQL query to ask for graphs that were generated in a given time-frame and then match against their triples.

Temporal SPARQL

Last but not least there are quite some approaches that try to introduce a special syntax or standardize such temporal queries in the SPARQL language itself, e.g.:

But as this answer shows such a standardization is far from generally accepted / implemented.

Conclusion

Because of the lack of standardization and its practical acceptance, "temporal SPARQL" queries need to take into account how the queried data models such temporal information.

This is a community wiki answer, feel free to expand.

Upvotes: 1

Tomasz Pluskiewicz
Tomasz Pluskiewicz

Reputation: 3662

The word temporal means relative to time, from the Latin word tempus, which itself means time.

Thus a temporal query is a query that takes time into consideration. Take as an example question that you would rewrite as a non-temporal

Who was (ever) married to John?

in contrast with its possible temporal version (one thereof)

Who was John married to in 2010?

Upvotes: 1

Related Questions