Versions Compared

Key

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

...

Instantiation: model instance(s) are created when model attribute values are provided (by Create/Save queries). Model instance data is always persisted in the storage (but workflow instances remain in the memory).

Updated: changes to the model instance attributes will result in updates of the model instance data in the storage. Updates can happen in two ways:

...

Models can be "partially" instantiated. That is, if some, but not all attribute values are given, then model instance(s) will still be created with the attributes which have value. The other attribute values can be provided later as model instance updates.

Example of a Create query to instantiate a TempSensor model.

Code Block
languagexml
titleModel Instantiation
linenumberstrue
<Create format="version,current"> <!-- This will create -->
   <TempSensor>
            <peripheral>serial</peripheral>
            <baudrate>115200</baudrate>
            <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
titleModel Deployment
linenumberstrue
<NewFacetInstance fid="[:FacetIDName:]"
        Name="[:FacetInstanceName:]" Type="SffTqlFacet">
        <OnActivate>
            <NewFacetInstance name="tqlwf" type="SffWdlFacet" />
            <TopicFacet>?TQLGenericTopic</TopicFacet>
            <Process>
                <Storage Name="[:TQLCacheName:]"
                    Type="SqlSff"
                    Comment="[:TQLCacheName:] Database SFF Unstructured SQL database" />
                <Namespace>
                    <Include>[:ModelFile:]</Include> <!-- ModelFile contains the definition for the model -->
                </Namespace>
            </Process>
        </OnActivate>
        ...

 

Models are only definitions like Schema in database. Once the models are defined, instances can be created by using 'Create' or 'Save'. Instances are data and workflow instances. data is always persisted in the storage, but workflow remains in the memory.

...

languagexml
titleModel Instantiation
linenumberstrue

...

 

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.

...