<!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>Yasper 1.0: Towards an RSP-QL Engine</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Riccardo Tommasini</string-name>
          <email>riccardo.tommasini@polimi.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Emanuele Della Valle</string-name>
          <email>emanuele.dellavalle@polimi.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Politecnico di Milano, DEIB</institution>
          ,
          <addr-line>Milan</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In the Stream Reasoning (SR) research, working prototypes often came along with foundational investigations. For RDF Stream Processing (RSP) in particular, RSP engines empirically proved the approach feasibility and paved the road to application design and comparative analyses. Observing these real systems highlighted their heterogeneity and fosters new foundational achievements: RSP-QL, i.e. a reference a model that explains, uni es and can be used for correctness checking and optimization of RSP approaches. In this paper, we present Yasper 1.0 a brand new RSP engine that implements RSP-QL semantics and, we hope, will foster new empirical research on RSP.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>Background</title>
      <p>
        In this section, we summarize the notions of RSP-QL [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] that are required to
understand how Yasper works.
      </p>
      <p>An RDF Stream is a sequence of pairs (Oi, ti), where ti is a non-decreasing
timestamp and Oi is either an RDF Graph or an RDF Triple.</p>
      <p>
        The time-based sliding window operator W is a Stream-to-Relation (S2R)
operator [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. It is de ned as a triple ( ; ; t0) that, starting at the timestamp t0,
de nes a series of windows of width ( ) and that slide of ( ).
      </p>
      <p>A Time-Varying Graph is a function that takes a time instant as input and
produces as output RDF Graph which is called Instantaneous RDF Graph. The
application of W on a RDF Stream S produces a Time-Varying Graph TVGW;S
that for any given time instant t at which W is de ned outputs an Instantaneous
RDF Graph, which is the result of coalescing all the RDF Graphs or triples that
the current window contains3.</p>
      <p>An streaming dataset (SDS) is an extension of SPARQL dataset4 that is
composed by: an optional default graph A0, n (n 0) named Time-Varying
Graphs, and m (m 0) named sliding windows over k (k m) data streams.</p>
      <p>An RSP-QL query is continuously evaluated against an SDS by an RSP
engine. The set ET of all the instants at which the evaluation occurs is determined
by the reporting policy of the RSP engine that executes the query. RSP-QL
de nes a reporting policy for an RSP as a combination of one or more of the
following strategies: CC Content Change { the engine reports if the content of
the current window changes{, WC Window Close { the engine reports if the
current window closes {, NC Non-empty Content { the engine reports if the the
current window is not empty {, and P Periodic { the engine reports periodically.</p>
      <p>
        The evaluation of a RSP-QL query outputs an instantaneous multiset of
solution mappings for each evaluation time instant in "ET". Relation-to-Stream
(R2S) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] operators are required to transform the instantaneous multiset into
a stream. RSP-QL comprises the following R2S operators: the RStream that
emits each solution mappings; the IStream that emits the di erence between
the current solution mappings and previous ones, and; the DStream that emits
the di erence between the previous solution mappings and the current ones.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Yet Another RDF Stream Processing Engine</title>
      <p>In this section, we introduce Yasper's architecture and how it implements
RSPQL concepts. Figure 1 shows the following Yasper's modules: Streams,
Windowing, SDS, Querying and Reasoning. Modules that expose Yasper as a REST
service are available5 but not discussed.</p>
      <p>The Stream module, Fig 1 (a), contains the classes to represent a Stream,
which is identi ed by an URI and its content. A StreamItem is identi ed by
3 The current window identi ed by W with the oldest closing time instant at t
4 https://www.w3.org/TR/rdf-sparql-query/#specifyingDataset
5 https://github.com/streamreasoning/rspservices
the triple &lt; ti; te; O &gt; where ti is the time when s entered the system
(Ingestion Time); te is the time when s occurred (Event Time) and O is a generic
representation of the data in s, i.e. for RSP either a RDF Graph or a Triple6.</p>
      <p>The Windowing module, Fig 1 (b), is based on Esper7, i.e. an open-source
Data Stream Management Systems that relies on the Event Processing
Language (EPL) and special objects called listeners that continuously receive the
EPL queries outputs. Each EPL statement together with a dedicated listener
represents a (named) time-based sliding window operator (henceforth referred
as just window operator) on a RDF stream. The windowing is performed by
means of temporal annotations of the StreamItems. Yasper works by default
using Event Time, but it can be con gured to work with Ingestion Time8.</p>
      <p>An Esper-based window operator maintains one time-varying graph. A
window operator has two alternative ways to deliver content to Time-Varying Graph:
(i) as a Snapshot { i.e. the window operator pushes to the Time-Varying Graph
the whole window content { or (ii) as Deltas { i.e. window operator pushes to
the Time-Varying Graph only the di erences between the current window and
the previous one in terms of additions and deletions. By default Yasper works in
Snapshot mode, but it can be con gured to work with Deltas. In both the ways,
the Time-Varying Graphs reactively generates a Instantaneous RDF Graph any
time the engine reports. Yasper reports the results on window close (WC)
without empty content (NC).</p>
      <p>Since the set ET is determined reading the StreamItems, at each evaluation
time instant we can identify an Instantaneous SDS to evaluate a RSP-QL query
against. A streaming dataset SDS, Fig 1 (c), can be reactively consolidated into
a set of (named) Instantaneous Graphs9 at the time t at which a Time-Varying
6 We implement O using Apache Jena 3.
7 www.espertech.com
8 Event Time does not guarantee total ordering of StreamItems
9 Slowly evolving RDF graph are represented as a (named) Time-Varying Graph too.</p>
      <p>REGISTER STREAM &lt;example&gt; AS CONSTRUCT ISTREAM f? s ?p ? og
FROM NAMED WINDOW : win1 [RANGE 5 s , SLIDE 2 s ] ON STREAM : stream1
FROM NAMED WINDOW : win2 [RANGE 5 s , SLIDE 5 s ] ON STREAM : stream2
WHERE f WINDOW ?w1 f? s ?p ? og</p>
      <p>WINDOW ?w2 f? s ?p ? og FILTER ( ?w1 != ?w2) g</p>
      <p>Listing 1.1: An example of RSP-QL Query.</p>
      <p>Graph is updated. We implemented the SDS and this mechanism by extending
Apache Jena 3 in-memory dataset.</p>
      <p>
        The Querying module, Fig 1 (d), contains the elements for query instantiation
and continuous execution. At this stage of development, Yasper accepts SELECT
and CONSTRUCT queries written in RSP-QL syntax (e.g. Listing 1.1).
Moreover, as the reader can observe in Listing 1.1, Yasper supports multi-streams
query, despite [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] does not discuss how to handle them. The following
RelationTo-Stream (R2S) operators are available R-, I- and DStream.
      </p>
      <p>Finally, the reasoning module, Fig 1 (e), allows to answer RSP-QL queries
under OWL entailment by means of Jena Rule reasoner. In the future we want
to integrate RDFox, Ontop and DL reasoners e.g. Pellet or Hermit.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusion</title>
      <p>In this paper, we presented Yasper, an RSP engine for RSP-QL queries. Yasper
adopts a generic stream representation, it can work with event time or
ingestion time and it implements multi-stream queries evaluation. At the moment of
writing, Yasper supports SELECT and CONSTRUCT queries. ASK support is
a work in progress, while DESCRIBE requires further investigations for RSP.
We plan to support all the reporting Policies in Yasper, either by con guration
or as an extension of the proposed syntax.</p>
      <p>
        Finally, we plan to perform an empirical evaluation [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] that compares Yasper
architectural con gurations and the existing RSP engine implementations.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Arasu</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Babu</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Widom</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>The CQL continuous query language: semantic foundations and query execution</article-title>
          .
          <source>VLDB J</source>
          .
          <volume>15</volume>
          (
          <issue>2</issue>
          ),
          <volume>121</volume>
          {
          <fpage>142</fpage>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Dell'Aglio</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Calbimonte</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Della</given-names>
            <surname>Valle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Corcho</surname>
          </string-name>
          ,
          <string-name>
            <surname>O.</surname>
          </string-name>
          :
          <article-title>Towards a uni ed language for RDF stream query processing</article-title>
          .
          <source>In: ESWC 2015 Satellite Events Portoroz</source>
          , Slovenia, May 31 - June 4,
          <year>2015</year>
          , Revised Selected Papers. pp.
          <volume>353</volume>
          {
          <issue>363</issue>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Dell'Aglio</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Della</given-names>
            <surname>Valle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Calbimonte</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Corcho</surname>
          </string-name>
          ,
          <string-name>
            <surname>O.</surname>
          </string-name>
          :
          <article-title>RSP-QL semantics: A unifying query model to explain heterogeneity of RDF stream processing systems</article-title>
          .
          <source>Int. J. Semantic Web Inf. Syst</source>
          .
          <volume>10</volume>
          (
          <issue>4</issue>
          ),
          <volume>17</volume>
          {
          <fpage>44</fpage>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>DellAglio</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Della</given-names>
            <surname>Valle</surname>
          </string-name>
          , E.,
          <string-name>
            <surname>van Harmelen</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bernstein</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Stream reasoning: A survey and outlook</article-title>
          .
          <source>Data Science (Preprint)</source>
          ,
          <volume>1</volume>
          {
          <fpage>24</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Tommasini</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Della</given-names>
            <surname>Valle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Balduini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Dell'Aglio</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          :
          <article-title>Heaven: A framework for systematic comparative research approach for RSP engines</article-title>
          .
          <source>In: The 13th International ESWC</source>
          , Heraklion, Crete, Greece,
          <year>2016</year>
          , Proceedings. pp.
          <volume>250</volume>
          {
          <issue>265</issue>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>