FOSS4G 2023

The template for a Semantic SensorThings API with the GloSIS use case
06-28, 15:00–15:30 (Europe/Tirane), UBT C / N109 - Second Floor

Spatial Data Infrastructures (SDI) developed for the exchange of environmental
has heretofore been greatly shaped by the standards issued by the Open
Geospatial Consortium (OGC). Based on the Simple Object Access Protocol (SOAP),
services like WMS, WFS, WCS, CSW became digital staples for researchers and
administrative bodies alike.

In 2017 the Spatial Data on the Web Working Group (SDWWG) questioned the overall
approach of the OGC, based on the ageing SOAP technology
[@SDWWG2017]. The main issues identified by the SDWWG can be summarised as:

  • Spatial resources are not identified with URIs.
  • Modern API frameworks, e.g. OpenAPI, are not being used.
  • Spatial data are still shared in silos, without links to other resources.
  • Content indexing by search engines is not facilitated.
  • Catalogue services only provide access to metadata, not the data.
  • Data difficult to understand by non-domain-experts.

To address these issues the SDWWG proposed a five point strategy inspired on the
Five Star Scheme [@BernersLee2006]:

  • Linkable: use stable and discoverable global identifiers.
  • Parseable: use standardised data meta-models such as CSV, XML, RDF, or JSON.
  • Understandable: use well-known, well-documented, vocabularies/schemas.
  • Linked: link to other resources whenever possible.
  • Usable: label data resources with a licence.

The work of the SDWWG triggered a transformational shift at the OGC towards
specifications based on the OpenAPI. But while convenience of use has been the
focus, semantics has been largely unheeded. A Linked Data agenda has not
been pursued.

However, the OpenAPI opens the door to an informal coupling of OGC services with
the Semantic Web, considering the possibility of adopting JSON-LD as
syntax to OGC API responses. The introduction of a semantic layer to digital
environmental data shared through state-of-the-art OGC APIs is becoming a
reality, with great benefits to researchers using or sharing data.

This communication lays down a simple SDI set up to serve semantic environmental
data through a SensorThings API created with the glrc software. A use case is
presented with soil data services compliant with the GloSIS web ontology.

SensorThings API:

SensorThings API is an OGC standard specifying a unified framework to
interconnect Internet of Things resources over the Web [@liang2016ogc].
SensorThings API aims to address both the semantic, as well as syntactic,
interoperability. It follows ReST principles [@fielding2002principled],
promotes data encoding with JSON, the OASIS OData protocol
[@chappell2011introducing] and URL conventions.

The SensorThings API is underpinned on a domain model aligned with the ISO/OGC
standard Observations & Measurements (O&M) [@Cox2011], targeted at the
interchange of observation data of natural phenomena. O&M puts forth the
concept of Observation has an action performed on a Feature of Interest
with the goal of measuring a certain Property through a specific Procedure.
SensorThings API mirrors these concepts with Observation, Thing,
ObservedProperty and Sensor. This character makes of SensorThings API a
vehicle for the interoperability of heterogeneous sources of environmental


grlc (pronounced "garlic") is a lightweight server that translates SPARQL
queries into Linked Data web APIs [@merono2016grlc] compliant with the OpenAPI
specification. Its purpose is to enable universal access to Linked
Data sources through modern web-based mechanisms, dispensing the use of the
SPARQL query language. While losing the flexibility and federative capacities
of SPARQL, web APIs present developers with an approachable interface that can
be used for the automatic generation of source code.

A glrc API is constructed from a SPARQL query to which a meta-data section is
prepended. This section is declared with a simplified YAML syntax, within a
SPARQL comment block, so the query remains valid SPARQL. The meta-data provide
basic information for the API set up and most importantly, the SPARQL end-point
on which to apply the query. The listing shows an example.

#+ endpoint:

PREFIX dbo: <>
PREFIX dbr: <>
PREFIX rdfs: <>
PREFIX rdf: <>

SELECT ?band_label { 
    ?band rdf:type dbo:Band ;
          dbo:genre dbr:Hard_Rock ;
          rdfs:label ?band_label .
} ORDER BY ?band_label

A special SPARQL variable formulation is used to map into API parameters. By
adding an underscore (_) between the question mark and the variable name,
glrc is instructed to create a new API parameter. A prefix separated again
with an underscore informs glrc of the parameter type. The ?band_label
variable in [Listing @lst:1] can be expanded to ?_band_label_iri to create a
new API parameter of the type IRI.

Use case: GloSIS:

The Global Soil Partnership (GSP) is a network of stakeholders in the soil
domain established by members of the United Nations Food and Agriculture
Organisation (FAO). Its broad goals are to raise awareness to the importance of
soils and to promote good practices in land management towards a sustainable

Acknowledging difficulties in exchanging harmonised soil data as an important
obstacle to its goals, the GSP launched in 2019 an international consultancy to
assess the state-of-the-art and propose a path towards a Global Soil Information
System (GloSIS) based on a unified exchange. A domain model resulted, based
on the ISO 28258 standard for soil quality [@SchleidtReznik2020], augmented with
code-lists compiled from the FAO Guidelines for Soil Description [@Jahn2006].
This domain model was then transformed to a Web Ontology, relying on the Sensor,
Observation, Sample, and Actuator ontology (SOSA) [@Janowicz2019], and other
Semantic Web standards such as GeoSPARQL, QUTD and SKOS. The GloSIS web ontology
has been successfully demonstrated as a vehicle to exchange soil information as
Linked Data [@GloSIS].

A prototype API for the GloSIS ontology, formulated in compliance with the
SensorThings API specification, will be presented in this communication. It
demonstrates how the same set of SPARQL queries can be used to query through a
ReST API any end-point available over the internet, sharing linked soil data in
accordance with the GloSIS ontology. Thus providing a clear step towards the
federated and harmonised system envisioned by the GSP.

  • OSGeo charter member since 2016.
  • Founder of the PyWPS Project Steering Committee.
  • Founder of OSGeo-Europe.
  • Board member of OSGeo-Portugal.
  • Web page:
This speaker also appears in: