...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<ThingModel# ThingModel(Name=: "PhidgetServoModel", Combines=: "PhidgetServoFacet"> <Sid Name=): Sid(Name: "PhidServoId"/> <String Name=) String(Name: "InstalledAtZone"/> </ThingModel> <ThingFacet Name="PhidgetServoFacet"> <String Name="ServoProtocolURL" Default=) ThingFacet(Name: "PhidgetServoFacet"): String(Name: "ServoProtocolURL", Default: "phid://"/> <String Name=) String(Name: "DeviceInterfaceIndex"/> <String Name=) String(Name: "PhidgetDeviceType"/> <Integer Name=) Integer(Name: "ServoAngle", KnownBy=: "PhidgetServoAction"/> <Action Name=) Action(Name: "PhidgetServoAction", Documentation=: "Control servo motor"> ): #... </Action> </ThingFacet> |
This pattern allows the ThingFacet to be a reusable artifact, and potentially combined by multiple ThingModels.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<ThingFacet name=# ThingFacet(Name: "EskyPreset">): <String name=String(Name: "State", KnownBy=: "SyncPreset"/>) <String name=String(Name: "Preset", KnownBy=: "SyncPreset"/>) <Action name=Action(Name: "SyncPreset", documentation=: "Synchronize camera state and preset">): <WorkflowWorkflow Limit=: "1", Live=: "1", Timeout=: "PT20S">): <Task name=Task(Name: "Main", while=: "true">): <Event name=Event(Name: "Argument", as=: "ActionArgument"/>) #... </Task> </Workflow> </Action> </ThingFacet> <ThingFacet name=ThingFacet(Name: "EskyImage", combines=: "Login">): <String name=String(Name: "State", KnownBy=: "SyncImage"/>) <Clob name=Clob(Name: "Image", KnownBy=: "SyncImage"/>) <!-- Actions -->#Actions <Action name=Action(Name: "SyncImage", documentation=: "Synchronize camera state and snapshot image">): <WorkflowWorkflow Limit=: "1", Live=: "1", Timeout=: "PT10S">): <Task name=Task(Name: "Main", while=: "true">): <Event name=Event(Name: "Argument", as=: "ActionArgument"/> ... </Task> </Workflow> </Action> </ThingFacet> <ThingModel name="Esky" combines=) ThingModel(Name: "Esky", combines: "EskyPreset,EskyImage", documentation=: "actual single instance camera model">): <Sid name=Sid(Name: "CameraId"/> </ThingModel>) |
In summary
- 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.
...
Expand | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||
|
...