Versions Compared

Key

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

...

Compilation: a model is deployed to TQLEngine A-Stack and the definition is compiled

...

Deleted: the model instance is removed. This is done by a DeleteAll query (need conformation).

In ThingModels and AppModels, model lifecycle is closely linked to the workflow lifecycle (DataModels do not have Actions or workflows). 


Gliffy
nameModel Lifecycle

...

Example of a Create query to instantiate a TempSensor model.

Code Block
languagexmlpy
titleModel Instantiation
linenumberstrue
<Create#
Create(format="version,current"> <!--):
# This will create
-->
   <TempSensor>
            <peripheral>serial</peripheral>
            <baudrate>115200</baudrate>
            <interfacePort>	TempSensor:
	peripheral: serial
	baudrate: 115200
	interfacePort: "/dev/cu.usbserial-AL01C0ME</interfacePort>
            <interface>serial</interface>
            <format>ascii</format>
            <operation>receive</operation>
            <uniqueId>76522</uniqueId>
            <payload>$Null()</payload>
            <tempValue>$Null()</tempValue>
    </TempSensor>
</Save>

 

Models are defined by using ThingModel, AppModel or DataModel types.

Code Block
languagexml
titleThingModel
linenumberstrue
<ThingModel Name="TempSensor" combines="TempFacetSerial">
       <Sid Name="sensorId" />
</ThingModel>

 

 

Once Model definitions are deployed in the engine, engine creates the meta data for the models in the storage defined in the deployment script.

AL01C0ME"
	interface: serial
	format: ascii
	operation: receive
	uniqueId: 76522
	payload: $Null()
	tempValue: $Null()

For update and delete, see common CRUD operations on models.

Model instance data

A-Stack maintains model instances data in the storage (TQLCache) based on the model definition (the model definition itself is not stored, but held in memory). The model instance data storage type is defined in the deployment script. For example, the the deployment script below, the <Process> points to the [:ModelFile:], which will be replaced by the model definition file name at the time of deployment. The Type="Sqlsff" defines that storage type is the SFF unstructured SQL database.

Note

Model instance data may also be stored in external databases (SQL or NoSQL) by providing the connecting string to the <Storage>.


Code Block
languagexml
titleModel Deployment
linenumberstrue
<NewFacetInstance#
NewFacetInstance(fid=: "[:FacetIDName:]"
        Name=, Name: "[:FacetInstanceName:]", Type=: "SffTqlFacet">):
  OnActivate:
     <OnActivate>
            <NewFacetInstance name=NewFacetInstance(name: "tqlwf", type=: "SffWdlFacet"):
/>      TopicFacet:   TQLGenericTopic
   <TopicFacet>?TQLGenericTopic</TopicFacet>     Process:
       <Process>                 <Storage Name=Storage(Name: "[:TQLCacheName:]"
                    Type=, Type: "SqlSff"
                    Comment=, Comment: "[:TQLCacheName:] Database SFF Unstructured SQL database" />):
          Namespace:
     <Namespace>                     <Include>	Include: [:ModelFile:]</Include> <!-- ModelFile  #ModelFile contains the definition for the model -->
                </Namespace>
            </Process>
        </OnActivate>
        ...

 

 

In data centeric world, sometimes partioning between model and instances can be grey. In purety, model is something, where every essential attribute is not defined yet.  In other words, any instance can be defined with only partial attributes of the model, as long as model declares it legal. In TQLEngine, instances are created only through create or save query.

Clarify the relationship/dependencies between model lifecycle and workflow lifecycle (if a workflow is defined within a action in the model)

When model is deployed, its definition along with action workflows are staged in memory as per the modifier limit. As when instance gets created, workflows may get activated, if actionable attribute is updated. Modifier - live decides on number of active instances of the workflows. When workflow is done executing the tasks, it will get trashed. If any of the task is marked as 'while="true"', that will maintain the workflow in the active state for ever.

 

...