<!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>Querying Dynamic Datasources with Continuously Mapped Sensor Data?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ruben Taelman</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Pieter Heyvaert</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ruben Verborgh</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Erik Mannens</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Data Science Lab, Ghent University - iMinds</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>The world contains a large amount of sensors that produce new data at a high frequency. It is currently very hard to find public services that expose these measurements as dynamic Linked Data. We investigate how sensor data can be published continuously on the Web at a low cost. This paper describes how the publication of various sensor data sources can be done by continuously mapping raw sensor data to rdf and inserting it into a live, low-cost server. This makes it possible for clients to continuously evaluate dynamic queries using public sensor data. For our demonstration, we will illustrate how this pipeline works for the publication of temperature and humidity data originating from a microcontroller, and how it can be queried.</p>
      </abstract>
      <kwd-group>
        <kwd>Linked Data</kwd>
        <kwd>Linked Data Fragments</kwd>
        <kwd>rml</kwd>
        <kwd>sparql</kwd>
        <kwd>dynamic data</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>
        Countless sensors that are connected to the Internet produce various streams of continuous
data. Even though there are many sensors, no public interfaces are available which these
measurements can be consumed as dynamic Linked Data [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], which is essential when
these measurements need to be linked to related information.
      </p>
      <p>
        Dynamic Linked Data can be published through rdf Stream Processing (rsp) query
engines, like c-sparql [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and cqels [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. These rsp query engines are used to publish this
sensor data using an extended sparql [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] endpoint that enables continuous querying over
this data. These engines require expensive machines to host such data on the Web, because
queries can be complex, are continuous and originate from an unlimited number of
clients. These expensive solutions limit the development of sensor-based applications [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>
        In this work, we present a continuous pipeline for publishing dynamic sensor data
using a low-cost Triple Pattern Fragments (tpf) [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] server. This publication makes it
possible for evaluating queries continuously at the client using a tpf Query Streamer [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
In order to demonstrate this pipeline, we publish and query the continuous data from a
temperature and humidity sensor. In the demonstration, we will show the different steps
conducted on the data, starting from the raw measurements until the final query results.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Architecture</title>
      <p>
        Our continuous pipeline for publishing sensor data consists of a data reader, mapper and
publisher. These components connect a sensor with a dynamic data source, as can be seen
in Fig. 1. The reader receives data from a sensor. The mapper converts this data to rdf
using the rdf Mapping Language (rml) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Finally, the publisher inserts the dynamic
rdf triples into a tpf server. These three components will be explained hereafter.
      </p>
      <sec id="sec-2-1">
        <title>Sensor</title>
      </sec>
      <sec id="sec-2-2">
        <title>Reader</title>
      </sec>
      <sec id="sec-2-3">
        <title>Mapper</title>
      </sec>
      <sec id="sec-2-4">
        <title>Publisher</title>
      </sec>
      <sec id="sec-2-5">
        <title>Data source</title>
        <p>
          For this demonstration, we use a Tessel1 microcontroller to capture sensor data from
the environment. Tessel provides a Node.js2 module that can be used to listen to sensor
measurements from the device using JavaScript events. json objects are emitted for each
measurement at a configurable rate. These objects contain all required data to describe
each measurement.
The mapper component [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] is responsible for converting the json output that it receives
from the reader component to rdf. This conversion is done using the rmlmapper3. For
each measurement, the rmlmapper reads the rml mapping file, maps the json object to
rdf and forwards the result to the publisher component. The mapping file depends on the
type of sensor that is being used, because not all sensors output the same data in the same
structure and format and the data is not necessarily annotated using the same ontologies.
For the final step in the continuous pipeline, the publisher component takes the
measurement data in rdf and converts it to dynamic data. The publisher does this by adding
a time annotation to it, as we described in previous work [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. We chose to represent
our time annotations as expiration times and we only keep the latest version of each
measurement, because for this demonstration only the latest sensor measurements are
needed. Our system alternatively also supports storing all measurement versions, which
enables historical analysis. We serialized our annotations as rdf graphs [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], because
we showed that this is the most efficient method for time annotation [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. Finally, each
time-annotated measurement is inserted into the tpf server and the previous measurement
for that sensor is removed.
1 https://tessel.io/
2 https://nodejs.org/
3 https://github.com/RMLio/RML-Mapper
We used our pipeline to publish data that is being created by a Tessel sensor that reads
temperature and humidity data. The reader component starts by emitting measurements
in json, like the following.
        </p>
        <p>{ "humidity" : { "value":47.0815124512 },
"device" : "TM-00-04-f000da30-0062473d-20a82586",
"module" : "climate",
"temperature": { "value":30.0167749023 } }
In order to add semantical value to the measurements, the mapper component maps each
json object to rdf.</p>
        <p>
          &lt;http://www.example.com/TM-00-04-f000da30-0062473d-20a82586&gt;
a &lt;https://w3id.org/saref#Sensor&gt; ;
&lt;http://vocab.datex.org/terms#humidity&gt; "47.0815124512"^^xsd:double ;
&lt;http://dbpedia.org/ontology/temperature&gt; "30.0167749023"^^xsd:double .
Next, the triples are time-annotated by the publisher component to make the triples valid
up until a certain time. This is represented with the TriG [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] serialization.
_:g12 {
&lt;http://www.example.com/TM-00-04-f000da30-0062473d-20a82586&gt;
a &lt;https://w3id.org/saref#Sensor&gt; ;
&lt;http://vocab.datex.org/terms#humidity&gt; "47.0815124512"^^xsd:double ;
&lt;http://dbpedia.org/ontology/temperature&gt; "30.0167749023"^^xsd:double .
}
_:g12 &lt;http://example.org/temporal#expiration&gt; "2016-06-27T09:48:47.808Z"^^&lt;
xsd:dateTimeStamp&gt; .
        </p>
        <p>After the data is published, it can be consumed by clients. We use the client-side tpf
Query Streamer to continuously evaluate the following sparql query in order to fetch
the published measurements from our pipeline.</p>
        <p>PREFIX dat: &lt;http://vocab.datex.org/terms#&gt;
PREFIX saref: &lt;https://w3id.org/saref#&gt;
PREFIX dbp: &lt;http://dbpedia.org/ontology/&gt;
SELECT ?temperature ?humidity WHERE {
?sensor a saref:Sensor;
dat:humidity ?humidity;
dbp:temperature ?temperature.</p>
        <p>}
This query selects the temperature and humidity data from all sensors. The tpf Query
Streamer is able to interpret this query as being dynamic, so it will automatically
re-evaluate the query from the moment new measurements become available. The query
can for example show the following intermediary result.</p>
        <p>Temperature: "30.0167749023"</p>
        <p>Humidity: "47.0815124512"
These continuously updating query results could, instead of printing it as text, be used as
input to various types of applications.</p>
        <p>During the demo, we will show the different steps conducted on temperature and
humidity data measurements by the different components of the pipeline and the query
results. These steps will be shown as continuously updating log outputs for each
component. The Tessel microcontroller will be part of the demonstration, this will make
it possible for users to modify the temperature or humidity and immediately see the
changes in the query output. We recorded a screencast4 containing these live logs for
temperature and humidity data. The source code of our pipeline prototype can be found
at https://github.com/mmlab/demo-tessel-continuous-datasource.</p>
        <p>The demonstration illustrates the simplicity of hosting any kind of sensor data using
this technique. For future work, this solution can be improved and extended to support
all kinds of sensors and sensor streams. The pipeline could be extended to support
composing different pipelines and streams in order to create more complex dynamic data.</p>
        <p>With this demonstration we aim to show that publishing dynamic Linked Data does
not have to be complex or costly. We hope to trigger more efforts for making dynamic data
publicly available, in order to promote the development of more dynamic applications.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <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>Valle</surname>
            ,
            <given-names>E.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grossniklaus</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Querying rdf streams with c-sparql</article-title>
          .
          <source>SIGMOD Rec</source>
          .
          <volume>39</volume>
          (
          <issue>1</issue>
          ),
          <fpage>20</fpage>
          -
          <lpage>26</lpage>
          (
          <year>Sep 2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Berners-Lee</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Linked Data (July</article-title>
          <year>2006</year>
          ), http://www.w3.org/DesignIssues/LinkedData. html
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bizer</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cyganiak</surname>
          </string-name>
          , R.:
          <source>rdf 1</source>
          .1 TriG. Rec.,
          <source>W3C (Feb</source>
          <year>2014</year>
          ), https://www.w3.org/TR/trig/
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Corcho</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>García-Castro</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          :
          <article-title>Five challenges for the Semantic Sensor Web</article-title>
          .
          <source>Semantic Web</source>
          <volume>1</volume>
          (
          <issue>1</issue>
          , 2),
          <fpage>121</fpage>
          -
          <lpage>125</lpage>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Cyganiak</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wood</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lanthaler</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <article-title>: rdf 1.1: Concepts and abstract syntax</article-title>
          .
          <source>Recommendation, W3C (Feb</source>
          <year>2014</year>
          ), http://www.w3.org/TR/2014/REC-rdf11
          <string-name>
            <surname>-</surname>
          </string-name>
          concepts-20140225/
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Dimou</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vander</surname>
            <given-names>Sande</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Colpaert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            ,
            <surname>Verborgh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Mannens</surname>
          </string-name>
          , E., Van de Walle, R.:
          <article-title>rml: A generic language for integrated rdf mappings of heterogeneous data</article-title>
          .
          <source>In: LDOW</source>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Feigenbaum</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Todd Williams</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Grant</given-names>
            <surname>Clark</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            ,
            <surname>Torres</surname>
          </string-name>
          , E.:
          <article-title>sparql 1.1 protocol</article-title>
          . Rec.,
          <source>W3C (Mar</source>
          <year>2013</year>
          ), http://www.w3.org/TR/2013/REC-sparql11
          <string-name>
            <surname>-</surname>
          </string-name>
          protocol-20130321/
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Heyvaert</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Taelman</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Verborgh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mannens</surname>
          </string-name>
          , E.:
          <article-title>Linked Sensor Data generation using queryable rml mappings</article-title>
          .
          <source>In: Proceedings of the 2016 International Semantic Web Conference Posters &amp; Demonstrations Track</source>
          (
          <year>2016</year>
          ), accepted for publication
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <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 unified processing of linked streams and Linked Data</article-title>
          .
          <source>In: The Semantic Web-ISWC</source>
          <year>2011</year>
          , pp.
          <fpage>370</fpage>
          -
          <lpage>388</lpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Taelman</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Verborgh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Colpaert</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mannens</surname>
          </string-name>
          , E., Van de Walle, R.:
          <article-title>Continuously updating query results over real-time Linked Data</article-title>
          .
          <source>In: Proceedings of the 2nd Workshop on Managing the Evolution and Preservation of the Data Web (May</source>
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Verborgh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Vander</given-names>
            <surname>Sande</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Hartig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            ,
            <surname>Van Herwegen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>De Vocht</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            ,
            <surname>De Meester</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            ,
            <surname>Haesendonck</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Colpaert</surname>
          </string-name>
          ,
          <string-name>
            <surname>P.</surname>
          </string-name>
          :
          <article-title>Triple Pattern Fragments: a low-cost knowledge graph interface for the Web</article-title>
          .
          <source>Journal of Web Semantics 37-38</source>
          ,
          <fpage>184</fpage>
          -
          <lpage>206</lpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>