Versions Compared

Key

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

...

  • Definition - Models are defined either using TQLStudio Model Editor or any IDE of your choice. 
    Modeling  Modeling Language (Thing Definition Language) is essential to define models.
  • Deploy - As part of a deployable unit within TQLEngine's package file. Models definitions are made part of SffTqlFacet Facet type.
  • Query - Querying of model consists of CRUD as well as Subscription (and notification).

...

Once models are defined and deployed their schematic layout is persisted in Storage (TQL Cache) defined at the time of the deployment. Note thateven that even though models are persisted in SQL type of storage that data is highly unstructured and stored in proprietary format.

Before Models can be queried using Find - Models must be initialized or populated with data. The result of model creation is called Model Instances.

For example: Here is the definition of a ThingModel - PhidgetSensorModel that combines PhidgetSensorFacet. 

 

Attribute values (Value)

Attribute known values (Known)

Version number of each attribute value?

Timestamp of ____?

Sid

...

Storage and update of model instance data:

Only the latest version of the value and known value are stored.

...

Code Block
languagexml
titlePhidgetSensor Thing Model
linenumberstrue
<ThingFacet Name="PhidgetSensorFacet">
  <Integer Name="SensorValue" Update="auto" KnownBy="PhidgetSensorAction"/>
  <String Name="SensorURL" Default="phid://"/>
  <String Name="SensorInterfaceIndex"/>
  <String Name="SensorType"/>
  <String Name="SensorInterfaceType"/>
  <String Name="SensorValueFormat"/>
  <String Name="Simulated"/>
</ThingFacet>
<ThingModel Name="PhidgetSensorModel" Combines="PhidgetSensorFacet">
  <Sid Name="phidId"/>
</ThingModel>

The instances of PhidgetSensorModel is created using Create TQL Query. 

Code Block
languagexml
titleCreate PhidgetSensor ThingModel Instance
linenumberstrue
<Query>
  <Create>
    <PhidgetSensors>
      <SensorURL>phid://</SensorURL>
      <SensorType>Rotation</SensorType>
      <SensorInterfaceType>PhidgetInterfaceKit</SensorInterfaceType>
      <SensorValueFormat>Raw</SensorValueFormat>
      <SensorInterfaceIndex>0</SensorInterfaceIndex>
      <SensorValue value="$Null()" version="1"/>
      <Simulated>true</Simulated>
    </PhidgetSensors>
  </Create>
</Query>