### General Overview

Figure 1 shows an overview of the main classes of SAREF and their relationships.

Figure 1: Overview of the SAREF ontology

### Device

SAREF focuses on the concept of device, which is defined as a tangible object designed to accomplish a particular task in households, common public buildings or offices. In order to accomplish this task, the device performs one or more functions. Examples of devices are a light switch, a temperature sensor, an energy meter and a washing machine. A washing machine is designed to wash (task) and to accomplish this task it performs a start and stop function. The saref:Device class and its properties are shown in Figure 2.

Figure 2: Device class

A saref:Device can have some properties that uniquely characterize it, namely its model and manufacturer (saref:hasModel and saref:hasManufacturer properties, respectively).

SAREF is conceived in a modular way in order to allow the definition of any device from pre-defined building blocks, based on the function(s) that the device performs. Therefore, a saref:Device has at least one function (saref:hasFunction min 1 saref:Function). Moreover, a saref:Device can be used for (saref:isUsedFor property) the purpose of offering a commodity, such as saref:Water or saref:Gas. It can also measure a property, such as saref:Temperature, saref:Energy and saref:Smoke. Moreover, a device may consist of other devices (saref:consistsOf property).

Figure 3: Types of devices
As shown in Figure 3, types of devices that can be represented are actuators (e.g. a saref:Switch that can be further specialized in saref:LightSwitch and saref:DoorSwitch), sensors (e.g. a saref:SmokeSensor and saref:TemperatureSensor), meters, and appliances. Note that more types of devices, sensors and actuators exist which can be defined to extend SAREF (the device types in Figure 4 represent only some examples that aim at explaining the rationale behind SAREF). A description of these types of devices is presented in the next clause, in combination with the function that they perform. Examples of devices for specific domains are defined in the SAREF extensions ([i.2] to [i.7]).

### Function

A function is represented in SAREF with the saref:Function class and is defined as the functionality necessary to accomplish the task for which a device is designed. Examples of functions are saref:ActuatingFunction, saref:SensingFunction, saref:MeteringFunction and saref:EventFunction. The saref:Function class and its properties are shown in Figure 4.

In particular:

- The saref:ActuatingFunction allows to transmit data to actuators, such as level settings (e.g. temperature) or binary switching (e.g. open/close, on/off) and can be divided into different types, such as for example:

- The actuating function of type saref:OnOffFunction allows to switch on and off an actuator. This function allows the commands saref:OnCommand, saref:OffCommand and saref:ToggleCommand.
- The actuating function of type saref:LevelControlFunction allows to do level adjustments of an actuator in a certain range (e.g. 0%-100%), such as dimming a light or set the speed of an electric motor. This function allows the commands saref:SetLevelCommand (which can be of type saref:SetAbsoluteLevel or saref:SetRelativeLevel), saref:StepUpCommand and saref:StepDownCommand.

- The saref:SensingFunction allows to transmit data from sensors, such as measurement values (e.g. temperature) or sensing data (e.g. occupancy). This function allows the command saref:GetCommand.
- The saref:MeteringFunction allows to get data from a meter, such as current meter reading or instantaneous demand. This function allows the commands saref:GetCurrentMeterValueCommand, saref:GetMeterDataCommand, and saref:GetMeterHistoryCommand.
- The saref:EventFunction allows to notify another device that a certain threshold value has been exceeded. This function allows the command saref:NotifyCommand.

Figure 4: Function class

In order to show how these functions shall be used, some examples of devices and their functions are defined as follows:

- a washing machine is a device of type saref:Appliance, accomplishes the task saref:Washing and performs an actuating function of type saref:StartStopFunction;
- a sensor is a device of type saref:Sensor and performs a saref:SensingFunction;
- a temperature sensor is a device that consists of a sensor, is of type saref:Sensor, performs the saref:SensingFunction and measures a property of type saref:Temperature;
- a smoke sensor is a device that consists of a sensor, is of type saref:Sensor, performs the saref:SensingFunction (to measure a property of type saref:Smoke) and saref:EventFunction (to notify that a certain threshold has been exceeded);
- a switch is a device that is of type saref:Actuator and performs an actuating function of type saref:OnOffFunction or saref:OpenCloseFunction;
- a door switch is a device that consists of a switch, is of type of saref:Actuator, performs the saref:OpenCloseFunction and is used for the purpose of controlling a building object such as a door;
- a dimmer lamp is a device that is of type saref:Actuator, performs an actuating function of type saref:LevelControlFunction and measures a property of type saref:Light;
- a meter is a device that is of type saref:Meter and performs a saref:MeteringFunction;
- an energy meter is a device that consists of a meter, is of type saref:Meter, performs the saref:MeteringFunction and measures the saref:Energy property.

### Command

A saref:Function shall have at least one command associated to it (saref:hasCommand min 1 saref:Command). Figure 5 shows the list of commands currently available in SAREF. This list is used here for illustration purposes and can be extended with new commands.

Figure 5: Command class

For example:

- The commands saref:OnCommand, saref:OffCommand and saref:ToggleCommand are associated to the function saref:OnOffFunction.
- The commands saref:SetLevelCommand (which can be of type saref:SetAbsoluteLevel or saref:SetRelativeLevel), saref:StepUpCommand and saref:StepDownCommand are associated to the function saref:LevelControlFunction.
- The command saref:GetCommand is associated to the function saref:SensingFunction.
- The commands saref:GetCurrentMeterValueCommand, saref:GetMeterDataCommand, saref:GetMeterHistoryCommand are associated to the function saref:MeteringFunction.
- The command saref:NotifyCommand is associated to the function saref:EventFunction.

Figure 5 further shows that a command can act upon a state (saref:actsUpon relation) to represent that the consequence of a command can be a change of state of a device. Note that a command may act upon a state, but does not necessarily act upon a state. For example, the saref:OnCommand acts upon the saref:OnOffState, but the saref:GetCommand does not act upon any state, since it only gives a directive to retrieve a certain value.

### State

Depending on the function(s) it performs, a device can be found in a corresponding saref:State, as shown in Figure 6. For example, a switch can be found in the saref:OnOffState, which is further specialized in saref:OnState and saref:OffState. A light switch can be found in the saref:OnOffState upon which the saref:OnCommand and saref:OffCommand shall act. Note that SAREF is not restricted to binary states such as the saref:OnOffState, but allows to define also n-ary states (see, for example, the saref:MultiLevelState class).

Figure 6: State class

### Service

Figure 7 shows that a device offers a service (the saref:Service class), which is a representation of a function to a network that makes this function discoverable, registerable and remotely controllable by other devices in the network. A service shall represent at least one function (saref:represents min 1 saref:Function) and is offered by at least one device that wants (a certain set of) its function(s) to be discoverable, registerable and remotely controllable by other devices in the network (saref:isOfferedBy min 1 saref:Device). Multiple devices can offer the same service. A service shall specify the device that is offering the service and the function(s) to be represented.

For example, a light switch can offer the service of remotely switching the lights in a home through mobile phone devices that are connected to the local network (saref:SwitchOnService class). This "remote switching" service represents the saref:OnOffFunction previously described.

Note that the concept of service is further elaborated in the oneM2M Base Ontology [4], to which the reader is referred in order to model the details of a service that are out of the scope of SAREF.

Figure 7: Service class

### Profile

A device in SAREF can be further characterized by a profile. Figure 8 shows the saref:Profile class and its properties. A profile is a specification associated to a device to collect information about a certain property or commodity (e.g. energy or water) for optimizing its usage in the home/building in which the device is located. Therefore, a profile is linked to a certain property or commodity (using the saref:isAbout property), can be calculated over a time span (using the saref:hasTime property) and can be associated to some costs (using the saref:hasPrice property). A specialization of a profile is the Power Profile defined in the SAREF4ENER extension in ETSI TS 103 410-1 [i.2] (this power profile can be associated to a device for optimizing the energy efficiency in the home/building in which the device is located).

Figure 8: Profile class

### Measurement, Property, and Unit of Measure

The classes saref:Measurement, saref:Property and saref:UnitOfMeasure allow to relate different measurements from a given device for different properties measured in different units, i.e. the saref:Measurement class describes a measurement of a physical quantity (using the saref:hasValue property) for a given saref:Property and according to a given saref:UnitOfMeasure. In this way, it is possible to differentiate between properties and the measurements made for such properties, and to store measurements for a concrete property in different units of measurement. Furthermore, a timestamp can be added (using the saref:hasTimestamp property) to identify when the measurement applies to the property, which can be used either for single measurements or for series of measurements (e.g. measurement streams). Figure 9 shows that a saref:Device can measure or control a saref:Property (which may be from a saref:FeatureOfInterest), which in turn relates to a saref:Measurement, which in turn is measured in a given saref:UnitOfMeasure. Note that it is possible to follow also the inverse direction in which a saref:Device makes a measurement in a certain unit of measure (using the saref:makesMeasurement property), and this measurement can be related to a saref:Property (using the saref:relatesToProperty property). A saref:FeatureOfInterest represents any real world entity from which a saref:Property is measured.

As an example, the saref:Power and saref:Energy classes can be related to a certain measurement value (using the saref:hasValue property), which is measured in a certain unit of measure i.e. Kilowatt for power (saref:PowerUnit) and Kilowatt_Hour for energy (saref:EnergyUnit). Analogously, the saref:Price class can be related to a certain measurement value that is measured using a certain saref:Currency, which is a subclass of the saref:UnitOfMeasure class. Further examples on how to define units of measure can be found in the different SAREF extensions ([i.2] to [i.7]).

The saref:Time class allows to specify the "time" concept in terms of temporal entities (i.e. instants or intervals) according to the existing W3C® Time ontology to avoid defining this concept from scratch.

Figure 9: Measurement class