<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Time Travel Queries in RDF Archives</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Melisachew Wudage Chekol</string-name>
          <email>mel@informatik.uni-mannheim.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Valeria Fionda</string-name>
          <email>fionda@mat.unical.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giuseppe Pirro`</string-name>
          <email>pirro@icar.cnr.it</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Data and Web Science Group, University of Mannheim</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>DeMaCS, University of Calabria</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Institute for High Performance Computing and Networking</institution>
          ,
          <addr-line>ICAR-CNR</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We research the problem of querying RDF archives. In this setting novel data management challenges emerge in terms of support for time-traversing structured queries. We formalize an extension of SPARQL, called SPARQ-LTL, which incorporates primitives inspired by linear temporal logic. We give formal semantics for SPARQ-LTL and devise query rewriting strategies from SPARQLTL into SPARQL. The usage of SPARQ-LTL allows to gain conciseness and readability when expressing complex temporal queries. We implemented our approach and evaluated query running time and query succinctness.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>
        Research in the field of archiving policies of Linked Open Data (LOD) opens up new
opportunities for the traceability of Semantic Web data over time [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. Several strands
of research (e.g., [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]) have focused on providing primitives to trace whether a dataset
or a particular entity has changed, as these functionalities are not natively supported
by the SPARQL query language. Dealing with RDF archives poses challenges both in
terms of the representation/storage of historical data and the type of query primitives
to be provided. Most existing knowledge bases (e.g., DBpedia) allow to query the
latest version of data only, although making available historical data in the form of data
dumps. In this case, the design of a data model to store data versions as well as
infrastructure for query processing is left open. Other efforts (e.g., [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]) have focused on
efficient indexing strategies for RDF archives.
      </p>
      <p>Querying historical data is important in many contexts, from analytic tasks where
one needs to understand how knowledge has evolved and updated (e.g., pollution levels
in a city), to generic exploratory research, where one is interested in posing queries like
“Retrieve the annotations of a gene since the discovery of a particular interaction” or
“Find players that are now managing some club they played for”. Typically one can
use plain SPARQL to express such queries. However, besides hindering the readability
of a query this approach is tedious and error-prone (e.g., one needs to be consistent
with variable names). Therefore, a number of proposals came up with extensions of
SPARQL both in terms of language primitives and indexing techniques (see Related
Work). Despite the plethora of approaches for querying temporal RDF data, we believe
that, especially for the case of RDF archives, having a simple approach that neither
require to setup complex processing infrastructures nor to learn complex temporal
languages can be useful. Therefore, the tenet of this paper is to study how to facilitate
querying historical RDF data on existing SPARQL processors.</p>
      <p>
        We formalize a powerful extension of SPARQL called SPARQ–LTL, which allows
to use a variety of temporal operators inspired by Linear Temporal Logics (LTL) [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]
(e.g., SINCE, NEXT, PREVIOUS). As we will show, SPARQ–LTL allows to write
concise readable temporal queries in a simple way. In particular, in SPARQ–LTL the
relationships between time points are implicit and transparent to the user. To evaluate
SPARQ–LTL queries we devise a translation from SPARQ–LTL to SPARQL that
allows to readily use our machineries in an elegant and non-intrusive way on existing
SPARQL processors.
      </p>
      <p>SPARQ–LTL by Example. We now provide some examples of SPARQ–LTL queries.
Example 1. Select footballers who played at least twice for the same club.
SELECT ?person WHERE {</p>
      <p>EVENTUALLY{
?person :occupation :football_player .
?person :member_of_team ?club .</p>
      <p>NEXT { EVENTUALLY {</p>
      <p>?person :member_of_team ?club .</p>
      <p>}}
} }</p>
      <p>The SPARQ–LTL query expressing the example makes usage of the EVENTUALLY
and NEXT temporal operators. EVENTUALLY checks that eventually (along the whole
time line) one has to be a football player, playing for some club (a binding of the variable
?club). After identifying the timepoint (data version) where the first part of the query
has a solution, the usage of NEXT, by moving at the next point in the timeline, checks
again the same condition. As an example, M. Hughes played for Manchester United
both in 1980-86 and 1988-95. Note that the management of timepoints is completely
transparent to the user. We now give another example of SPARQ–LTL along with its
translation into SPARQL. We assume each historical data version (e.g., DBpedia dump)
to be stored in a separate named graph.</p>
      <p>Example 2. Find the name of the coach of the Italian national football team after the
sacking of Cesare Prandelli.</p>
      <p>SPARQ–LTL
SELECT ?n WHERE {
PAST {
dbp:Italy dbpo:coach
dbp:Cesare_Prandelli.</p>
      <p>NEXT {
dbp:Italy dbpo:coach ?n.</p>
      <p>FILTER
(?n!=dbp:Cesare_Prandelli)
} } }</p>
      <p>Translation into SPARQL
SELECT ?n WHERE {
{GRAPH &lt;http://data/v5&gt; {
dbp:Italy dbpo:coach dbp:Cesare_Prandelli.</p>
      <p>GRAPH &lt;http://data/v6&gt; {
dbp:Italy dbpo:coach ?n.</p>
      <p>FILTER(?n != dbp:Cesare_Prandelli)}
} } UNION ...... UNION{
GRAPH &lt;http://data//v1&gt; {
dbp:Italy dbpo:coach dbp:Cesare_Prandelli.</p>
      <p>GRAPH &lt;http://data/v2&gt; {
dbp:Italy dbpo:coach ?n.</p>
      <p>FILTER(?n != dbp:Cesare_Prandelli)
} } }}</p>
      <p>The previous SPARQ–LTL query makes usage of PAST to find when (in which
version) C. Prandelli was the coach. Then, via the nested NEXT operator executes the
innermost part of the query looking for the Italian football team coach in the subsequent
version. Assuming to have 6 versions of the data it can be noted that PAST makes usage
of UNION queries over each of the 6 versions vi, with i 2 f1; :::; 6g, (since the starting
version is the current one, i.e., v6); then, for each vi, NEXT checks in version vi+1 (via
a FILTER) that the coach changed — actually, note that the evaluation of PAST can
transparently start from the version v5 since version v6 does not have a NEXT version.
The advantage of using SPARQ–LTL can be noted both in terms of succinctness (the
SPARQ–LTL query has 140 characters while the complete translation 600) and
readability. We formalize the translation in Section 3.3.</p>
      <p>Contributions and Outline. We make the following main contributions: (i) a
formalization of SPARQ–LTL, a temporal extensions of SPARQL that offers a concise and
readable syntax for temporal queries; (ii) a formal semantics; (iii) a translation from
SPARQ–LTL into SPARQL; (iv) an experimental evaluation along with an analysis of
the succinctness of SPARQ–LTL queries.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <p>This section provides some background about the machineries used in this paper.
2.1</p>
      <sec id="sec-2-1">
        <title>RDF and SPARQL</title>
        <p>An RDF triple4 is a tuple of the form hs; p; oi2I I I[L, where I (IRIs) and L
(literals) are countably infinite sets. An RDF graph G is a set of triples. To query RDF
data, a standard query language, called SPARQL, has been defined. The semantics of
a SPARQL query is defined in terms of solution mappings. A (solution) mapping is
a partial function : V ! I [ L. Two mappings, say 1 and 2, are compatible (resp.,
not compatible), denoted by 1 = 2 (resp., 1 6= 2), if 1(?v) = 2(?v) holds
(resp., does not hold) for all variables ?v 2 dom( 1) \ dom( 2) . If 1 = 2 then
1 [ 2 denotes the mapping obtained by extending 1 according to 2 on all
variables in dom( 2)ndom( 1). This allows for defining the join, union, difference, and
left outer join operations between two sets of mappings M1, and M2 as shown below:
M1 1 M2 = f 1 [ 2 j 1 2 M1; 2 2 M2 and 1 = 2g
M1 [ M2 = f j
2 M1 or
The SPARQL semantics uses a function JQKG that evaluates a query Q on a graph G
and gives a multiset (bag) of mappings in the general case.</p>
        <sec id="sec-2-1-1">
          <title>4We do not consider bnodes.</title>
          <p>2.2</p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>Linear Temporal Logic</title>
        <p>
          Linear temporal logic (LTL) is an extension of modal logic to formally specify systems
and reason over them; here, modalities are temporal operators relating events happening
at different time instants over a linearly ordered timeline. Classically, LTL formulas
are interpreted over infinite sequences of states. The LTLf variant [
          <xref ref-type="bibr" rid="ref14 ref9">9, 14</xref>
          ] considers
formulas interpreted over traces of finite length. Given the fact that we take inspiration
from LTL in the context of dynamic knowledge bases, we will focus on the PLTLf
variant, which is an extension of LTLf with past modalities [25].
        </p>
        <p>PLTLf formulas are built over a set V of atomic propositional variables by
using the Boolean connectives ^; _; : plus the future temporal operators X (NEXT),
F (EVENTUALLY), G (ALWAYS), U (UNTIL), and the past temporal operators Y
(PREVIOUS), P (PAST), H (ALWAYSPAST), S (SINCE). The meaning of the
temporal operators is summarized in Table 1.</p>
      </sec>
      <sec id="sec-2-3">
        <title>PLTLf Operator Meaning</title>
        <p>X q q has to hold in the next state
F q q has to hold in some future state</p>
        <p>G q q has to hold in the current and all future states
q1 U q2 q1 has to hold in all states in the future until there is a state in which q2 holds
Y q q has to hold in the previous state
P q q has to hold in some past state</p>
        <p>
          H q q has to hold in all past states
q1 S q2 q1 has to hold starting from the state in the past where q2 holds
Our main goal in this paper is to devise a temporal extension of SPARQL with particular
emphasis on an easy (and intuitive) usage of temporal operators and their combinations.
Our second goal is to enable querying RDF archives on existing SPARQL processors.
In what follows we provide an overview about archiving policies for historical RDF
data [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ].
        </p>
        <p>Independent Versions. The first approach works by keeping independent versions of
the data. In the case of RDF this could be implemented by assuming that each data
version (e.g., DBpedia dumps) is stored in a separate named graph. Consider the data taken
from DBpedia reported in Fig. 1. A query ran on March 2014 and asking for the coach of
the Italian football team would have returned Cesare Prandelli. The same query ran on
September 2014 would have returned Antonio Conte. Query infrastructures allowing to
query the latest version of the data, miss the flow of updates. As an example it would not
be possible to ask queries like “Find players since C. Prandelli was the coach”. A
simple way to represent historical RDF data using versioning is via RDF quads. An RDF
quad (for simplicity, we omit bnodes) is a tuple of the form hs; p; o; ci 2 I I (I[L)
I, where the fourth element of the quad represents the named graph to which the triple
belongs5. Hence, quads that differ for the fourth element only (e.g., white (uncolored)
triples in Fig. 1), represent the fact that a triple is present in different versions.</p>
        <p>dbp:Luca_Antonelli
dbp:Italy_national_football_team dbpo:name ..
dbpo:regionalName dbpo:name dbp:Giam.paolo_Pazzini</p>
        <p>dbp:UEFA_European_Championship
July 2016 &lt;http://gize.org/version5&gt;
dbpdbop::cGoiaamchpiero_Ventura dbpo:nadbmpe:A..ndrea_Pirlo
dbp:Italy_national_football_team .</p>
        <p>dbpo:regionalName dbpo:name dbp:Matteo_Darmian
March 2014 &lt;http://gize.org/version2&gt; September 2014 &lt;http://gize.org/version3&gt;
dbp:Cesare_Prandelli dbp:Andrea_Pirlo dbp:Antonio_Conte dbp:Andrea_Pirlo
dbpo:coach dbpo:name dbpo:coach dbpo:name ..</p>
        <p>dbp:Italy_national_football_team .
dbpo:regionalName dbpo:name dbp:Matteo_Darmian
dbp:UEFA_European_Championship dbp:UEFA_Euro_2016_qualifying</p>
        <p>dbpo:current
update addition deletion</p>
        <p>DBpedia Update Statistics about People
dbp:UEFA_European_Championship dbp:UEFA_Euro_2016
dbpo:current</p>
        <p>Tracking the changes. This approach is based on the computation (and storing) of
updates or differences (deltas) between versions. It requires additional computational
costs for delta propagation which may affect version-focused retrieving operations.
Timestamps. In this case each RDF triple is annotated with its temporal validity. From
a practical point of view, there are two main approaches: (i) compression techniques
e.g. using selfindexes or delta compression in B+Trees (e.g., [17]); (ii) annotate triples
(with time information) only when they are added or deleted.</p>
        <p>In this paper we consider the independent versions model to describe our SPARQ–
LTL language. Nevertheless, SPARQ–LTL can be also used (with minor changes) with
the other archiving models (see Section 6).
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>The SPARQ–LTL Language</title>
      <p>We are now ready to introduce SPARQ–LTL, a general language that offers a concise
syntax for the writing of temporal queries. We first discuss SPARQ–LTL syntax, then
its formal semantics6 and finally the translation of SPARQ–LTL queries into SPARQL.
3.1</p>
      <sec id="sec-3-1">
        <title>Syntax</title>
        <p>Let V be a set of variables. The syntax of SPARQ–LTL query patterns (QP) is shown
in Fig. 2. The language extends SPARQL with constructs inspired by the temporal
operators of Linear Temporal Logic (LTL) as described in Table 1. In SPARQ–LTL the
5For instance, the date in which a version is created
6For the sake of readability we focus on set semantics.
complete name of the temporal constructs can be used, e.g. one can write ALWAYS
instead of G or ALWAYSPAST instead of H.</p>
        <p>QP ::= SPARQL operators
t = (I [ V) (I [ V) (I [ L [ V) j QP1 AND QP2 j fQP1g UNION fQP2g j
fQP1g MINUS fQP2g j QP1 OPT fQP2g j QP FILTER fRg j GRAPH I [ V fQPg j</p>
      </sec>
      <sec id="sec-3-2">
        <title>Temporal operators</title>
        <p>XfQPg j FfQPg j GfQPg j fQP1g U fQP2g j
YfQPg j PfQPg j HfQPg j fQP1g S fQP2g
The formal semantics of SPARQ–LTL is shown in Table 2; rules in the top part define
the semantics of (standard) SPARQL operators (we focus on set semantics for sake of
exposition), while the semantics of the temporal constructs is defined in the bottom part.</p>
        <p>JtKGi = f j dom( ) = var(t) and (t) 2 Gig</p>
        <p>Jq1 AND q2KGi = f j 2 Jq1KGi 1 Jq2KGi g
Jq1 UNION q2KGi = f j 2 Jq1KGi [ Jq2KGi g
Jq1 MINUS q2KGi = f j 2 Jq1KGi n Jq2KGi g</p>
        <p>Jq1 OPT q2KGi = f j 2 Jq1KGi ./ Jq2KGi g
Jq FILTER fRgKGi = f j 2 JqKGi and eval( ; R)=trueg</p>
        <p>J GRAPH u fqgK = f j 2 JqKGu g
J GRAPH ?v fqgK = SGj f j 0 2 JqKGj and = 0 [ f?v ! Gjgg</p>
        <p>JJXF qqKKGGii == JSqiKGji&lt;+n1JqKGj
J q1 JUGqq2KKGGii == fSi :j&lt;n2fJq1KG1i 12 JjqK2Gi2+1Jq12K:G::j1anJdqKG1n2g Jq1KGk ; 8i</p>
        <p>JJPY qqKKGGii == JSq0KGji 1iJqKGj
J q1 JSHqq2KKGGii == fS0 : j 2ifJq1K1Gi 12 Jjq.K2G2i 1Jq12K:G::j 1anJdqKG102g Jq1KGk ; 8j &lt; k</p>
        <p>
          The evaluation function J K requires a graph Gi (encoding a version of the data) for
all rules but those (last two in the top part) that actually allow to evaluate the query
on a specific graph. By default the evaluation starts from the current version. The
result of a query is a set of mappings that are retrieved by looking into a particular (set
of) data version(s) as dictated by the temporal constructs. To define the semantics of
temporal operators in SPARQ–LTL we took inspiration from the semantics of LTL [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
Indeed, the result of a SPARQ–LTL query evaluated in a specific version corresponds
to the evaluation of the temporal sub-queries in versions that follow (for future
operators) or precede (for past operators) the given query. For instance, the evaluation of
the query pattern EVENTUALLY(F)fqg in the version Gi, corresponds to the set of
mappings obtained by evaluating q in all versions following Gi. On the other hand,
evaluating ALWAYSPAST(H)fqg would return the common set of mappings that are
given by evaluating q in all the versions preceding Gi.
3.3
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>Translation into SPARQL</title>
        <p>SPARQ–LTL allows to express complex temporal queries in a concise way by
incorporating constructs inspired by LTL allowing to capture a variety of temporal aspects both
involving the past and the future. The second goal of this paper is to make SPARQ–
LTL available into existing SPARQL processors. To fulfill this goal we now discuss a
translation procedure from SPARQ–LTL queries into SPARQL queries.</p>
        <p>The translation of SPARQ–LTL is outlined in Table 3. The (recursive)
translation function (q; i), given a SPARQ–LTL query q and a graph version i produces a
SPARQL query by translating the temporal operators via a (set of) pattern(s) evaluated
on named graphs (via the SPARQL GRAPH operator) maintaining data versions. The
SPARQL query is generated by applying recursively the translation function to the
sub-queries. We give an additional example by considering data versions (stored in
separate named graphs) where dbp:INFT is a shorthand for dbp:Italy_national_
football_team.</p>
        <p>Example 3. Select players who are playing in the Italian national football team under
the current coach and that have played under at least one different coach in the past.</p>
        <p>SPARQ–LTL</p>
        <p>Translation into SPARQL</p>
        <p>The SPARQL query on the right is automatically generated and can be evaluated on
existing processors. Note that the translation requires to look into all previous versions.
(t = hs; p; oi; i) = t
(q1 AND q2; i) = (q1; i) AND (q2; i)
(q1 UNION q2; i) = (q1; i) UNION (q2; i)
(q1 MINUS q2; i) = (q1; i) MINUS (q2; i)
(q1 OPT q2; i) = (q1; i) OPT (q2; i)
(q FILTER fRg; i) = (q; i) FILTER (R)
( GRAPH v fqg; i) = f GRAPH v f (q; v)gg
( GRAPH ?vfqg; i)= f GRAPH h0if (q; 0)g BIND(0 AS ?v)g UNION . . . UNION</p>
        <p>f GRAPH hn-1if (q; n-1)g BIND(n-1 AS ?v)g
(Xfqg; i) = GRAPH hi+1if (q; i + 1)g
(Ffqg; i) = f GRAPH hiif (q; i)gg UNION f GRAPH hi+1if (q; i+1)gg UNION . . .</p>
        <p>UNION f GRAPH hn-1i f (q; n-1) gg
(Gfqg; i) = GRAPH hiif (q; i)g GRAPH hi+1if (q; i+1)g . . . GRAPH hn-1if (q; n-1)g
(fq1gUfq2g; i) = f GRAPH hiif (q2; i)gg UNION f GRAPH hi+1if (q2; i+1)g GRAPH hiif (q1; i)gg
UNION . . . UNION f GRAPH hn-1if (q2; n-1)g GRAPH hiif (q1; i)g : : :</p>
        <p>GRAPH hn-2if (q1; n-2)gg
(Yfqg; i) = GRAPH hi-1if (q; i-1)g
(Pfqg; i) = f GRAPH hiif (q; i)gg UNION f GRAPH hi-1if (q; i-1)gg UNION . . . UNION
f GRAPH h0if (q; 0)gg
(Hfqg; i) = GRAPH hiif (q; i)g GRAPH hi-1if (q; i-1)g . . . GRAPH h0if (q; 0)g
(fq1gSfq2g; i) = f GRAPH hiif (q2; i)gg UNION f GRAPH hi-1if (q2; i-1)g GRAPH hiif (q1; i)gg
UNION . . . UNION f GRAPH h0if (q2; 0)g GRAPH h1if (q1; 1)g : : :</p>
        <p>GRAPH hiif (q1; i)gg</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4 Related Work</title>
      <p>In databases, there exists a vast body of literature on temporal relational databases for
developing temporal data models and query languages (cf. the survey [30]). The most
prominent query language for temporal databases is TSQL2 [33]. TSQL2 is not a part
of the standard SQL, however, the latest standard (SQL:2011) supports the valid (viz.
application time) and transaction time models [35].</p>
      <p>In the Semantic Web, the introduction of time into RDF has been studied almost one
decade ago [22]. Gutierrez et al. [22] studied fundamental problems of temporal RDF
graphs such as entailment and outlined a query language allowing to express queries
making usage of intervals. Along these lines several other extensions of SPARQL such
as -SPARQL [34], T-SPARQL [18], tRDF [32] and RDF-TX [17] have been proposed.</p>
      <p>
        -SPARQL extends SPARQL query patterns with two variables ?s and ?e to bind the
start time and end time of temporal RDF triples and express temporal queries. The
evaluation is done by rewriting -SPARQL queries into standard SPARQL queries.
TSPARQL leverages a multi-temporal RDF model where each RDF triple is annotated
with a temporal element that represents a set of temporal intervals. T-SPARQL is based
on TSQL2 (temporal SQL). The tRDF system builds upon the Gutierrez et al. [22]
temporal RDF model. tRDF queries are evaluated using an index (viz. tGrin) based on a
strategy that clusters RDF triples using a graphical-temporal distance. RDF-TX [17]
offers both a temporal extension of SPARQL and an indexing system based on the
compressed multiversion B+ tree approach from relational databases. SPARQL-ST is a
query language for spatiotemporal RDF data [31]. It extends SPARQL with spatial and
temporal variables. The temporal variables appear in the fourth position of valid time
temporal triple patterns (i.e., when temporal triples are represented by quads); and thus,
these variables can be mapped into time intervals upon query evaluation. Additionally,
SPARQL-ST proposed a new filter operator called TEMPORAL FILTER which
supports temporal constraints based on Allen’s interval relations [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Furthermore, an
extension of SPARQL-ST called stSPARQL, using the valid time model, is studied in [
        <xref ref-type="bibr" rid="ref5">5,
24</xref>
        ], which uses linear constraints to query valid time spatiotemporal RDF data (stRDF).
stSPARQL is implemented and integrated into Strabon7 that extends SPARQL with a set
of temporal functions designed based on Allen’s interval algebra. It has also functions
for time interval intersection, union, and so on. While stSPARQL is based on Allen’s
interval algebra, SPARQ-LTL is based on LTL and is able to support stSPARQL’s
temporal functions via the FILTER operator. A logic-based approach for representing
validity time in RDF(S) and OWL 2 is reported in [29]. Based on this approach, the authors
extend SPARQL by augmenting basic graph patterns with a number of temporal
relations such as during, occurs, at, and so on. No implementation is available for the
proposed query language. Our goal is to enable the querying of historical RDF data
with two tenets: (i) using existing SPARQL processors; (ii) providing a concise,
expressive and readable temporal language. Surprisingly, despite the plethora of related work,
none of the existing approaches can fulfill these desiderata. Approaches like tRDF and
RDF-TX have the advantage of using ad-hoc indexing strategies. However, this
introduces problems of index construction/maintenance and require non-standard
components, thus hindering their applicability on existing SPARQL processors. RDF-TX and
tRDF consider a subset of SPARQL (basic graph patterns) and the semantics of the
temporal language is only given in terms of SPARQL; we provide semantics for temporal
operators. None of these languages ( -SPARQL, T-SPARQL, tRDF, and RDF-TX) has
focused on conciseness and readability of temporal queries, leaving to the user the
burden to encode in standard SPARQL the temporal parts. On the contrary, SPARQ–LTL
works with an abstract syntax that offers a rich class of (abstract) temporal operators
inspired by Linear Temporal Logic [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. We also want to mention: (i) proposals like
tOWL [28] that focus on designing extensions to incorporate time; (ii) temporal
conjunctive query answering (e.g., Borgwardt et al.[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]); (iii) translation of SPARQL into
LTL (e.g., Mateescu et al.[26, 19], Artale et al. [
        <xref ref-type="bibr" rid="ref2 ref3">3, 2</xref>
        ]); (iv) approaches like the DBpedia
Wayback Machine [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] that allow to retrieve data at a certain timestamp (provided by
the user). Our approach differs from (i), (ii), (iii) in the fact that we focus on an
extension of SPARQL to write concise and readable temporal queries, and query processing
on existing SPARQL processors; as for (iii) we proceed in the opposite direction,
expressing LTL operators in SPARQL. Finally (iv), only focus on providing access to an
entity at a given time and do not offer any temporal query language. We point other
relevant literature in the area [
        <xref ref-type="bibr" rid="ref11 ref4">11, 23, 20, 27, 4</xref>
        ].
      </p>
      <p>7Strabon is a spatiotemporal RDF store http://www.strabon.di.uoa.gr</p>
    </sec>
    <sec id="sec-5">
      <title>Experimental Evaluation</title>
      <p>In the experimental evaluation we measured: (i) query running time when translating a
SPARQ–LTL query; (ii) query succinctness.</p>
      <p>Datasets. We used both local and remote datasets. We considered data (person data
and infoboxes) from the latest 7 versions of DBpedia8 and loaded each version in a
separate named-graph by using Blazegraph9 as SPARQL processor. All the experiments
have been performed on an Intel i5 machine with 8GBs RAM. Results reported are the
average of 10 runs. Table 4 reports the size (in millions of triples) of the (local) data
loaded in each version along with the percentage of updated (Upds), added (Adds) and
removed (Dels) triples between versions.</p>
      <p>Running Time. We used a set of 10 SPARQ–LTL queries including from one to four
temporal constructs. In the first experiment, we measured the query time after
translating the queries. Running times are reported in Table 5. As it can be observed the running
time for all queries is in the order of tens of seconds.</p>
      <sec id="sec-5-1">
        <title>Query Time (s) Query Time (s)</title>
        <p>Q1 11 Q6 12
Q2 23 Q7 23
Q3 11 Q8 32
Q4 14 Q9 33
Q5 41 Q10 31</p>
        <p>We noted that the query time grows almost exponentially with the number of
temporal constructs involved. Indeed, each temporal construct requires a certain number of
UNION queries. The cost in terms of time to load all the version was of about 3h (on a
8http://downloads.dbpedia.org
9https://www.blazegraph.com
4000
3000
2000
1000
0
SPARQ-LTL
SPARQL
laptop), with a total storage space for all the versions of about 50 GBs. To give a sense
of the amount of redundancy introduced by this approach, we noticed that the 40% of
triples are left untouched along all the versions. Overall, this approach has the
advantage of providing an immediate way for querying historical RDF data. The cost that one
has to pay consists in loading different data versions plus data redundancy. The level of
redundancy that can be afforded depends on the dataset; for datasets of small/medium
size like DBpedia this may be bearable.</p>
        <p>Query Succinctness. We measured the length, in terms of number of characters, of the
SPARQ–LTL queries considered along with their translations. Fig. 3 shows the result of
this analysis. It is worth to point out that: (i) SPARQ–LTL queries not only are shorter
but also more readable; (ii) the user deals with a lower number of variables.</p>
        <p>Q1</p>
        <p>Q2</p>
        <p>Q3</p>
        <p>Q4</p>
        <p>Q5</p>
        <p>Q6</p>
        <p>Q7</p>
        <p>Q8</p>
        <p>Q9 Q10</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>SPARQ–LTL and other Archiving models</title>
      <p>We now give a hint of how SPARQ–LTL can be used with other archiving models.
In particular we focus on timestamps and leave as a future work a complete treatment
of this topic. Timestamps allow to establish the time (or the version) at which a certain
event is true. In this setting, a temporal RDF graph is a graph where triples hs; p; oi in the
graph have a fourth element that represents validity [v1; v2], i.e., (hs; p; oi; [v1; v2]). As
mentioned in Section 2.3, for triples that do not change at all across versions the validity
can be omitted. The syntax of a graph in this setting is usually given by reifying temporal
facts into non-temporal facts [21]. We represent a temporal triple (hs; p; oi; [v1; v2]) in
RDF as shown in Fig. 4.</p>
      <p>The advantage of this approach over the independent versions model is that data are
stored in one graph, although requiring an effort to generate and keep up to date the
validity of triples. In terms of storage space, this approach requires at most (only for
triples that change) four triples instead of one.</p>
      <p>s p _:x.
_:x p o.
_:x :validFrom v1.</p>
      <p>_:x :validThrough v2.</p>
      <p>The independent versions model can be cast into the timestamp model as follows:
(i) start with the oldest data version (v1) and represent each triple as hs; p; oi; (ii) for
each version vi, i &gt; 1, if hs; p; oi (resp., (hs; p; oi; [vj ; ])) was in vi 1 and is not in vi
add (hs; p; oi; [v1; vi 1]) (resp., (hs; p; oi; [vj ; vi 1])); (iii) if hs; p; oi was not in vi 1
but is in vi add (hs; p; oi; [vi; ]).</p>
      <p>In this setting, the evaluation function used to define the semantics of SPARQ–LTL
will not make usage of different (named) graphs (see Table 2) but will make usage
of a single graph and leverage the validity information of triples. As an example, the
operator EVENTUALLY whose semantics according to the independent versions is
JF qKGi =</p>
      <p>[
i j&lt;n</p>
      <p>JqKGj
JF qKvGi =</p>
      <p>[
vj:vj vi</p>
      <p>JqKvGj
with the timestamps is interpreted as:
assuming that timestamps are expressed as integer values and vi is the version from
which F q is evaluated. Similarly, the translation of SPARQ–LTL into SPARQL now
takes into account validity information that will be taken into account by using RDF
predicates as those in Fig. 4. We give a hint via the following example, which also
underlines the conciseness of SPARQ–LTL.</p>
      <p>Example 4. Select all footballers that always played with the same football team.</p>
      <sec id="sec-6-1">
        <title>SPARQ–LTL Translation into SPARQL</title>
        <p>SELECT ?person WHERE {
{ ?person :occupation ?x1.</p>
        <p>?x1 :occupation :football_player.</p>
        <p>ES?VEpELeNErTCsUToAnL?Lp:Yeo{rcscounpaWtHiEoRnE:{football_player. {OOPP?TTpIIeOOrNNsAAoLLn{{??:xxm11em::bvveaarll_iioddfTF_hrtroeomaumg?ht?1x?.t2}2..}
ALWAYS{?person :member_of_team ?club.} ?x2 :member_of_team ?club.
} } OOPPTTIIOONNAALL{{??xx22 ::vvaalliiddTFhrroomug?ht3?.t}4.}OPTIONAL
FILTER(((!BOUND(?t1)&amp;&amp;!BOUND(?t3)) ||
(?t3=?t1)) &amp;&amp; (!BOUND(?t4)))
}}}
7</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>Conclusions and Future Work</title>
      <p>
        We described a novel formal language for querying historical RDF data called SPARQ–
LTL. We presented a formal semantics along with translations that makes SPARQ–
LTL queries usable in existing SPARQL processors. In this work, we focused on RDF
archives with data stored in separate named graphs. As mentioned in Section 6 we
are currently working on an extension of the language where archival RDF data are
represented via timestamps. As a future work, we will explore the possibility to add
other temporal features to the language and perform a more comprehensive
experimental evaluation and comparison with related proposals also using benchmarks like
BEAR [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. We will also address temporal coalescing in the valid time model taking
into account [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. The inclusion of preferences [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] and the investigation of temporal
navigational languages [16] are also in our research agenda.
16. V. Fionda, G. Pirro` , and M. P. Consens. Extended property paths: writing more sparql queries
in a succinct way. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial
Intelligence, pages 102–108. AAAI Press, 2015.
17. S. Gao, J. Gu, and C. Zaniolo. RDF-TX: A Fast, User-Friendly System for Querying the
      </p>
      <p>History of RDF Knowledge Bases. In EDBT, pages 269–280, 2016.
18. F. Grandi. T-SPARQL: A TSQL2-like Temporal Query Language for RDF. In ADBIS (Local</p>
      <p>Proceedings), pages 21–30. Citeseer, 2010.
19. M. Gueffaz, S. Rampacek, and C. Nicolle. Mapping sparql query to temporal logic query
based on n smv model checker to query semantic graphs. International Journal of Digital
Information and Wireless Communications (IJDIWC), 1(2):366–380, 2012.
20. M. Gueffaz, S. Rampacek, and C. Nicolle. Temporal logic to query semantic graphs using
the model checking method. Journal of Software, 7(7):1462–1472, 2012.
21. C. Gutierrez, C. Hurtado, and A. Vaisman. Temporal rdf. In The Semantic Web: Research
and Applications, pages 93–107. Springer, 2005.
22. C. Gutierrez, C. A. Hurtado, and A. Vaisman. Introducing time into rdf. Knowledge and</p>
      <p>Data Engineering, IEEE Transactions on, 19(2):207–218, 2007.
23. U. Khurana and A. Deshpande. Efficient snapshot retrieval over historical graph data. In
Data Engineering (ICDE), 2013 IEEE 29th International Conference on, pages 997–1008.</p>
      <p>IEEE, 2013.
24. M. Koubarakis and K. Kyzirakos. Modeling and querying metadata in the semantic sensor
web: The model stRDF and the query language stSPARQL. In The semantic web: research
and applications, pages 425–439. Springer, 2010.
25. F. Laroussinie, N. Markey, and P. Schnoebelen. Temporal logic with forgettable past. In
Logic in Computer Science, 2002. Proceedings. 17th Annual IEEE Symposium on, pages
383–392. IEEE, 2002.
26. R. Mateescu, S. Meriot, and S. Rampacek. Extending SPARQL with Temporal Logic.
Report, 2009.
27. B. McBride and M. Butler. Representing and querying historical information in rdf with
application to e-discovery. HP Laboratories Technical Report, HPL-2009-261, 2009.
28. V. Milea, F. Frasincar, and U. Kaymak. towl: a temporal web ontology language. IEEE</p>
      <p>Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 42(1):268–281, 2012.
29. B. Motik. Representing and querying validity time in rdf and owl: A logic-based approach.</p>
      <p>Web Semantics: Science, Services and Agents on the World Wide Web, 12:3–21, 2012.
30. G. O¨ zsoyog˘ lu and R. T. Snodgrass. Temporal and real-time databases: A survey. Knowledge
and Data Engineering, IEEE Transactions on, 7(4):513–532, 1995.
31. M. Perry, P. Jain, and A. P. Sheth. Sparql-st: Extending sparql to support spatiotemporal
queries. In Geospatial semantics and the semantic web, pages 61–86. Springer, 2011.
32. A. Pugliese, O. Udrea, and V. Subrahmanian. Scaling RDF with time. In Proc. of the 17th
international conference on World Wide Web, pages 605–614, 2008.
33. R. T. Snodgrass. The TSQL2 temporal query language, volume 330. Springer Science &amp;</p>
      <p>Business Media, 2012.
34. J. Tappolet and A. Bernstein. Applied temporal RDF: Efficient temporal querying of RDF
data with SPARQL. In European Semantic Web Conference, pages 308–322. Springer, 2009.
35. F. Zemke. What’s new in SQL:2011. ACM SIGMOD Record, 41(1):67–73, 2012.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>J. F.</given-names>
            <surname>Allen</surname>
          </string-name>
          .
          <article-title>Maintaining knowledge about temporal intervals</article-title>
          .
          <source>Communications of the ACM</source>
          ,
          <volume>26</volume>
          (
          <issue>11</issue>
          ):
          <fpage>832</fpage>
          -
          <lpage>843</lpage>
          ,
          <year>1983</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>A.</given-names>
            <surname>Artale</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kovtunova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Ryzhikov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          .
          <article-title>First-order rewritability of ontology-mediated temporal queries</article-title>
          .
          <source>In Proc. of the 24th Int. Joint Conf. on Artificial Intelligence (IJCAI'15)</source>
          , pages
          <fpage>2706</fpage>
          -
          <lpage>2712</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>A.</given-names>
            <surname>Artale</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Ryzhikov</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          .
          <article-title>Tractable interval temporal propositional and description logics</article-title>
          .
          <source>In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, January 25-30</source>
          ,
          <year>2015</year>
          , Austin, Texas, USA., pages
          <fpage>1417</fpage>
          -
          <lpage>1423</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>S.</given-names>
            <surname>Auer</surname>
          </string-name>
          and
          <string-name>
            <given-names>H.</given-names>
            <surname>Herre</surname>
          </string-name>
          .
          <article-title>A versioning and evolution framework for rdf knowledge bases</article-title>
          .
          <source>In Perspectives of Systems Informatics</source>
          , pages
          <fpage>55</fpage>
          -
          <lpage>69</lpage>
          . Springer,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>K.</given-names>
            <surname>Bereta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Smeros</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Koubarakis</surname>
          </string-name>
          .
          <article-title>Representation and Querying of Valid Time of Triples in Linked Geospatial Data</article-title>
          .
          <source>In The Semantic Web: Semantics and Big Data</source>
          , 10th International Conference, ESWC 2013, Montpellier, France, May
          <volume>26</volume>
          -30,
          <year>2013</year>
          . Proceedings, pages
          <fpage>259</fpage>
          -
          <lpage>274</lpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>M. H. Bo</surname>
            ¨hlen, R. T. Snodgrass, and
            <given-names>M. D.</given-names>
          </string-name>
          <string-name>
            <surname>Soo</surname>
          </string-name>
          .
          <article-title>Coalescing in temporal databases</article-title>
          .
          <source>In VLDB'96, Proceedings of 22th International Conference on Very Large Data Bases, September 3-6</source>
          ,
          <year>1996</year>
          , Mumbai (Bombay), India, pages
          <fpage>180</fpage>
          -
          <lpage>191</lpage>
          ,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>S.</given-names>
            <surname>Borgwardt</surname>
          </string-name>
          , M. Lippmann, and
          <string-name>
            <given-names>V.</given-names>
            <surname>Thost</surname>
          </string-name>
          .
          <source>Temporalizing Rewritable Query Languages Over Knowledge Bases. JWS</source>
          ,
          <volume>33</volume>
          :
          <fpage>50</fpage>
          -
          <lpage>70</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>A.</given-names>
            <surname>Cerdeira-Pena</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Farina</surname>
          </string-name>
          ,
          <string-name>
            <surname>J. D.</surname>
          </string-name>
          <article-title>Ferna´ndez, and M. A. Mart´ınez-Prieto. Self-indexing rdf archives</article-title>
          .
          <source>In Data Compression Conference (DCC)</source>
          ,
          <year>2016</year>
          , pages
          <fpage>526</fpage>
          -
          <lpage>535</lpage>
          . IEEE,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>G. D. De Giacomo</surname>
            and
            <given-names>M. Y.</given-names>
          </string-name>
          <string-name>
            <surname>Vardi</surname>
          </string-name>
          .
          <article-title>Linear Temporal Logic and Linear Dynamic Logic on Finite Traces</article-title>
          .
          <source>In IJCAI</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. J. D. Ferna´ndez, P. Schneider,
          <string-name>
            <given-names>and J.</given-names>
            <surname>Umbrich</surname>
          </string-name>
          .
          <article-title>The DBpedia Wayback Machine</article-title>
          .
          <source>In SEMANTICS</source>
          , pages
          <fpage>192</fpage>
          -
          <lpage>195</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. J. D. Ferna´ndez, J.
          <string-name>
            <surname>Umbrich</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Polleres</surname>
            , and
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Knuth</surname>
          </string-name>
          .
          <article-title>Evaluating query and storage strategies for rdf archives</article-title>
          .
          <source>In Proceedings of the 12th International Conference on Semantic Systems</source>
          , pages
          <fpage>41</fpage>
          -
          <lpage>48</lpage>
          . ACM,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>J. D. Fernandez Garcia</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Umbrich</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Polleres</surname>
          </string-name>
          .
          <article-title>Bear: Benchmarking the efficiency of rdf archiving</article-title>
          .
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <given-names>V.</given-names>
            <surname>Fionda</surname>
          </string-name>
          and
          <string-name>
            <given-names>G.</given-names>
            <surname>Grasso</surname>
          </string-name>
          .
          <article-title>Linking historical data on the web</article-title>
          .
          <source>In ISWC Posters &amp; Demonstrations Track</source>
          , pages
          <fpage>381</fpage>
          -
          <lpage>384</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>V.</given-names>
            <surname>Fionda</surname>
          </string-name>
          and
          <string-name>
            <surname>G. Greco.</surname>
          </string-name>
          <article-title>The Complexity of LTL on Finite Traces: Hard and Easy Fragments</article-title>
          .
          <source>In AAAI</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>V.</given-names>
            <surname>Fionda</surname>
          </string-name>
          and
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Pirro`. Querying graphs with preferences</article-title>
          .
          <source>In Proceedings of the 22nd ACM international conference on Information &amp;amp; Knowledge Management</source>
          , pages
          <fpage>929</fpage>
          -
          <lpage>938</lpage>
          . ACM,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>