Versions Compared

Key

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

In Atomic Domain Languages an An Action is a named XML Elementelement that describes fundamental a unit of executable functionality.

An Action has a name:  

Code Block
languagexml
titleAction Named Element
linenumberstrue
<Action#
Action(Name=: "RotateCameraACRotateCameraAction", Documentation=: "Simple Action to Rotate ESKYIP-based Camera by x degrees"/>) 

An Action Element can contain following modifiers or attributes:

  • Name
  • Documentation

An Action can be defined in:

  • ThingFacet
  • AppFacet
  • Subscribe

An Action must describe must define executable code in any Atomic Domain Languages - like (Workflow, FacetScript, TQL and , Subscribe, Sequence) or any of their combinations.

How is Action Triggered:

What Does Action mean in case of ThingFacet and AppFacet

The execution of an action represents some interaction with external system, transformation or processing in the modeled system. An action execution represents the run-time behavior of executing an action within a specific behavior execution. All action executions will be executions of specific kinds of actions as defined by internal workflow . Action is executed, when actionable attribute gets updated (modified by KnownBy in the model) by the app or side effect in the system.

An action is the specification of an executable statement and is the fundamental unit of processing or behavior in an Thing or App Model that represents some transformation in the modeled system, triggered by an external event.

An action forms an abstraction of a computational procedure which is an atomic execution and therefore completes without interruption. An action can either be completed in zero time and cannot be interrupted, once started or it can be a more complex collection of behavior that may run for a long duration. In  this scenario, action may be interrupted by events, in which case, it does not run to completion. Zero time execution vs long lasting execution gets defined by the definition of the workflow.

An action of ThingFacet is a result of a device state change or intent to change the state of the device, and is realized by sending a message to an instance or modifying a value of an actionable attribute.

Action is defined as encapsulated workflow, which gets triggered on updates of actionable attributes in ThingModel and/or AppModel. Action can perform synchronous set of activities defined in the workflow.

Where can Action be used in TQL (only in ThingFacets and AppFacets?)

What is the general structure of an Action in TQL? (1 or more workflows?)

Image Removed

Jira LegacyshowSummaryfalseserverJIRA (mqidentity.atlassian.net)serverId77fb3325-4051-36d9-bcc7-761f62050707keyDOCS-5, within one of the following elements:

NOTE: In the case of ThingFacet or AppFacet an Action must start with a Workflow.

Action is associated with attribute(s)

An Action must be associated or attached to a model attribute. In ThingFacets or AppFacets, an Action is associated with an model attribute of the same ThingFacet or AppFacet using the "KnownBy" modifier as below. The associated attribute becomes an actionable attribute.

Code Block
languagexml
titleAction Named Element
linenumberstrue
#
Double(Name: "RotateValue", KnownBy: "RotateCameraAction")

Please refer to <subscribe> and <sequence> for their respective action associations.

See also Associate multiple thing actions.

Action results in changes of the "Known" value(s) of any attributes

From the Action, using the output of the workflow, you can update any attributes of the model. Note that It is always the "Known" value of the attribute that will be updated by Actions. In this example, Action is changing the State and Image attributes.

Code Block
languagexml
titleAction Result
linenumberstrue
#
Output(name: "Result", as: "ActionResult"):
  Value:
    State: "[%:[%:@Output:%]/if([:IOK:]) then 'ON' else 'OFF':%]"
    Image: "[%:[%:@Output:%]/if([:IOK:]) then Invoke/GetImage/Message/Value/text() else '/img/no-image.jpg':%]"

Note: the output of the workflow can update any attribute of the model. This is not limited to the actionable attribute.

Action is triggered by the modification of associated (KnownBy) attribute values

Trigger is an execution phase of an Action. Execution of an Action is asynchronous and can be triggered in any number of ways. Please refer to <subscribe> and <sequence> for their respective action triggers.

In ThingModels and AppModels any updates to the associated attribute(s) values will trigger the Action. This include the initialization of the attributes (i.e. when it first acquires its value). The attribute value updates can only be achieved via TQL queries, in one of the following forms: 

  • External applications using TQL queries to update the value of the attributes. This includes the following example of a Save query to instantiate the model. Here giving the attribute RFID a value of $Null( ) will trigger the Action "KnownBy" this attribute.
  • Internally TQL queries updating the value of the attributes (e.g. TQL queries can be used by models to update values of other model's attributes).

Code Block
languagexml
titleInstantiate a Device using TQL Query
linenumberstrue
#
Query:
  Save(format: "version,current"):
    RfidReader(ReaderId: "R1", URL: "perif://"):
        RFID(value: "$Null()", version: "1")

See also Automatic Action trigger.