Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ThingModel is one kind of models Model (the other kinds are DataModels and AppModels). Therefore it has all the properties of Models (Lifecycle of modelsModel AttributesUnique and Constraints).

A ThingModel has

...

  • PhidgetServoFacet contains the device interaction specific Attributes (e.g. ServoProtocolURL) and Actions (e.g. PhidgetServoAction);
  • PhidgetServoModel contains application related Attributes: PhidServoId and InstalledAtZone (assuming the Phidget servo motor is installed in a particular zone within a Greenhouse environment, which has multiple zones).
  • Combines is used as a modifier of ThingModel

In the most simple simplest case, a ThingModel may only have one single directly defined attribute of type Sid. Although not required, it is best practice to always create a ThingModel with one attribute that is of type SystemId or Sid.

Code Block
languagexml
titlePhidgetServo Thing Model
linenumberstrue
<ThingModel Name="PhidgetServoModel" Combines="PhidgetServoFacet">
	<Sid Name="PhidServoId"/>
	<String Name="InstalledAtZone"/>
</ThingModel>
<ThingFacet Name="PhidgetServoFacet">
	<String Name="ServoProtocolURL" Default="phid://" />
	<String Name="DeviceInterfaceIndex" />
	<String Name="PhidgetDeviceType" />
	<Integer Name="ServoAngle" KnownBy="PhidgetServoAction" />
	<Action Name="PhidgetServoAction" Documentation="Control servo motor">
		...
	</Action>
</ThingFacet>

...

  • ThingModels are normally used to represent and define interactions with external physical things. The specifics of interactions are often modeled via ThingFacet.
  • ThingModels combine one or more ThingFacets. ThingFacets are reusable artifacts. In runtime, only instances of ThingModels are created and persisted (not ThingFacets). 
  • ThingModels can contain application related information that are related to things.

When ThingModels do not combine any ThingFacet they are equivalent to DataModel i.e pure Attributes only.

Examples of CRUD Operation on a ThingModel:

...