Warning:
This wiki has been archived and is now read-only.

SSN Smart product

From Semantic Sensor Network Incubator Group
Jump to: navigation, search

Smart product example


This is an example on a demo from the SmartProducts project scenario involving an accelerometer sensor. The SmartProducts project deals with consumer products which possess sensing, reasoning, and communicating capabilities.

In our example, there is a knife equipped with an accelerometer sensor which recognises when the user is cutting something. The observations are passed to a "cooking assistance" device which guides the user through the cooking process and recognises from the user actions that a certain step was performed (e.g., "the user stopped to cut vegetables").

The sensor modeled in this example is a WiTilt 3.0 accelerometer. It has 4 possible measurement ranges (+/-1.5g, +/-2g, +/-4g, +/-6g) and 4 possible frequency modes (50 Hz max in degree mode, 135 Hz max in gravity mode, 220 Hz max in raw ADC mode, 610 Hz max in binary mode).

This example is used to document the Measuring module and MeasuringCapability module - see Figure 5.31 showing only a subset of the the possible measurement modes with one range and one frequency) and the Observation module (Figure 5.32).

Sensor

A concept map containing the first half of this example and focusing on the sensor elements

Figure 5.31 - Smart product example: Sensor

The sensor in our example is implemented as a mechanical device. Thus, in order to represent this sensor, we need to create an instance of the class ssn:SensingDevice. However, in our case we want to model all sensors measuring a specific property (acceleration) and also all sensors of a specific model (WiTilt 3.0). In order to do it, we create the class Accelerometer as a subclass of the class ssn:SensingDevice.

 <owl:Ontology rdf:about="http://purl.oclc.org/NET/ssnx/product/smart-knife">
 ...
 <owl:Class rdf:about="#Accelerometer">
  <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#SensingDevice"/>
  <rdfs:subClassOf>
   <owl:Restriction>
    <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observes"/>
    <owl:hasValue rdf:resource="http://purl.oclc.org/NET/muo/ucum/physical-quality/acceleration"/>
   </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:comment>Accelerometer is a subclass of sensing devices which measures acceleration. 
  The individual describing a physical quality "acceleration" is defined in the imported MyMobileWeb ontology 
  of measurement units. To align the MyMobileWeb ontology with the SSN ontology, the class muo:PhysicalQuality 
  from the MyMobileWeb ontology is defined as a subclass of the class ssn:Property.</rdfs:comment>
 </owl:Class>
 

Note that we imported an external ontology (MyMobileWeb Measurement Units Ontology) describing physical properties and units of measurement. The SSN ontology itself does not contain its own model for these concepts and does not restrict the user in the choice of an ontology to model them.

Having the generic class of accelerometer sensors, we create a subclass representing accelerometers of a certain model (WiTilt 3.0).

 <owl:Class rdf:about="#WiTilt30Accelerometer">
  <rdfs:subClassOf rdf:resource="#Accelerometer"/>
  <rdfs:subClassOf>
   <owl:Restriction>
    <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#hasMeasurementCapability"/>
    <owl:allValuesFrom rdf:resource="#WiTilt30AccelerationMeasurementCapability"/>
   </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:comment>This class describes WiTilt v3.0 accelerometers. 
  All possible configurations of their measurement capabilities are defined using
  the class WiTilt30AccelerationMeasurementCapability, so the property ssn:hasMeasurementCapability 
  is restricted to instances of this class.</rdfs:comment>
</owl:Class>
</nowiki>

Then, we can define an instance of this class which will represent our specific WiTilt 3.0 accelerometer attached to a knife.

 <owl:Thing rdf:about="#ExampleWiTilt30Accelerometer">
  <rdf:type rdf:resource="#WiTilt30Accelerometer"/>
  <rdfs:comment>A specific instance of a WiTilt 3.0 accelerometer attached to a knife.</rdfs:comment>
  <ssn:hasMeasurementCapability rdf:resource="#ExampleWiTiltAccelerometerMeasurementCapability"/>
  <ssn:onPlatform rdf:resource="#Knife_123"/>
 </owl:Thing>
 

Our accelerometer is attached to a knife in order to capture its movements. Thus, a knife in this example serves both as a platform, on which the sensor is installed, and a feature of interest observed by the sensor.

 <ssn:FeatureOfInterest rdf:about="#Knife_123">
   <rdf:type rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#Platform"/>
   <rdfs:comment>An example knife with an attached WiTilt 3.0 accelerometer. It belongs to both ssn:Platform and ssn:Feature
                 because it is both the platform of the sensor and the feature being observed by the sensor.</rdfs:comment>
 </ssn:FeatureOfInterest>
 

Measurement capabilities

In the description above, we specified that the class WiTilt30Accelerometer must have a value for the property ssn:hasMeasurementCapability belonging to the class WiTilt30AccelerationMeasurementCapability. This class defines possible configurations of measurement capabilities for WiTilt 3.0 accelerometers: measurement ranges (+/-1.5g, +/-2g, +/-4g, +/-6g) and frequency modes (50 Hz, 135 Hz, 220 Hz, 610 Hz).

 <owl:Class rdf:about="#WiTilt30AccelerationMeasurementCapability">
   <rdfs:label>WiTilt 3.0 acceleration measurement capability</rdfs:label>
   <rdfs:subClassOf rdf:resource="#AccelerationMeasurementCapability"/>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#hasMeasurementProperty"/>
       <owl:onClass rdf:resource="#WiTilt30MeasurementRange"/>
       <owl:qualifiedCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:qualifiedCardinality>
     </owl:Restriction>
   </rdfs:subClassOf>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#hasMeasurementProperty"/>
       <owl:onClass rdf:resource="#WiTilt30MeasurementFrequency"/>
       <owl:qualifiedCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:qualifiedCardinality>
     </owl:Restriction>
   </rdfs:subClassOf>
 </owl:Class>
 

To express possible measurement ranges, we define a subclass of the class ssn:MeasurementRange:

 <owl:Class rdf:about="#WiTilt30MeasurementRange">
   <rdfs:label>WiTilt 3.0 measurement range</rdfs:label>
   <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#MeasurementRange"/>
   <rdfs:comment>
   This class defines possible measurement ranges of a WiTilt 3.0 accelerometer sensor. 
   These sensors can be calibrated to measure acceleration in the ranges of +/-1.5g, +/-2g, +/-4g and +/-6g. 
   These four ranges are expressed using instances of this class: WiTilt30MeasurementRange_1...WiTilt30MeasurementRange_4. 
   Because the SSN ontology does not specify how the values of measurement properties should be expressed, 
   three properties are introduced: hasMeasurementPropertyValue (for exact values), hasMeasurementPropertyMaxValue 
   (for maximal values), and hasMeasurementPropertyMinValue (for minimal values).
   </rdfs:comment>
 </owl:Class>
Then, we define four instances of this class corresponding to each measurement range:
 <owl:Thing rdf:about="#WiTilt30MeasurementRange_1">
   <rdf:type rdf:resource="#WiTilt30MeasurementRange"/>
   <hasMeasurementPropertyMaxValue rdf:resource="#WiTilt30MeasurementRange_1MaxValue"/>
   <hasMeasurementPropertyMinValue rdf:resource="#WiTilt30MeasurementRange_1MinValue"/>
 </owl:Thing>
 ...
 <owl:Thing rdf:about="#WiTilt30MeasurementRange_1MaxValue">
   <rdf:type rdf:resource="#AccelerationValue"/>
   <hasQuantityValue rdf:datatype="&xsd;float">1.5</hasQuantityValue>
 </owl:Thing>
 ...
 <owl:Thing rdf:about="#WiTilt30MeasurementRange_1MinValue">
   <rdf:type rdf:resource="#AccelerationValue"/>
   <hasQuantityValue rdf:datatype="&xsd;float">-1.5</hasQuantityValue>
 </owl:Thing>
 

Note that the sensor ontology does not restrict the way in which specific measurement properties are described. In our example, we defined our own RDF properties to define values of measurement properties (hasMeasurementPropertyMinValue, hasMeasurementPropertyValue, hasMeasurementPropertyValue) and defined a subclass AccelerationValue of the class ssn:ObservationValue. For this class, we defined properties hasQuantityValue and hasQuantityUnitOfMeasurement and restricted the property hasQuantityUnitOfMeasurement:

 <owl:Class rdf:about="#AccelerationValue">
   <rdfs:label>Acceleration value</rdfs:label>
   ...
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="#hasQuantityUnitOfMeasurement"/>
       <owl:hasValue rdf:resource="http://purl.oclc.org/NET/muo/ucum/unit/acceleration/standard-acceleration-of-free-fall"/>
     </owl:Restriction>
   </rdfs:subClassOf>
   <rdfs:comment>Acceleration value measured in g - standard acceleration of free fall.</rdfs:comment>
 </owl:Class>
 

In the same way, we define possible output frequency values:

 <owl:Class rdf:about="#WiTilt30MeasurementFrequency">
   <rdfs:label>WiTilt 3.0 measurement frequency</rdfs:label>
   <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#Frequency"/>
   <rdfs:comment>This class describes maximal output frequency values of WiTilt 3.0 accelerometers in four modes: 
         degree mode (50Hz), gravity mode (135Hz), raw ADC mode (220Hz), and binary mode (610Hz). 
   </rdfs:comment>
 </owl:Class>
 ...
 <WiTilt30MeasurementFrequency rdf:about="#WiTilt30BinaryModeFrequency">
   <hasMeasurementPropertyValue rdf:resource="#WiTilt30BinaryModeFrequencyValue"/>
 </WiTilt30MeasurementFrequency>
 ...
 <owl:Thing rdf:about="#WiTilt30BinaryModeFrequencyValue">
   <rdf:type rdf:resource="#FrequencyValue"/>
   <hasQuantityValue rdf:datatype="&xsd;float">610</hasQuantityValue>
 </owl:Thing>
 ...
 <owl:Class rdf:about="#FrequencyValue">
   <rdfs:label>Frequency value</rdfs:label>
   ...
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="#hasQuantityUnitOfMeasurement"/>
       <owl:hasValue rdf:resource="http://purl.oclc.org/NET/muo/ucum/unit/frequency/Herz"/>
     </owl:Restriction>
   </rdfs:subClassOf>
   <rdfs:comment>Frequency value measured in Hz.</rdfs:comment>
 </owl:Class>
 

Now, we assume that our example sensor attached to a knife operates in the binary output mode and has its measurement range set to +/-1.5g. As shown above, its measurement capabilities are described using the instance ExampleWiTiltAccelerometerMeasurementCapability. This instance is defined in the following way:

 <owl:Thing rdf:about="#ExampleWiTiltAccelerometerMeasurementCapability">
   <rdf:type rdf:resource="#WiTilt30AccelerationMeasurementCapability"/>
   <ssn:hasMeasurementProperty rdf:resource="#WiTilt30BinaryModeFrequency"/>     
   <ssn:hasMeasurementProperty rdf:resource="#WiTilt30MeasurementRange_1"/>
 </owl:Thing>
 

Observation

A concept map containing the second half of this example and focusing on the observation elements

Figure 5.32 - Smart product example: Observation

In this section, we describe an example of an observation which our sensor can produce. An observation is represented by an instance of the class ssn:Observation. To describe acceleration observations, we define the class AccelerationObservation as a subclass of the class ssn:Observation.

 <owl:Class rdf:about="#AccelerationObservation">
   <rdfs:label>Acceleration observation</rdfs:label>
   <rdfs:comment>A class describing acceleration observations. Properties ssn:observationResult, ssn:observedBy, and 
                 ssn:observedProperty are restricted accordingly.</rdfs:comment>
   <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#Observation"/>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observationResult"/>
       <owl:allValuesFrom rdf:resource="#AccelerationSensorOutput"/>
     </owl:Restriction>
   </rdfs:subClassOf>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observedBy"/>
       <owl:allValuesFrom rdf:resource="#Accelerometer"/>
     </owl:Restriction>
   </rdfs:subClassOf>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observedProperty"/>
       <owl:hasValue rdf:resource="&ucum;physical-quality/acceleration"/>
     </owl:Restriction>
   </rdfs:subClassOf>
 </owl:Class>
 

Moreover, we define the class AccelerationSensorOutput as a subclass of the class ssn:SensorOutput to represent results of acceleration observations.

 <owl:Class rdf:about="#AccelerationSensorOutput">
   <rdfs:label>Acceleration sensor output</rdfs:label>
   <rdfs:comment>A class describing sensor output for acceleration measurements. 
   Properties ssn:hasValue and ssn:isProducedBy are restricted accordingly.</rdfs:comment>
   <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#SensorOutput"/>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#hasValue"/>
       <owl:allValuesFrom rdf:resource="#AccelerationValue"/>
     </owl:Restriction>
   </rdfs:subClassOf>
   <rdfs:subClassOf>
     <owl:Restriction>
       <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#isProducedBy"/>
       <owl:allValuesFrom rdf:resource="#Accelerometer"/>
     </owl:Restriction>
   </rdfs:subClassOf>
 </owl:Class>
 

Then, having these subclasses, we can represent the results produced by our accelerometer. For example, it captured a movement of the knife with the acceleration of 0.98g. This observation can be encoded using the following three instances:

 <owl:Thing rdf:about="#KnifeCuttingObservation_435782677">
   <rdf:type rdf:resource="#AccelerationObservation"/>
   <rdfs:comment>An example of the acceleration observation produced by our ExampleWiTilt30Accelerometer. </rdfs:comment>
   <ssn:observationResult rdf:resource="#KnifeSensorOutput_2355676"/>
   <ssn:featureOfInterest rdf:resource="#Knife_123"/>
   <ssn:observedBy rdf:resource="#ExampleWiTilt30Accelerometer"/>
 </owl:Thing>
 ...
 <owl:Thing rdf:about="#KnifeSensorOutput_2355676">
   <rdf:type rdf:resource="#AccelerationSensorOutput"/>
   <rdfs:comment>An example of the acceleration sensor output produced by our ExampleWiTilt30Accelerometer. </rdfs:comment>
   <ssn:isProducedBy rdf:resource="#ExampleWiTilt30Accelerometer"/>
   <ssn:hasValue rdf:resource="#ZAxisAccelerationMeasurementValue"/>
 </owl:Thing>
 ...
 <AccelerationValue rdf:about="#ZAxisAccelerationMeasurementValue">
   <hasQuantityValue rdf:datatype="&xsd;float">0.98</hasQuantityValue>
 </AccelerationValue>