Santander - oeg-upm/ssn-resource-center GitHub Wiki

Example with some of the environmental sensors in Santander

This page provides an example of how the SSN Ontology can be used for describing the measurements made by some of the environmental sensors in Santander, such as those available at http://sandbox-ckan.localidata.com/dataset/real-time/resource/07571090-83ab-4ea0-bb6f-8935fdded32a.

We will focus for the time being on the Skeleton and Data parts of the SSN Ontology, which cover the main concepts that we need at this stage, namely the observations, sensor outputs, observation values, sensors, properties, and features of interest. These classes, and their corresponding properties, can be found in the central part of the following figure (which comes from the SSN Ontology final report):

SSN Ontology Overview (from the SSN Ontology report)

To facilitate the reading and understanding of the examples that follow, we will use the following diagram to represent the basic concepts that we will be making use of:

An Excerpt of the Skeleton and Data parts of the SSN Ontology

We can now specialise this skeleton with the types of observations, sensors, properties and observation values that we have to deal with in the case of these environmental sensors. Let's see first two excerpts from the JSON file that is generated by the set of Santander's environmental sensors, as made available through the Orion Context Broker:

Excerpt 1: a sensor that produces data about noise and its own battery level

{
  "id": "urn:x-iot:smartsantander:u7jcfa:fixed:t91",
  "attributes": [
    {
      "name": "TimeInstant",
      "value": "2014-12-11T17:21:01.000000Z",
      "type": "urn:x-ogc:def:trs:IDAS:1.0:ISO8601"
    },
    {
      "name": "Latitud",
      "value": "43.47198",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:latitude",
      "metadatas": [
        {
          "name": "code",
          "value": "deg",
          "type": ""
        }
      ]
    },
    {
      "name": "Longitud",
      "value": "-3.80134",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:longitude",
      "metadatas": [
        {
          "name": "code",
          "value": "deg",
          "type": ""
        }
      ]
    },
    {
      "name": "batteryCharge",
      "value": "67",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:batteryCharge",
      "metadatas": [
        {
          "name": "code",
          "value": "%",
          "type": ""
        }
      ]
    },
    {
      "name": "sound",
      "value": "2.34867556744404e-310",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:sound",
      "metadatas": [
        {
          "name": "code",
          "value": "dB",
          "type": ""
        }
      ]
    }
  ],
  "type": "santander:device",
  "isPattern": "false"
}

Excerpt 2: a sensor that produces measurements on several environmental factors (temperature, humidity, air particles, ozone, NO2, and CO concentrations, air particles and wind speed)

{
  "id": "urn:x-iot:smartsantander:u7jcfa:mobile:fa3030",
  "attributes": [
    {
      "name": "TimeInstant",
      "value": "2014-06-28T17:20:53.000000Z",
      "type": "urn:x-ogc:def:trs:IDAS:1.0:ISO8601"
    },
    {
      "name": "Latitud",
      "value": "0",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:latitude",
      "metadatas": [
        {
          "name": "code",
          "value": "deg",
          "type": ""
        }
      ]
    },
    {
      "name": "Longitud",
      "value": "0",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:longitude",
      "metadatas": [
        {
          "name": "code",
          "value": "deg",
          "type": ""
        }
      ]
    },
    {
      "name": "temperature",
      "value": "12.4",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:temperature",
      "metadatas": [
        {
          "name": "code",
          "value": "Cel",
          "type": ""
        }
      ]
    },
    {
      "name": "relativeHumidity",
      "value": "70",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:relativeHumidity",
      "metadatas": [
        {
          "name": "code",
          "value": "%",
          "type": ""
        }
      ]
    },
    {
      "name": "O3Concentration",
      "value": "70",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:O3Concentration",
      "metadatas": [
        {
          "name": "code",
          "value": "microGM3",
          "type": ""
        }
      ]
    },
    {
      "name": "airParticles",
      "value": "115",
      "type": "urn:x-ogc:def:phenomenon:SmartS:1.0:airParticles",
      "metadatas": [
        {
          "name": "code",
          "value": "microGM3",
          "type": ""
        }
      ]
    },
    {
      "name": "NO2Concentration",
      "value": "115",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:NO2Concentration",
      "metadatas": [
        {
          "name": "code",
          "value": "microGM3",
          "type": ""
        }
      ]
    },
    {
      "name": "altitude",
      "value": "0",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:altitude",
      "metadatas": [
        {
          "name": "code",
          "value": "m",
          "type": ""
        }
      ]
    },
    {
      "name": "course",
      "value": "0",
      "type": "urn:x-ogc:def:phenomenon:SmartS:1.0:course"
    },
    {
      "name": "odometer",
      "value": "0",
      "type": "urn:x-ogc:def:phenomenon:SmartS:1.0:odometer",
      "metadatas": [
        {
          "name": "code",
          "value": "km",
          "type": ""
        }
      ]
    },
    {
      "name": "COConcentration",
      "value": "0.2",
      "type": "urn:x-ogc:def:phenomenon:IDAS:1.0:COConcentration",
      "metadatas": [
        {
          "name": "code",
          "value": "milliGM3",
          "type": ""
        }
      ]
    }
  ],
  "type": "santander:device",
  "isPattern": "false"
},

JSON-LD and RDF turtle examples

The corresponding JSON-LD and RDF Turtle representations of the previous examples are provided in the following code snippets and files:

JSON-LD for excerpt 1

http://oeg-upm.github.io/ssn-resource-center/usage-examples/Santander/noiseSensorExample.jsonld

{
    "@context": "http://oeg-upm.github.io/ssn-resource-center/json-ld/ssnContext.json",
    "@id": "http://sandbox-ckan.localidata.com/dataset/real-time/resource/smartsantander/u7jcfa-fixed-t91/2014-12-11T172101000000Z",
    "@type": "ssn:Observation",
    "dcterms:title": "Observación realizada por el sensor urn:x-iot:smartsantander:u7jcfa:fixed:t91 en el instante de tiempo 2014-12-11T17:21:01.000000Z",
    "dcterms:title": "Observation made by sensor urn:x-iot:smartsantander:u7jcfa:fixed:t91 at time instant 2014-12-11T17:21:01.000000Z",
    "dcterms:identifier": "smartsantander/u7jcfa-fixed-t91/2014-12-11T172101000000Z",
    "ssn:observedBy": {
        "@id":"http://sandbox-ckan.localidata.com/dataset/real-time/resource/smartsantander/u7jcfa-fixed-t91",
        "@type":"xxx:NoiseSensor"
    },
    "ssn:observationResultTime": "2014-12-11T17:21:01.000000Z",
    "ssn:observedProperty": {
        "@id": "xxx:noiseLevel",
        "@type": "ssn:Property",
        "ssn:isPropertyOf": "xxx:NoiseSensor"
    },
    "ssn:featureOfInterest": {
        "@id":"xxx:noise",
        "@type":"xxx:Noise"
    },
    "ssn:observationResult": {
        "@id": "http://sandbox-ckan.localidata.com/dataset/real-time/resource/smartsantander/u7jcfa-fixed-t91/2014-12-11T172101000000Z/result",
        "@type": "ssn:SensorOutput",
        "ssn:isProducedBy": "http://sandbox-ckan.localidata.com/dataset/real-time/resource/smartsantander/u7jcfa-fixed-t91",
        "ssn:hasValue": {
            "@id":"http://sandbox-ckan.localidata.com/dataset/real-time/resource/smartsantander/u7jcfa-fixed-t91/2014-12-11T172101000000Z/value",
            "@type":"xxx:NoiseObservationValue",
            "xxx:value": "2.34867556744404e-310"
        }
    }
}

Turtle