<!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>Demo paper: Tablet-based visualization of transportation data in Madrid using SPARQLStream</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jean-Paul Calbimonte</string-name>
          <email>jp.calbimonte@upm.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alejandro Fernández-Carrera</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Oscar Corcho</string-name>
          <email>ocorcho@fi.upm.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Ontology Engineering Group, Universidad Politécnica de Madrid</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this demo paper we describe an iOS-based application that allows visualizing live bus transport data in Madrid from static and streaming RDF endpoints, reusing the Web services provided by the bus transport authority in the city and wrapping them using SPARQLStream. Data from public administration and services in countries, regions and cities are increasingly made publicly available. However, most of this data is produced and exposed in very heterogeneous formats, represented in di erent models and deployed under diverse technologies. While developers can take advantage of this data, the time taken in understanding the models and formats constitutes a barrier to enable the integration of the di erent data sources needed for a given application. The use of standard vocabularies and data models such as RDF and query languages as SPARQL have proven to be helpful to overcome this semantic heterogeneity. This is also the case with public transportation data in a large city such as Madrid. The local bus transport authority, EMT, provides a set of web services1 that allow retrieving information such as the bus stops, bus lines, routes, stop locations, and other mainly static data. The data is returned by these services as XML documents. For example the following XML response in Listing 1.1 provides the details about a bus stop.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>that can be seen as data streams. Moreover, most RDF stream processing engines lack
the flexibility of defining mappings between the source schemas and the ontological
schema. Of these, only SPARQLStream supports using declarative R2RML mappings3
for doing so. Furthermore, current implementations of RDF stream query engines are
hard to access for end-user applications.</p>
      <p>In this demo we show how we enabled an iOS tablet application to access both
the static and dynamic data from the city of Madrid, and in particular the data from
the EMT web services. We showcase the use of an RDF stream SPARQL endpoint
(using the Morph-streams4 implementation of SPARQLStream), that can be accessed by
the client application in the same way it accesses a static SPARQL endpoint.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Architecture &amp; Implementation</title>
      <p>
        The architecture of the system is the following (Figure 1): the client application is a
Tablet iOS App that requests static data from a SPARQL endpoint that contains Bus
station data including name, geo-location, etc. With this data, the App can display the
bus stops in a Google Map. The App can also send queries and receive results from a
live SPARQLStream endpoint that provides data about the reported waiting times in each
bus stop. The endpoint is implemented using Morph-streams, that serves virtual RDF
streams through SPARQLStream continuous queries.
The SPARQLStream endpoint runs a live virtual RDF stream that is directly fed from
the Madrid EMT web services. SPARQLStream was first introduced in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], and has
been inspired by previous proposals of streaming-oriented extensions of SPARQL,
mainly C-SPARQL[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. SPARQLStream is based on the concept of virtual RDF streams
of triples that can be continuously queried, and whose elements can be bounded
using sliding windows. The SPARQLStream syntax follows closely that of SPARQL 1.1,
adding window constructs for RDF stream graphs and additional solution modifiers.
3 R2RML W3C Recommendation: http://www.w3.org/TR/r2rml/
4 Morph-streams: https://github.com/jpcik/morph-streams
In SPARQLStream, each virtual RDF stream graph is identified by an IRI, so that it can
be used or referenced elsewhere in the query, and time windows of the form [start
TO end SLIDE slide] can be applied to it. As an example, the query in Listing 1.2
requests the bus waiting times per stop reported in the last 5 minutes, from the http:
//emt.linkeddata.es/data#busstops.srdf stream graph.
      </p>
      <p>PREFIX ssn: &lt;http://purl.oclc.org/NET/ssnx/ssn#&gt;
PREFIX qudt: &lt;http://data.nasa.gov/qudt/owl/qudt#&gt;
PREFIX emt: &lt;http://emt.linkeddata.es/data#&gt;
SELECT ?waittime ?obs ?stop
FROM NAMED STREAM &lt;http://emt.linkeddata.es/data#busstops.srdf&gt; [NOW - 300 S]
WHERE {
?obs a emt:BusObservation;
ssn:observedBy ?stop.</p>
      <p>ssn:observationResult ?result.
?result emt:timeToBusValue ?av.</p>
      <p>?av qudt:numericValue ?waittime.</p>
      <p>}
Listing 1.2. SPARQLStream query requesting waiting times reported in the latest 5 min.
2.2</p>
      <sec id="sec-2-1">
        <title>R2RML Mappings</title>
        <p>
          As we stated before, RDF streams in the system are virtual, so we use mappings to
relate the ontological terms of the SPARQLStream queries to the schema of the original
EMT stream. for this, Morph-streams uses an R2RML set of mappings, as described
in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. For example, the following mappings show how to relate the TimetoBusValue
ontological concept with the EMT stream (including how to construct the URI).
:timeToBusValue a rr:TriplesMap; rr:logicalTable :emtStream;
rr:subjectMap [ rr:template "http://transporte.linkeddata.es/emt/busstop/id/{stopid}/
busline/{lineid}/timeToBusValue/{timed}";
rr:class emt:TimeToBusValue; rr:graph emt:busstops.srdf ];
rr:predicateObjectMap [rr:predicate qudt:numericValue;
rr:objectMap [rr:column "timetobus"]];.
        </p>
        <p>Listing 1.3. R2RML sample mappings.
2.3</p>
      </sec>
      <sec id="sec-2-2">
        <title>The Tablet application</title>
        <p>The Map4RDF iOS App is designed as a general purpose RDF-based application for
mobile devices, implemented in Objective-C and targeted to display geo-referenced
information from SPARQL endpoints. In this way, the developer needs only to provide the
suitable SPARQL queries that fulfill his data needs, and get the results in JSON format.
In a first stage the App identifies data categories in a static SPARQL endpoint that can
be displayed in a map (e.g. instances of emt:BusStop). The App is able to recognize
latitude-longitude coordinates using the WGS84 Geo Positioning vocabulary5 and also
WKT points and polygons. The App already has implemented usual features such as
layering, bounding box views, clustering of visualized points, etc. that can be applied
to the visualized points.</p>
        <p>Once the geo-referenceable instances are identified (through their URIs), the App
can be configured to retrieve more information from each of these instances when the
user clicks over it. In the case of the Bus stop application, it can retrieve the stop name
5 http://www.w3.org/2003/01/geo/wgs84_pos#
and description from a static SPARQL endpoint, and the bus waiting times from a
streaming SPARQLStream endpoint. For instance, the App can easily display a bus route
in the map as in Figure 2. The App also natively recognizes statistical data if available
in the RDF dataset (supports the RDF Data Cube Vocabulary6). One of the key
features of Map4RDF is that the data retrieval is entirely configurable by the developer, by
specifying the SPARQL and SPARQLStream queries and endpoints.</p>
        <p>The App is able to relate the static data and the dynamic data thanks to the URIs
that link both datasets: e.g. A Bus stop URI in the static endpoint, is referenced by a
bus waiting time observation in the streaming endpoint. In this way if the user clicks
on a bus stop, a query is launched against the SPARQLStream endpoint, requesting the
current waiting times for the stop represented by that URI (Figure 2).</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Acknowledgements</title>
      <p>This work has been supported by the PlanetData FP7 257641 Project. We thank EMT
Madrid for providing access to their data services.
6 http://www.w3.org/TR/vocab-data-cube/</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Calbimonte</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Corcho</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gray</surname>
            ,
            <given-names>A.J.G.</given-names>
          </string-name>
          :
          <article-title>Enabling ontology-based access to streaming data sources</article-title>
          .
          <source>In: Proc. 9th International Semantic Web Conference</source>
          . (
          <year>2010</year>
          )
          <fpage>96</fpage>
          -
          <lpage>111</lpage>
        </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>Della Valle</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grossniklaus</surname>
          </string-name>
          , M.:
          <string-name>
            <surname>C-SPARQL</surname>
          </string-name>
          :
          <article-title>A continuous query language for RDF data streams</article-title>
          .
          <source>International Journal of Semantic Computing</source>
          <volume>4</volume>
          (
          <issue>1</issue>
          ) (
          <year>2010</year>
          )
          <fpage>3</fpage>
          -
          <lpage>25</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Calbimonte</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jeung</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Corcho</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Aberer</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>Enabling query technologies for the semantic sensor web</article-title>
          .
          <source>Int. J. on Semantic Web and Information Systems</source>
          <volume>8</volume>
          (
          <year>2012</year>
          )
          <fpage>43</fpage>
          -
          <lpage>63</lpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>