<!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>PIOTRe: Personal Internet of Things Repository</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Eugene Siow</string-name>
          <email>eugene.siow@soton.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Thanassis Tiropanis</string-name>
          <email>t.tiropanis@soton.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Wendy Hall</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Electronics &amp; Computer Science, University of Southampton</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>Resource-constrained Internet of Things (IoT) devices like Raspberry Pis', with specific performance optimisation, can serve as interoperable personal Linked Data repositories for IoT applications. In this demo paper we describe PIOTRe, a personal datastore that utilises our sparql2sql query translation technology on Pis' to process, store and publish IoT time-series historical data and streams. We demonstrate with PIOTRe in a smart home scenario: a real-time dashboard that utilises RDF stream processing, a set of descriptive analytics visualisations on historical data, a framework for registering stream queries within a local network and a means of sharing metadata globally with HyperCat and Web Observatories.</p>
      </abstract>
      <kwd-group>
        <kwd>SPARQL</kwd>
        <kwd>SQL</kwd>
        <kwd>RSP</kwd>
        <kwd>Query Translation</kwd>
        <kwd>Internet of Things</kwd>
        <kwd>Analytics</kwd>
        <kwd>Web Observatory</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>1. A real-time smart home dashboard that utilises sparql2stream’s RDF stream
processing to update widgets with push results via web sockets.
2. A smart home visualisation application that uses a set of SPARQL queries
with space-time aggregations, translated by sparql2sql, on historical data.
3. A lightweight client-broker-server architecture that supports registering stream
queries and delivering results on an offline local network.
4. A means of publishing and sharing metadata and mappings online as
HyperCat or with decentralised catalogues known as Web Observatories.</p>
      <sec id="sec-1-1">
        <title>1 https://github.com/eugenesiow/piotre</title>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>PIOTRe Design and Architecture</title>
      <p>PIOTRe is designed to run on a compact and mobile lightweight computer
like a Raspberry Pi (it has also been tested on an x86 Gizmo22). PIOTRe consists
of a number of components as shown in Fig. 1. Sensors produce time-series data
that forms a set of input data streams to the system.</p>
      <p>Data streams, enter an event stream for processing and are stored in a
historical relational store. Each stream forms a table in the store. PIOTRe uses H23
as a default relational store and Esper4 as an event stream processing engine.
H2 can be replaced by a relational database or column store that supports SQL.</p>
      <p>sparql2sql and sparql2stream work on top of the historical store and event
stream respectively. Mappings are shared across the engines and are a
representation of how RDF maps to columns in relational tables or a field of an event
in a stream. A SPARQL endpoint uses the sparql2sql engine to translate
incoming SPARQL queries to SQL, execute the query on the relational store and
return the result set in the appropriate format. The UNified IoT Environment
(UNIoTE) Server is part of a client-broker-server architecture to allow streaming
SPARQL queries to be registered with the sparql2stream engine. The engine in
turn translates queries to EPL, registers them with the underlying event stream
and sends results to requesting clients. UNIoTE is described in Section 4.</p>
      <p>Apps in PIOTRe have the flexibility of being written in any language and
framework and communicate with the SPARQL Endpoint and UNIoTE Server
through HTTP, although underlying the UNIoTE server are ZeroMQ sockets5.</p>
      <p>The metadata publishing component publishes the metadata from mappings,
like the sensor descriptions, locations, data fields and formats to support global
discovery and interoperability. It is described in more detail in Section 5.</p>
      <sec id="sec-2-1">
        <title>2 http://www.gizmosphere.org/products/gizmo-2/</title>
      </sec>
      <sec id="sec-2-2">
        <title>3 http://www.h2database.com</title>
      </sec>
      <sec id="sec-2-3">
        <title>4 http://www.espertech.com/</title>
      </sec>
      <sec id="sec-2-4">
        <title>5 http://zeromq.org/</title>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Example Applications using PIOTRe</title>
      <p>IoT Freeboard6 is a real-time dashboard that consists of a simulator that replays
a stream of smart home data at a variable rate to PIOTRe and a web
application dashboard that receives the output from the set of registered push-based
streaming SPARQL queries as a web socket events stream. Each result in the
stream consists of the query name it was generated by and fields of the result set
e.g. {"queryName":"averagePower","averagePower":"10.5","uom":"W"}. A
host of widgets can be added to the dashboard to visualise these events. A demo
video is available7.</p>
      <p>Pi-SmartHome8 is an application that uses SPARQL queries on historical
smart home data to provide visualisations across time and space. The queries
are as follows: 1) hourly aggregation of temperature, 2) daily aggregation of
temperature, 3) hourly and room-based aggregation of energy usage and 4)
diagnosis of unattended devices through energy usage and motion, aggregating by
hour and room. The application allows the user to tweak the days and months
as parameters to the SPARQL queries and generate and compare graph
visualisations. A demo video9 and online demo are available.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Lightweight Local, Offline Client-Broker-Server</title>
      <p>In some IoT scenarios like disaster management or environmental monitoring in
remote locations, local, offline networks of devices are necessary. The UNified
IoT Environment’s10 (UNIoTE) client-broker-server architecture enables stream
queries to be registered and results to be delivered to devices. A publish-subscribe
mechanism based on lightweight ZeroMQ sockets are used. Servers subscribe to
URIs and clients publish queries (with URIs in the FROM clause) facilitated
by brokers with known addresses. As shown in Fig. 1 a UNIoTE server uses a
sparql2stream engine to translate and register queries. Results are then delivered
directly to all requesting clients through push-pull sockets.</p>
      <sec id="sec-4-1">
        <title>6 https://github.com/eugenesiow/iotwo</title>
      </sec>
      <sec id="sec-4-2">
        <title>7 https://youtu.be/oH0iSWTmKUg</title>
      </sec>
      <sec id="sec-4-3">
        <title>8 https://github.com/eugenesiow/ldanalytics-PiSmartHome</title>
      </sec>
      <sec id="sec-4-4">
        <title>9 https://youtu.be/g8FLr974v9o</title>
        <p>10 https://github.com/eugenesiow/uniote-broker</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Observatories and Online Metadata Sharing</title>
      <p>
        The Web Observatory Project is developing a global decentralised, distributed
infrastructure that allows the use and exchange of datasets, analytical apps and
visualisations [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Web Observatory instances exist as collections of datasets and
analytical tools protected by access controls. The principles espoused by the Web
Observatory as a distributed infrastructure are a possible solution for managing
datasets and apps in the IoT. By sharing metadata of IoT datasets and providing
the Observatory access through the SPARQL endpoint, PIOTRe systems, when
online, are able to support apps which use globally distributed data sources
across Observatory instances securely.
      </p>
      <p>HyperCat11 is a complementary catalogue for exposing collections of uniform
resource identifiers (URLs) that refer to IoT assets over the web. PIOTRe
systems connected to various sensors, devices and things, publish metadata of these
from mappings with a HyperCat server when online, increasing interoperability.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Siow</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tiropanis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hall</surname>
          </string-name>
          , W.:
          <article-title>SPARQL-to-SQL on Internet of Things Databases and Streams</article-title>
          .
          <source>In: Proceedings of 15th International Semantic Web Conference (ISWC2016)</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Tiropanis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hall</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hendler</surname>
            , J., de Larrinaga,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>The Web Observatory: A Middle Layer for Broad Data</article-title>
          .
          <source>Big Data</source>
          <volume>2</volume>
          (
          <issue>3</issue>
          ),
          <fpage>129</fpage>
          -
          <lpage>133</lpage>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>