<!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>INSTANS: High-Performance Event Processing with Standard RDF and SPARQL</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Mikko Rinne</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Esko Nuutila</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Seppo Torma</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science and Engineering, Aalto University, School of Science</institution>
          ,
          <country country="FI">Finland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Smart environments require collaboration of multi-platform sensors operated by multiple parties. Proprietary event processing solutions lack interoperation exibility, leading to overlapping functions that can waste hardware and communication resources. Our goal is to show the applicability of standard RDF and SPARQL { including SPARQL 1.1 Update { for complex event processing tasks. If found feasible, event processing would enjoy the bene ts of semantic web technologies: crossdomain interoperability, exible representation and query capabilities, interrelating disjoint vocabularies, reasoning over event content, and enriching events with linked data. To enable event processing with standard RDF/SPARQL we have created Instans, a high-performance Rete-based platform for continuous execution of interconnected SPARQL queries.</p>
      </abstract>
      <kwd-group>
        <kwd>Rete</kwd>
        <kwd>SPARQL</kwd>
        <kwd>RDF</kwd>
        <kwd>Complex event processing</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Complex event processing is currently more dominated by proprietary systems
and vertical products than open technologies. In the future, however,
internetconnected people and things moving between smart spaces in smart cities will
create a huge volume of events in a multi-actor, multi-platform environment.</p>
      <p>Semantic web technologies enable exible representation of events in RDF
and advanced speci cation of event patterns with SPARQL. They provide
possibilities to reason about event content and to enrich events with linked open data
available in the web. Semantic web standards have clear potential to improve
the interoperability and o er new capabilities in complex event processing.</p>
      <p>
        A major event processing application can hardly be created out of a single
SPARQL query. The INSERT operation in SPARQL 1.1 Update introduced a
critical new property: By inserting data into a graph, collaborating SPARQL
queries can store intermediate results and communicate with each other. On an
environment supporting simultaneous, continuous evaluation of multiple queries,
SPARQL can be used to create entire event processing applications [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        After nding no other platform for incremental processing of multiple SPARQL
1.1 queries, we created Instans. Based on the tried and tested Rete-algorithm
[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], Instans shares equivalent parts of queries, caches intermediate matches
and provides results immediately, when all the conditions of a query have been
matched. In addition to being competitive in SPARQL query processing [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], our
studies show qualitative and quantitative bene ts compared to SPARQL-based
systems using repeated execution of queries over windows on event streams [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        Here we extend the discussion in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] by adding further information on the
Instans implementation of continuous incremental SPARQL query processing.
2
      </p>
      <p>INSTANS Event Processing Platform</p>
      <p>
        Instans1 [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] is an incremental engine for near-real-time processing of
complex, layered, heterogeneous events. Based on the Rete-algorithm [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], Instans
performs continuous evaluation of incoming RDF data against multiple SPARQL
queries. Intermediate results are stored into a -node network. When all the
conditions of a query are matched, the result is instantly available.
      </p>
      <p>The structure of Instans is illustrated in Fig. 1. The system consists of the
Rete engine and the input and output connectors, which can interface with the
network, triple stores, les or other processes. The Rete engine has four
components: 1. Rete network, 2. -matcher, 3. Rule instance queue, 4. Instance
executor. The -matcher and the Rete network are capable of nding all SPARQL rule
conditions satisfying the current set of triples. During runtime the -matcher
receives commands to add and remove triples. The matcher nds the -nodes of
the Rete that match the triples and calls the add or remove methods of those
nodes. The changes propagate through the -network and eventually fully
satis ed rule conditions enter the rule nodes, which add new rule instances (with
1 Incremental eNgine for STANding Sparql, http://cse.aalto. /instans/
variable bindings) to the rule instance queue. The instance executor executes the
rule instances, which causes add and remove triple commands to be fed into the
output connectors. The rule instance execution also feeds add and remove triple
commands to the -matcher, resulting in new rule instances. Instans operation
over an example query is illustrated in Fig. 2. The query selects events occurring
between 10 and 11 am. The asynchronous nature of Instans means that all input
!1
"1: ! a event:event
"2: ! event:time !</p>
      <p>"3: ! tl:at !
1  
3  </p>
      <p>
        5  
?time, ?daytime
is processed when it arrives. To manage periodic actions and missing events, the
concept of timed events is introduced [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. When a new timer is started, an actor
is used to schedule wakeup, at which time a predicate of the timer is changed. A
Y1
?event
2  
?event
      </p>
      <p>!2
Query:  
 
SELECT  ?event  
WHERE  {  
   ?event  a  event:Event  ;  
                         event:7me  ?7me  .  
   ?7me  tl:at  ?day7me  .  
   FILTER  (  hours(?day7me)  =  10  )    }  
Process  flow:  
 
①  Each  condi7on  corresponds  to  an  α-­‐node.  α1  matches  </p>
      <p>with  sample  input  “:e1  a  event:Event”.  
②   “:e1”  propagates  to  β2  and  is  stored  there.  
③   α2  matches  with  “:e1  event:,me  _:b1”,  where  “_:b1”  
is  a  blank  node.  Input  from  β2  matches  with  “?event”  
in  Y2.  
④   “:e1”  and  “_:b1”  propagate  un7l  β3.  
⑤   α3  matches  with  input  “_:b1  tl:at  </p>
      <p>“2011-­‐10-­‐03T10:05:00”ˆˆxsd:dateTime”.  
⑥  In  Y3  “_:b1”  is  equal  in  both  incoming  branches  and  </p>
      <p>can  be  eliminated.  
⑦   “:e1”  and  “2011-­‐10-­‐03T10:05:00”ˆˆxsd:dateTime  </p>
      <p>reach  filter1.  The  condi7on  “hour  =  10”  is  true.  
⑧   “:e1”  is  selected  as  a  result.  </p>
      <p>:e1  
?event</p>
      <p>Y2
4  </p>
      <p>?event, ?time
?event, ?time
!3</p>
      <p>:e1  _:b1  
?event, ?time
6  
7  
8  </p>
      <p>Y3
filter1</p>
      <p>?event
select1
?event, ?daytime</p>
      <p>Drop  _:b1  
:e1  10:05  
SPARQL query matching such a triple reacts to the change and carries out the
de ned actions. No extensions to SPARQL are needed to support timed events.</p>
      <p>
        Performance of Instans in terms of noti cation delay was compared to
CSPARQL [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] using an example application described in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Instans yielded
average noti cation delays of 12 ms on a 2.26 GHz Intel Core 2 Duo Mac. In
CSPARQL average query processing delay varied between 12 - 253 ms for window
sizes of 5-60 events, respectively, resulting in the window repetition rate being
the dominant component of the noti cation delay for any window repetition
rate longer than a second. Using repetition rates of 5-60 seconds with 1 event
per second inter-arrival time C-SPARQL noti cation delay was measured at
1.34-25.90 seconds. Further details are available on the Instans project website.
Comparison with CQELS [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] is waiting for the availability of a generic version.
3
      </p>
    </sec>
    <sec id="sec-2">
      <title>Conclusions</title>
      <p>The feasibility of the central paradigm of Instans { continuous incremental
matching of multiple SPARQL queries supporting inter-query communication {
has so far been supported by empirical tests. When complemented with support
for timed events, we have found no showstopper problems which would render
the approach unusable for any complex event processing task.</p>
      <p>The performance of Instans is higher compared to systems based on
repeated execution of queries at xed time intervals (or triple counts); they cannot
practically compete with Instans whose noti cation delays are in the order of
milliseconds. Instans avoids redundant computation: each event is processed
immediately on arrival and only once through the Rete network, network
structures are shared across similar queries, and intermediate results are memorized.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Abdullah</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Torma,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Nuutila</surname>
          </string-name>
          , E.:
          <article-title>E cient matching of SPARQL subscriptions using Rete</article-title>
          .
          <source>In: Proceedings of the 27th Symposium On Applied Computing (Mar</source>
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Barbieri</surname>
            ,
            <given-names>D.F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Braga</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ceri</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grossniklaus</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>An execution environment for C-SPARQL queries</article-title>
          .
          <source>In: Proceedings of the 13th International Conference on Extending Database Technology - EDBT '10</source>
          . p.
          <fpage>441</fpage>
          .
          <string-name>
            <surname>Lausanne</surname>
          </string-name>
          ,
          <string-name>
            <surname>Switzerland</surname>
          </string-name>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Forgy</surname>
            ,
            <given-names>C.L.</given-names>
          </string-name>
          :
          <article-title>Rete: A fast algorithm for the many pattern/many object pattern match problem</article-title>
          .
          <source>Arti cial Intelligence</source>
          <volume>19</volume>
          (
          <issue>1</issue>
          ),
          <volume>17</volume>
          {37 (Sep
          <year>1982</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Le-Phuoc</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dao-Tran</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Parreira</surname>
            ,
            <given-names>J.X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hauswirth</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>A native and adaptive approach for uni ed processing of linked streams and linked data</article-title>
          .
          <source>In: ISWC'11</source>
          . pp.
          <volume>370</volume>
          {
          <fpage>388</fpage>
          . Springer-Verlag Berlin (Oct
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>DC Short Paper: SPARQL Update for Complex Event Processing</article-title>
          .
          <source>In: ISWC 2012</source>
          . Springer-Verlag, Boston, MA (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Abdullah</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          , Torma,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Nuutila</surname>
          </string-name>
          , E.:
          <article-title>Processing Heterogeneous RDF Events with Standing SPARQL Update Rules</article-title>
          . In: Meersman,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Dillon</surname>
          </string-name>
          , T. (eds.)
          <article-title>OTM 2012 Conferences, Part II</article-title>
          . pp.
          <volume>793</volume>
          {
          <fpage>802</fpage>
          . Springer-Verlag (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Rinne</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Torma,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Nuutila</surname>
          </string-name>
          , E.:
          <article-title>SPARQL-Based Applications for RDF-Encoded Sensor Data</article-title>
          .
          <source>In: 5th International Workshop on Semantic Sensor Networks</source>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>