<!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>From RESTful to SPARQL: A Case Study on Generating Semantic Sensor Data</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Heiko Muller</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Liliana Cabral</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ahsan Morshed</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Yanfeng Shu</string-name>
          <email>yanfeng.shug@csiro.au</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Intelligent Sensing and Systems Laboratory, CSIRO</institution>
          ,
          <addr-line>Hobart</addr-line>
          ,
          <country country="AU">Australia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The recent years have seen a vast increase in the amount of environmental sensor data that is being published on the web. Semantic enrichment of sensor data addresses the problems of (re-)use, integration, and discovery. A critical issue is how to generate semantic sensor data from existing data sources. In this paper, we present our approach to semantically augment an existing sensor data infrastructure, in which data is published via a RESTful API as inter-linked json documents. In particular, we describe and discuss the use of ontologies and the design and development of seraw, a system that transforms a set of json documents into an rdf graph augmented with links to other resources in the Linked Open Data cloud. This transformation is based on user-provided mappings and supported by a library of purpose-built functions. We discuss lessons learned during development and outline remaining open problems.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Environmental sensors play an important role in applications such as weather
forecasting, bush re monitoring, and irrigation scheduling. Recent years have
seen a vast increase in the amount of environmental sensor data that is being
published on the web. To make the most of the available data, it is
important to enhance our ability to discover, integrate, and contextualise the data.
Standardization e orts like the Open Geospatial Consortium (ogc) Sensor Web
Enablement (SWE) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], a collection of web service interfaces and data
encodings for interoperable data access, are a rst step in this direction. Semantic
enrichment of sensor data, referred to as semantic sensor web [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], linked sensor
data [
        <xref ref-type="bibr" rid="ref11 ref2 ref7">11,2,7</xref>
        ], or linked stream data [
        <xref ref-type="bibr" rid="ref13 ref8">13,8</xref>
        ], further improve (re-)use, integration,
and discovery of the available data. The main ideas are to use ontologies for
semantic description of data, and to publish data following linked data
principles [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        The Commonwealth Scienti c and Industrial Research Organisation (csiro)
collects and archives data from a large number of terrestrial and marine sensors
that measure parameters such as rainfall, temperature, and salinity. Parts of the
data are made available via an in-house sensor data infrastructure, referred to as
Sensor Cloud. One of the main components of this infrastructure is a Web API
implemented following RESTful principles [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. This RESTful API, referred to as
sc-api in this paper, uses HTTP requests to access and manipulate information
about resources such as sensing devices, sensor calibrations, and sensor
observations. Data is published as inter-linked documents in json format 1. Publishing
data as json documents has proved to have a positive impact on development of
applications that access sensor data. However, a lack of well-de ned semantics
and limited query capabilities hamper our ability to discover data in the Sensor
Cloud that is t for particular purposes. A typical query that currently cannot be
answered automatically is a search for all rainfall sensors within a speci c region
that have been calibrated in the past six months. The Sensor Cloud contains the
necessary information to answer this query, i. e., location, observed phenomena,
and calibration history. This information, however, is up to users' interpretation.
Furthermore, the information is spread across di erent documents, which means
that, to answer the query, a user has to manually browse documents by following
links between them or write a dedicated piece of software to do so automatically.
      </p>
      <p>
        To overcome these limitations, we propose a conceptual framework to
semantically augment the Sensor Cloud. Generating semantic sensor data from
our existing Sensor Cloud infrastructure involves several steps. First, we model
sensor data through the Sensor Cloud Ontology (SCO), which extends
existing ontologies including the Semantic Sensor Network Ontology (SSNO) [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ],
and aligns with standardised vocabularies to represent common entities such as
units of measurement and observed phenomena. We then construct mappings
that describe document elements in terms of concepts and properties of SCO.
These mappings form the basis for transforming json documents into rdf. The
whole mapping and translation process is done via seraw (Semantic RESTful
API Wrapper). seraw crawls documents accessible through the sc-api by
following links between them. The set of documents is transformed into a single
rdf graph. We further enhance the resulting rdf graph with links to resources
in the Linked Open Data cloud (lod) by using a set of purpose-built functions.
As a result, we obtain a semantically-enriched dataset and have the full query
capability provided by SPARQL [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>In this paper we discuss the main components of our framework to
semantically augment the Sensor Cloud, named Semantic Sensor Cloud and in this
context we present our approach to generate RDF from JSON, implemented in
SERAW. Given that there is a widespread use of APIs that serve data as json
documents (e. g., geospatial data 2), we believe that this approach can be
generalised to other applications e. g., the API provided by the centralised sensor
data repository Xively 3.</p>
      <p>In summary, the main contributions of this paper are:
{ We create an ontology for the Sensor Cloud, which extends standard
ontologies to model environmental sensor data.
1 http://www.json.org
2 http://www.opengeospatial.org/projects/groups/gservrestswg
3 https://xively.com
{ We develop seraw, a system that transforms a set of inter-linked json
documents into an rdf graph based on mappings between document elements
and concepts and properties in our ontology.
{ We enhance the generated rdf graph with links to resources in the lod
cloud through purpose-built functions.</p>
      <p>The remainder of this paper is structured as follows: We start by describing
our conceptual framework in Section 2. We present our ontology to model
Sensor Cloud data in Section 3. In Section 4, we describe our mechanism for
transforming a set of json documents into rdf. Implementation details are given
in Section 5. Section 6 outlines how we augment the resulting rdf graph with
external information. We discuss related work in Section 7. Section 8 concludes
the paper and gives an outlook into future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>The Semantic Sensor Cloud</title>
      <p>
        In this section, we describe the conceptual framework for the Semantic Sensor
Cloud, which integrates semantics into the the existing Sensor Cloud. Figure 1
shows the main components of the framework, where the components on the
right side (shaded in gray colour) belong to the semantic enrichment part, while
the components on the left belong to the Sensor Cloud. Following the layered
architecture for web accessible sensor data in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], the Semantic Sensor Cloud can
be seen as a middleware at the sensor web layer between the application layer
and the sensor network layer, managing the heterogeneity of sensor resources
and making them usable at the application level. In particular, the components
at the top (i. e., RESTful API and SPARQL) interact with applications, and the
components at the bottom (i.e. sensor data adaptors and lod cloud) interact
with external sources of sensor data.
      </p>
      <p>The Sensor Cloud is a sensor data infrastructure developed within csiro.
The main goal is to provide a centralised point of access for environmental
sensor data collected from various sensor networks in the organisation. Scalability
and support for application development were the main drivers that in uenced
design decisions. The infrastructure consists of a number of components. A
detailed description of the infrastructure is beyond the scope of this paper. Here,
we only give a brief description of the main components. The RESTful API
(scapi) provides data access and manipulation. The data management component
addresses how data is structured, identi ed, and partitioned into documents.
Sensor Data Adapters transform data from external sources into the json
format. json possesses several bene ts for application development, especially when
developing web applications using JavaScript. MongoDB 4 is used as the data
storage backend, primarily for its exibility regarding data structure.</p>
      <p>Within the infrastructure, sensor data is virtually structured hierarchically,
following N etwork ! P latf orm ! Sensor ! P henomenon ! Observation.
This hierarchical structure resembles the deployment of sensors in the physical</p>
      <sec id="sec-2-1">
        <title>4 http://www.mongodb.org</title>
        <p>Semantic
Sensor Cloud</p>
        <p>Data
Management
JSON</p>
        <p>Mongo</p>
        <p>DB</p>
        <p>RESTful</p>
        <p>API</p>
        <p>SPARQL</p>
        <p>SERAW
Sensor</p>
        <p>Data
Adapters</p>
        <p>LoD
Cloud</p>
        <p>
          SCO
RDF
Store
world. Each sensor network consists of platforms, with each platform having one
or more sensors attached; each sensor observes one or more phenomena. Besides
observations, information such as sensor device characteristics and calibration
history can also be accessed, which in the infrastructure is currently represented
using a json pro le of StarFL [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
        <p>The hierarchical structure of the data is re ected by the urls used to
access data. Networks, platforms, sensors, and phenomena have names to identify
them. These names form a relative key structure. That is, the name of a
network uniquely identi es it in the infrastructure. The name of a platform is unique
among other platforms in the same network. There may, however, be a platform
with the same name allocated to a di erent network. urls are currently the only
way for external applications to access documents in the Sensor Cloud. An
example for url http://www.sense-t.csiro.au/sensorcloud/v1/network/TIA/
platform/Tamar_Ridge/sensor/RIMCO_7499/phenomenon/rainfall is shown
in Figure 2. The returned json document refers to the network \TIA",
platform \Tamar Ridge", sensor \RIMCO 7499", and phenomenon \rainfall". The
content of the le is determined by the data management component. In this
example it shows, among other data, the location of the platform in terms of its
coordinates, date and number of observations, and links to the related
observations (time series) and to the sensing procedure.</p>
        <p>The main goal of our work is to semantically augment the Sensor Cloud with
knowledge management components that enable the automated generation of
rdf from the sensor data. At the heart of our work is seraw, a system that
transforms documents accessible via the sc-api into rdf. seraw makes use of
an ontology developed as extension of existing ontologies particularly for the
Sensor Cloud. By making use of a set of purpose-build functions, seraw allows
to include references to external resources and information. The generated data
is maintained in an rdf triple store and accessible via a SPARQL endpoint.
Figure 3 shows a screen shot of the query interface for seraw. In the following
sections, we describe components in the Semantic Sensor Cloud in more detail.
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>The Sensor Cloud Ontology</title>
      <p>In order to semantically describe sensor data from the Sensor Cloud we created
the Sensor Cloud Ontology (SCO)5. The principle behind the design of the
ontology is to use and extend existing ontologies, meanwhile aligning with the
Sensor Cloud terminologies. Accordingly, classes and properties were created and
mapped to the ones in existing ontologies, as described below. The advantages
are that sensor data can be queried according to the original terminologies while
their consistency can be checked against SCO. We use the ontology to facilitate
syntactic-to-semantic transformation in seraw (Section 4).</p>
      <p>Following best practices, we reused several ontologies, namely, the SSN
ontology (SSNO), an ontology for the OGC's Observation and Measurements (OM) 6,
and the Basic Geo (WGS84) (GEO) vocabulary 7. The main criterion to use these</p>
      <sec id="sec-3-1">
        <title>5 http://www.sense-t.csiro.au/sensorcloud/ontology</title>
      </sec>
      <sec id="sec-3-2">
        <title>6 http://def.seegrid.csiro.au/isotc211/iso19156/2011/observation</title>
        <p>7 http://www.w3.org/2003/01/geo/wgs84 pos
ontologies is that they are derived from standardisation e orts. Figure 4 shows
the main classes and properties of SCO, where the pre x of a class, e. g., ssn of
ssn:Observation, indicates the ontology the class comes from.</p>
        <p>We extend these ontologies in several ways. In SCO we de ne sco:Network,
sco:Platform, and sco:Sensor to make explicit the fact that networks,
platforms, and sensors in the Sensor Cloud are ssn:Systems (contrary to the de
nition of platforms and sensors in SSNO). sco:Sensor, for example, is de ned as
subclass of ssn:SensingDevice which in turn is a subclass of ssn:System. To
describe sensor observations, we introduce concepts sco:ObservedPhenomenon,
sco:ObservationResult, and sco:TimeSeriesObservatedValue as subclasses
of ssn:Observation, ssn:SensorOutput, and ssn:ObservationValue,
respectively. These concepts re ect the particular use of terms phenomenon and
obhasSensingDevice
subclass
subclass
subclass
subclass
subclass
sco:Network
hasPlatform
sco:Platform
hasSensor
sco:Sensor
ssn:observedBy
sco:Observed</p>
        <p>Phenomenon
ssn:observationResult
sco:Observation</p>
        <p>Result
hasLocationCoordinate
hasLocoantPiolantCfooromrdinate
hasMetadata
hasMetadata
hasMetadata
ssn:hasValue
sco:Location
Coordinate
subclass
geo:Point
om:Metadata
ssn:Observation</p>
        <p>Value
subclass
sco:TimeSeries
ObservedValue
ssn: System
ssn:Sensing</p>
        <p>Device
ssn:Observation
ssn:Sensor Output
servation in the hierarchical document structure of the Sensor Cloud. To be
compatible with GEO and OM, we introduced sco:LocationCoordinate as
a type of geo:Point, and used om:Metadata to describe metadata of several
classes (e.g. sco:Sensor). In doing so, we are then able to use standardised
(ISO) vocabularies for coordinates, deployment, and quality that are left open
in SSNO. Furthermore, we introduced some properties that are speci c to the
Sensor Cloud, e. g., those describing the number of time-value pairs of time series,
and the rst or last observation time.</p>
        <p>Besides the above ontologies, we also used existing vocabularies such as
dcterms:source (for the url of the original json documents). In addition, we
align with UCUM 8 for the units of measure, MUO 9 for the physical qualities,
and Climate and Features 10 for the properties. This alignment is enabled by
subclassing sco:ObservedProperty and dul:UnitOfMeasure accordingly.</p>
        <p>The SCO data instances can be queried through the interface shown in
Figure 3. The shown query returns longitude and latitude for all platforms in the
Sensor Cloud. Another example is the following query that retrieves observation
quality information represented as observation metadata.</p>
      </sec>
      <sec id="sec-3-3">
        <title>8 http://purl.oclc.org/NET/muo/ucum/</title>
      </sec>
      <sec id="sec-3-4">
        <title>9 http://purl.oclc.org/NET/muo/muo#PhysicalQuality</title>
        <p>10 http://www.w3.org/2005/Incubator/ssn/ssnx/cf/cf-property</p>
        <p>SELECT DISTINCT ? sensingDevice ? observation ? obsMetadata
? qualityInfo ? methodType
WHERE {
? sensingDevice a ssn : Sensor .
? sensingDevice sco : hasObservedPhenomenon ? observation .
? observation sco : hasMetadata ? obsMetadata .
? obsMetadata md : dataQualityInfo ? qualityInfo .
? qualityInfo dq : report ? report .</p>
        <p>? report dq : evaluationMethodType ? methodType .</p>
        <p>}
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Semantic RESTful API Wrapper (SERAW)</title>
      <p>Within this section we describe how seraw generates an rdf representation
for sensor data accessible via the sc-api. Our main goal is to create a single
rdf graph from a set of inter-linked json documents. Transformation is guided
by user-provided url expressions and transformation scripts. url expressions
associate documents of di erent type (e. g., Network, Platform, Sensor) with
transformation scripts. Each script then describes how document elements are
mapped to concepts and properties in a given ontology, i. e., SCO in our case.
For seraw we developed a simple mapping language to express transformation
scripts. As with any formal language, there is a trade-o between functionality
and complexity of use. Languages such as xslt are powerful but di cult to use,
especially for domain experts with limited computer programming experience.
Furthermore, most approaches focus on transforming a single document
without considering the problem of creating and maintaining relationships between
resources in di erent input documents. We start by de ning url expressions
(Section 4.1) before describing our mapping language (Section 4.2).
4.1</p>
      <sec id="sec-4-1">
        <title>URL Expressions</title>
        <p>urls in sc-api follow patterns that re ect the structure of data in the Sensor
Cloud. seraw exploits these patterns by means of url expressions to match
urls. The syntax of url expressions is similar to that of urls. For simplicity,
we assume that a url is composed of two parts: a service identi er (a string
consisting of protocol, server name, domain name, and optional port information),
and a (potentially empty) array of strings, called path names. A url expression
also has a service identi er, and a (potentially empty) array of strings which
could be path variables or path names. A path variable is a regular expression.
We reference variables from 0 to n based on the order of their occurrence. A url
matches a url expression if the service identi ers are equal, the path arrays
are of same size, and each path name in the url matches the corresponding
element in the url expression. When a url matches an expression we bind the
variables in the expression to the path names in the url. Figure 5 shows an
example url expressions. Regular expressions are enclosed in square brackets
and follow Java's regular expression syntax (e. g., `: ' matches any character
sequence). Both urls http://sense-t.csiro.au/sensorcloud/v1/network/
TIA/platform/Tmar_Ridge and http://sense-t.csiro.au/sensorcloud/v1/
network/SouthEsk/platform/Ben_Lomond match the pattern in Figure 5. In
the rst case, variable 0 is bound to path name TIA and variable 1 is bound to
Tmar Ridge.
We use a set of url expressions to identify relevant documents. Only
documents having a url matching one of the given url expressions are considered
by seraw. The use of url expressions gives us exibility in that we can restrict
the set of documents that are transformed (down to transforming only a single
document). Starting from a set of urls, seraw traverses the documents
accessible via the sc-api by following links between them. To detect cycles in the
document graph, we keep track of all urls visited. With each url expression
we optionally associate a transformation script. For each document, we execute
all transformation scripts that are associated to any url expressions matched
by its url. Associating transformation scripts with url expressions allows us to
handle each document type di erently. By executing translation scripts, we add
individuals to the ontology, generating the rdf representation for the documents
accessible via the sc-api.
4.2</p>
      </sec>
      <sec id="sec-4-2">
        <title>Transformation Scripts</title>
        <p>
          Transformation scripts are programs in our mapping language. The language is
inspired by formal mapping languages (e. g., [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) that model ontology classes as
unary predicates, and properties as binary predicates. Scripts are basically lists of
statements that create ontology individuals for elements in json documents. We
use path expressions to identify these elements. Given that there currently does
not exist a standard path or query language for json, we implemented our own
json path expression language (inspired by XPath and existing implementations
like JSONPath 11). We describe syntax and semantics of our mapping language
using the script shown in Figure 6. We assume that the script is associated with
the url expression in Figure 5 and we use document http://sense-t.csiro.
au/sensorcloud/v1/network/TIA/platform/Tmar_Ridge as our example.
        </p>
        <p>
          Transformation scripts take the document (i. e., a json object) and a list
of path names bound to variables in the matched url expression as input.
These path names are accessible within scripts by referencing the corresponding
variables using double square brackets. In our example, [[0]] and [[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]] represent
11 http://goessner.net/articles/JsonPath/
`TIA' and `Tmar Ridge', respectively. Variables play an important role in the
generation of unique ontology individual identi ers. For example, by executing
line 2 (Figure 6), we create an instance of sco:Platform for the given json
object (identi ed by path /), whose identi er is `Platform TIA Tmar Ridge',
constructed by concatenating the concept label Platform with path names
`TIA' (i. e., [[0]]) and `Tmar Ridge'(i. e., [[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]]). This instance is uniquely
identi ed among all individuals of the ontology. Here, we make use of the fact that
path names in document urls form relative keys. To avoid redundancies, we use
a lookup table to maintain the individuals created, and an individual is created
only if it is not in the table. In our case it is common that some information
is repeated within di erent documents (e. g., location information is contained
within platform and sensor documents) or accessible via di erent urls (e. g., the
same information about operational properties of a speci c sensor type may
occur in di erent documents due to the hierarchical structure that groups sensors
under networks and platforms).
        </p>
        <p>Lines 3-8 process the elements under path platform/location. Note that we
use a path that is relative to the json element identi ed by the surrounding
forstatement. There might be multiple elements in a document that match a given
path expression. The for-statement is executed for each of them. The statement
in line 3 creates an instance of sco:LocationCoordinate which has datatype
properties geo:lat, geo:long and geo:alt. The statements in line 5-8 create
instances of these datatype properties. The pre x '@' indicates that the property
value comes from the primitive json element identi ed by the respective relative
path (e. g., latitude). An optional type information (e. g., ^^double) indicates how
the value is represented in rdf. The statements in lines 9 and 11 are examples
for creating instances of object properties. It is important to note that we may
reference an individual before it is created. In line 11, for example, it is possible
that the referenced sco:Network with identi er `Network TIA' has not already
been created (i. e., it is not in the lookup table). If that is the case, we defer
creation of references until referenced individuals have been created.</p>
        <p>Implementation of SERAW
seraw is implemented in Java and uses Jena API to generate rdf. We run
seraw as a web service using Apache Tomcat. The crawler is a separate
process within the system. It crawls documents accessible through the sc-api and
transforms them into rdf. Execution times of seraw depend on the number
and complexity of transformation scripts, as well as on network latency. Given
the large number of documents accessible via sc-api, the overall time for
transformation is several minutes. We conducted initial experiments to evaluate the
impact of document access and transformation on overall execution time. Here,
we focus on transforming documents representing sensing platforms using the
script in Figure 6. All experiments were performed on a standard Dell Latitude
laptop with a 2.53 GHz Intel Core i5 CPU and 4GB of RAM. All times are
averaged over ten runs. There are a total of 74 platforms in sc-api with an
average document size of 497 bytes. Our experimental results indicate that network
latency (as expected) has the major in uence on execution times. The average
time for accessing a document was 37.55 ms. Transforming a document, on the
other hand, only took 1.02 ms on average.</p>
        <p>seraw creates an rdf version of data accessible via the sc-api. Derived data
raises the issue of timeliness. As data in the Sensor Cloud is updated, our rdf
outdates over time. There is an obvious di erence between update frequencies of
di erent document types. While sensor observations get updated frequently,
sensor metadata and deployment information is less likely to be updated. Depending
on the type of information that is transformed into rdf and the application
requirements we choose the frequency with which we re-run the transformation
process. When doing so, we overwrite results from the previous run. The user
interface also allows the process to be run on demand to generate an up-to-date
rdf version of the data.</p>
        <p>The seraw user interface provides the ability to create and edit
transformation scripts. It further provides the opportunity to test the results of created
scripts on a restricted set of urls. Figure 7 shows part of the interface that
allows a user to specify a set of urls and run the transformation scripts on the
documents returned by these urls. The interface displays the transformation
result and any error messages generated during the transformation.
6</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Linking to External Resources</title>
      <p>
        The motivation for our work was not only to generate an rdf version of the data
in the Sensor Cloud, but also to augment the resulting rdf graph with external
information. As such we consider including links to external resources in the rdf
graph. Several authors have recently described approaches for publishing
semantic sensor data that includes links to resources in the lod cloud [
        <xref ref-type="bibr" rid="ref11 ref13 ref14 ref2 ref7">14,13,11,2,7</xref>
        ].
In most of these approaches, links are hard-coded into the system. For seraw,
we implemented a library of purpose-built functions that retrieve resource uris
and other information from the web. Calls to these functions can be made from
within transformation scripts to include returned results into the generated rdf
graph. The main bene t of having a library of functions for retrieving external
information is reusability of code.
      </p>
      <p>One example function is the generation of address information for a given
location. The Sensor Cloud contains location information in form of latitude
and longitude. We implemented a function, called revGeoCode, which uses
Google's Geocoding API 12 to transform location coordinates into a
humanreadable address. The API returns a list of results containing postal addresses
and other geographical names for a location, with the most speci c one returned
rst. Our implementation of revGeoCode returns the string value of the rst
formatted addresses eld in the result list (if any), e. g., 619 Auburn Road,
Kayena TAS 7270, Australia for the sensor platform at Tamar Ridge (Figure 7).
12 https://developers.google.com/maps/documentation/geocoding/
Other examples are functions that query DBpedia 13, Geonames 14, or
Freebase 15 to retrieve a uri for a given location name. The following SPARQL
query basically represents the function that queries DBpedia for location uris,
called DBpLocation, where var is the location name provided as parameter with
the function call:</p>
      <p>SELECT ? city WHERE {
? city rdf : type &lt;http :// dbpedia . org / class / yago / TownsInTasmania &gt; .</p>
      <p>FILTER ( regex (? city , var )
}</p>
      <p>We further combined functionalities into a function DBpLatLonLocation
that takes latitude and longitude values as input, retrieves a place name for the
location from Google's Geocoding API (from the rst address component of type
locality in the result), and uses the place name (if any) to retrieve a uri from
DBpedia. We implemented similar functions for Geonames and Freebase, called
GeoLatLonLocation and F BLatLonLocation respectively. Figure 8 outlines the
two-step process of using latitude and longitude information to generate a link
to a location resource.</p>
      <p>In transformation scripts, we make function calls when generating datatype
properties. For example, adding the following line to the script in Figure 6
(anywhere in between lines 4-8) will take values of latitude and longitude in the json
element and add location information to the individual identi ed by y2.</p>
      <p>We added location information for 56 of 74 platforms in the Sensor Cloud
using DBpLatLonLocation. We also added information from Geonames and
Freebase. DBpedia, Geonames, and Freebase give only general information about
a particular place. This information, nevertheless, boosts up the knowledge that
can be used by other applications (i.e., Agriculture Decision Support Systems).
In the future, we will extend our library of functions, e. g., for retrieving soil
types as provided by the European Environment Agency 16. We also plan to add
functionality to enable linking to geographical resources by querying services
such as the Geographical Service 17 and LinkedGeoData 18.
7</p>
    </sec>
    <sec id="sec-6">
      <title>Discussion and Related Work</title>
      <p>
        We designed seraw to complement existing Web APIs that publish data in json
format by providing semantic enhancements and query capabilities that are not
available otherwise. While we use the Sensor Cloud as our main motivation,
13 http://dbpedia.org
14 http://www.geonames.org
15 http://www.freebase.com
16 http://www.eea.europa.eu/data-and-maps/data/soil-type
17 http://geoservice.psi.enakting.org
18 http://linkedgeodata.org
Fig. 8. Function to Retrieve Location uri based on Latitude and Longitude
Information
the transformation mechanism described in this paper is applicable to other
APIs. The semantic sensor web [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] was a major source of inspiration for the
development of seraw. In the semantic sensor web, sensor data is annotated
using ontologies and published following linked data principles. Thus, seraw is
related to several e orts in publishing semantic sensor data [
        <xref ref-type="bibr" rid="ref10 ref11 ref2 ref7 ref8">2,11,10,7,8</xref>
        ].
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], Barnaghi and Presser present Sens2Web, a platform for publishing
linked sensor data. Contrary to seraw, sensor descriptions are entered into
Sens2Web via a user interface. Sens2Web then transforms the data into rdf
and runs a set of prede ned queries to link to other resources. The resulting
data is accessible through a SPARQL endpoint. In [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], the authors describe
a work ow for transforming raw sensor observations from weather stations in
the United States into rdf with links to other datasets in the lod cloud. The
described solution is speci c to the given use case. In [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], the High-level API
for Observations (HLAPIO) is presented. The primary focus of HLAPIO is on
publishing sensor data using RESTful and linked data principles. HLAPIO uses
a mapping language for data transformation that is intended for relational data
and not for json documents. A linked data model and a RESTful proxy for
OGCs Sensor Observation Service (SOS) is described in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] to publish SOS data
as linked data. The software is installed as a facade to an existing SOS. Le-Phuoc
et al. describe their Linked Stream Middleware (LSM) [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. LMS provides
wrappers to access and integrate sensor stream data with other data sources. Users
can annotate and visualise data using a web interface. LMS provides standard
SPARQL queries and continuous queries using an adaptive query processor for
linked stream data. Compared to seraw, these existing approaches provide only
limited possibilities for users to in uence the transformation process.
seraw comes with a exible, light-weight mapping language. There exist
a number of mapping languages and mechanisms for other data formats (e. g.,
Triplify 19, and D2RQ 20 for relational databases) to produce rdf from data. To
the best of our knowledge, none of them deals with the transformation of
interlinked json documents into rdf. D2RQ is a declarative language that maps
elements in a relational database schema to classes and properties in ontologies.
Our mapping language is similar to D2RQ, however, it maps json documents
and elements to ontology classes and properties, and also, it includes speci c
features that allow us to deal with the hierarchical structure of json documents
and links between these documents.
      </p>
      <p>seraw has an extendable set of purpose-built functions for creating links to
the lod cloud. Having a library of functions facilitates reuse of functionality. We
see our approach towards link generation as a step in the right direction that
hopefully will nd adoption in other systems.
8</p>
    </sec>
    <sec id="sec-7">
      <title>Conclusion and Future Work</title>
      <p>In this paper we explored ways for transforming sensor data available via an
existing data infrastructure as a semantically enriched rdf dataset. We provide
Knowledge Management components that access components of our existing
Sensor Cloud and generate rdf that can be queried via a SPARQL endpoint
or re-used by applications for di erent purposes. The requirements for semantic
web technologies within a sensor data infrastructure can vary according to the
architecture level ranging from sensor devices to analytics to applications. We
believe that seraw is a generic tool that can be used across di erent levels in
such infrastructure since it allows mappings rules and services to be combined.</p>
      <p>One area of future work is the development of a more sophisticated solution
to update our rdf copy of the Sensor Cloud data. Instead of transforming the
whole set of documents, the goal is to transform only those that have been
modi ed recently. We are able to identify documents that have been modi ed
from the log les of the web server running the Sensor Cloud. We can then
selectively transform only these documents. To do so requires to keep track of
provenance in the rdf graph to identify those parts of the graph that where
derived from a particular json document.</p>
      <p>A similar problem arises with the generation of links to external resources.
We generate links to external resources every time we run the transformation
process. For functions that use information about the location of a platform, for
example, the results are likely to be the same in every run (unless the platform
is a mobile platform). One path of future work is to cache results from calls to
external services. Provenance, again, plays an important role here, i. e., keeping
track of parameter values (e. g., latitude and longitude) to determine whether a
document has change in between runs or not.
19 http://triplify.org/Overview
20 http://d2rq.org</p>
      <sec id="sec-7-1">
        <title>Acknowledgements</title>
        <p>The authors would like to thank the development team of the Sensor Cloud for
their support. In particular, we would like to thank Chris Peters, Chris Sharman,
and Peter Taylor for their assistance and feedback during the development of
seraw. We would also like to thank Michael Compton for his valuable feedback
during preparation of the manuscript.</p>
        <p>The Intelligent Sensing and Systems Laboratory and the Tasmanian node of
the Australian Centre for Broadband Innovation is assisted by a grant from the
Tasmanian Government which is administered by the Tasmanian Department of
Economic Development, Tourism and the Arts.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>An</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Borgida</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mylopoulos</surname>
          </string-name>
          , J.:
          <article-title>Constructing complex semantic mappings between xml data and ontologies</article-title>
          . In: International Semantic Web Conference. pp.
          <volume>6</volume>
          {
          <issue>20</issue>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Barnaghi</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Presser</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Publishing linked sensor data</article-title>
          .
          <source>In: Proceedings of the 3rd International Workshop on Semantic Sensor Networks (SSN10)</source>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Botts</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Percivall</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reed</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Davidson</surname>
          </string-name>
          , J.:
          <article-title>Ogc sensor web enablement: Overview and high level architecture</article-title>
          .
          <source>Tech. Rep. OGC 07-165</source>
          , Open Geospatial Consortium (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Broering</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Echterho</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jirka</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Simonis</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Everding</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stasch</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Liang</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lemmens</surname>
          </string-name>
          , R.:
          <article-title>New generation sensor web enablement</article-title>
          .
          <source>Sensors</source>
          <volume>11</volume>
          ,
          <issue>2652</issue>
          {
          <fpage>2699</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Fielding</surname>
          </string-name>
          , R.T.:
          <article-title>Architectural styles and the design of network-based software architectures</article-title>
          .
          <source>Ph.D. thesis</source>
          (
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Heath</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bizer</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Linked Data: Evolving the Web into a Global Data Space</article-title>
          .
          <source>Synthesis Lectures on the Semantic Web</source>
          , Morgan &amp; Claypool Publishers (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Janowicz</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          , Broring,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Stasch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Schade</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Everding</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            ,
            <surname>Llaves</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          :
          <article-title>A restful proxy and data model for linked sensor data</article-title>
          .
          <source>Environment</source>
          <volume>1</volume>
          (
          <issue>ii</issue>
          ),
          <volume>1</volume>
          {
          <fpage>30</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Le-Phuoc</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nguyen-Mau</surname>
            ,
            <given-names>H.Q.</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 middleware framework for scalable management of linked streams</article-title>
          .
          <source>Web Semant</source>
          .
          <volume>16</volume>
          ,
          <issue>42</issue>
          {51 (Nov
          <year>2012</year>
          ), http://dx.doi.org/10.1016/j.websem.
          <year>2012</year>
          .
          <volume>06</volume>
          .003
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Malewski</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Simonis</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Terhorst</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , Broring, A.:
          <article-title>Star - a modularised metadata language for sensor descriptions</article-title>
          .
          <source>International Journal of Digital Earth</source>
          <volume>1</volume>
          ,
          <issue>1</issue>
          {
          <fpage>20</fpage>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Page</surname>
            ,
            <given-names>K.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Frazer</surname>
            ,
            <given-names>A.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nagel</surname>
            ,
            <given-names>B.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Roure</surname>
            ,
            <given-names>D.C.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Martinez</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>Semantic access to sensor observations through web apis</article-title>
          .
          <source>vol. 0</source>
          , pp.
          <volume>336</volume>
          {
          <fpage>343</fpage>
          . IEEE Computer Society, Los Alamitos, CA, USA (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Patni</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Henson</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sheth</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Linked sensor data</article-title>
          .
          <source>In: Collaborative Technologies and Systems (CTS)</source>
          ,
          <source>2010 International Symposium on</source>
          . pp.
          <volume>362</volume>
          {
          <issue>370</issue>
          (may
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Prud'hommeaux</surname>
          </string-name>
          , E.,
          <string-name>
            <surname>Seaborne</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Sparql query language for rdf</article-title>
          .
          <source>W3c recommendation</source>
          ,
          <source>W3C (Jan</source>
          <year>2008</year>
          ), http://www.w3.org/TR/rdf-sparql-query/
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Sequeda</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Corcho</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          :
          <article-title>Linked stream data: A position paper</article-title>
          .
          <source>In: Proceedings of the 2nd International Workshop on Semantic Sensor Networks (SSN09)</source>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Sheth</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Henson</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sahoo</surname>
            ,
            <given-names>S.S.:</given-names>
          </string-name>
          <article-title>Semantic sensor web</article-title>
          .
          <source>IEEE Internet Computing</source>
          <volume>12</volume>
          (
          <issue>4</issue>
          ),
          <volume>78</volume>
          {
          <fpage>83</fpage>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15. W3C Incubator Group:
          <article-title>Semantic sensor network xg nal report</article-title>
          .
          <source>Tech. rep.</source>
          , http: //www.w3.org/2005/Incubator/ssn/XGR-ssn-
          <volume>20110628</volume>
          /
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>