6.3 Device models using Semantic Modelling

A SAREF description of the washing machine is mapped to the resource structure shown in Figure 6 using the rules described in TS-0030 and TS-0012. A complete derivation of this example is shown in [ref to TS-0012] Annex B.1.3.3.

The description of our (simplified) washing machine using SAREF ontology is expanded upon here:

  • The state of the washing machine is given by SAREF:state: WashingMachineStatus that can take the values "WASHING" or "STOPPED" or "ERROR".
  • The washing machine has an actuating function: StartStopFunction which has three commands:

    • ON_Command
    • OFF_Command
    • Toggle_Command
  • The washing machine has also a metering function: MonitoringFunction that sets the WashingMachineStatus.

  • The washing machine is located at My_Bathroom.

Later we will see that the description here has triples that are intended to help define the resosurce tree structure according to the rules described in TS-0030 and TS-0012. However, when the description of the clothes-washing machine is put into a <semanticdescriptor> some are removed because they do not offer information useful for SPARQL queries.

Note

@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix oneM2M: <http://www.onem2m.org/ontology/Base_Ontology/> .
@prefix saref: <https://saref.etsi.org/core/> .
@prefix s4bldg: <https://saref.etsi.org/saref4bldg/> .
@prefix sn:    <http://www.XYZ.com/WashingMachines/SerialNumbers/> .

sn:WASH_XYZ
    a                      <http://www.XYZ.com/WashingMachines#XYZ_Cool> ;
    rdfs:comment           "Very cool Washing Machine" ;
    saref:hasFunction      sn:WASH_XYZ-MonitoringFunction , sn:WASH_XYZ-StartStopFunction ;
    saref:hasManufacturer  "XYZ" ;
    saref:hasService       sn:WASH_XYZ-MonitorService , sn:WASH_XYZ-SwitchOnService ;
    saref:hasState         sn:WASH_XYZ-WashingMachineStatus ;
    s4bldg:isContainedIn   sn:My_Bathroom .

sn:WASH_XYZ-StartStopFunction-OFF_Command     a       saref:OffCommand .
sn:WASH_XYZ-StartStopFunction-Toggle_Command  a       saref:ToggleCommand .
sn:WASH_XYZ-StartStopFunction-ON_Command      a       saref:OnCommand .
sn:WASH_XYZ-MonitoringFunction                a       saref:SensingFunction ;
                saref:hasCommand  sn:WASH_XYZ-MonitoringFunction-WashingMachineStatus .


sn:WASH_XYZ-StartStopFunction                 a       saref:ActuatingFunction ;
                saref:hasCommand  sn:WASH_XYZ-StartStopFunction-Toggle_Command ,
                                  sn:WASH_XYZ-StartStopFunction-OFF_Command ,
                                  sn:WASH_XYZ-StartStopFunction-ON_Command .

Figure 7: SAREF Washing Machine Model

Figure 7: SAREF Washing Machine Model

  • The procedure defined in TS-0012 require the IPE to parse the semantic description to generate a total of three custom <flexContainer> definitions to support the structure shown in Figure 7. The schemas generated are added as the content of a <contentInstance> resource under a container for these custom definitions. The locations of these schemas are referenced in the container definition attribute of the respective <flexContainer>.
  • two <flexContainer> child-resources for Services and their <semanticDescriptor>s are used for modelling the services SwitchOnService and MonitorService;
  • the SwitchOnService in turn has a child resource of type <flexContainer> for Operations which exposes the Toggle_Command;
  • one customAttribute of the SwitchOnService <flexContainer> is used for holding the values for InputDataPoint: BinaryInput;
  • one customAttribute of the MonitorService <flexContainer> is used for holding the values for OutputDataPoint: WashingMachineStatus.

Figure 8: SAREF Model oneM2M Call Flows

Figure 8: SAREF Model oneM2M Call Flows

Only the messages highlighted in light blue are described here as the rest of the messages are the same as in the general call flow described in clause 6.1.

  • Create Information Model. The IPE creates all the resources needed to for the clothes washing machine that it generates from parsing the semantic description. This IPE is developed with awareness of the clothes washing machine interface but without awareness of the model that it is creating in the oneM2M CSE. This requires extra logic to parse the RDF triples to generate custom container definitions, which is not included in this example as only the output of the parsing process is shown.
  • A <flexContainer> resource is created for the MonitorService with a single custom attribute washingMachineStatus. The IPE updates this resource with the following content when there are any changes in the status of the clothes washing machine:
{
    "WashingMachineStatus": "WASHING", // Or "STOPPED", "ERROR"
}
  • A <flexcontainer> resource is created for the SwitchOnService that allows command and control of the clothes washing machine. The client application sets the state of the device by updating the resource with the following payload:
{
  "BinaryInput": false
}
  • A <flexcontainer> resource is created for the Toggle command as a child of the SwitchOnService. This action is used to change the current state of the clothes washing machine. The client application toggles the state of the device by sending an update request to the resource with an empty payload.
  • A <subscription> resource is created as a child of the Toggle command <flexContainer> resource by the IPE. This will cause a notification to be sent to the IPE when a new command is made by an application.
  • A <subscription> resource is created as a child of the SwitchOnService <flexContainer> resource by the IPE. This will cause a notification to be sent to the IPE when a new command is made by an application