SystemId or Sid is a unique identifier that is automatically assigned by TQLEngine A-Stack to every newly created Model Instance. It is of type "String" and is defined as the following within TQLEnginein TQL.
Code Block |
---|
language | ruby |
---|
theme | xmlEmacs |
---|
title | System ID Definiton |
---|
linenumbers | true |
---|
|
<Def#
Def(name=: "System", inherits=: "Entity", documentation=: "Marker of all system types"/>
<Def name=)
Def(name: "SystemId", alt=: "sid", inherits=: "String,System"/> |
...
Note: SystemId and Sid are synonyms. For the purpose of this document will use Sid when referring to System ID.
Model developers can create define attribute of type SystemId or Sid.
In this example: PhidServoId is defined as Sid.
Code Block |
---|
language | ruby |
---|
theme | xmlEmacs |
---|
title | PhidServoId defined as System ID |
---|
linenumbers | true |
---|
|
<ThingModel#
ThingModel(Name=: "PhidgetServoModel", Combines=: "PhidgetServoFacet">)
<Sid Name=Sid(Name: "PhidServoId"/>
</ThingModel> |
...
When the Model Instance is created, using Create TQL Query, System ID value is automatically generated by TQLEngineA-Stack.
Code Block |
---|
language | ruby |
---|
theme | xmlEmacs |
---|
title | Create Phidget Servo Thing Model Instance |
---|
linenumbers | true |
---|
|
<Query>#
Query:
<Create> Create:
<PhidgetServoModel> PhidgetServoModel:
<ServoProtocolURL> ServoProtocolURL: "phid://"
</ServoProtocolURL>
<PhidgetDeviceType>
PhidgetAdvancedServoServoProtocolURL:
PhidgetDeviceType: "PhidgetAdvancedServo"
</PhidgetDeviceType>
<DeviceInterfaceIndex>
DeviceInterfaceIndex: 0
</DeviceInterfaceIndex>
<ServoAngle>
110
</ServoAngle>
</PhidgetServoModel>
</Create>
</Query>ServoAngle: 110 |
Using the Find TQL Query on PhidgetServoModel
Code Block |
---|
language | ruby |
---|
theme | xmlEmacs |
---|
title | Find Phidget Servo Model |
---|
linenumbers | true |
---|
|
<Query>#
Query:
<Find> Find:
<PhidgetServoModel> PhidgetServoModel:
<PhidServoId PhidServoId(ne="" />
</PhidgetServoModel>
</Find>
</Query> |
...
Find Result is:
Code Block |
---|
language | ruby |
---|
theme | xmlEmacs |
---|
title | Find Result Phidget Servo Model |
---|
linenumbers | true |
---|
|
<Find#
Find(Status="Success">):
<Result>Result:
<PhidgetServoModel>PhidgetServoModel:
<PhidServoId>KNI5JYVPAAAAUAABA4ONNHF2</PhidServoId>
PhidServoId: "KNI5JYVPAAAAUAABA4ONNHF2"
<PhidgetDeviceType>PhidgetAdvancedServo</PhidgetDeviceType> PhidgetDeviceType: "PhidgetAdvancedServo"
<ServoAngle>110</ServoAngle> ServoAngle: 110
<DeviceInterfaceIndex>0</DeviceInterfaceIndex> DeviceInterfaceIndex: 0
<ServoProtocolURL>phid://</ServoProtocolURL> ServoProtocolURL: </PhidgetServoModel>
</Result>
</Find> |
...
Note that the PhidServoId value is automatically generated even though it is NOT specified at the time of Create Query
Code Block |
---|
language | ruby |
---|
theme | xmlEmacs |
---|
title | Automatically Generated System ID |
---|
linenumbers | true |
---|
|
<PhidServoId>KNI5JYVPAAAAUAABA4ONNHF2</PhidServoId>#
PhidServoId: "KNI5JYVPAAAAUAABA4ONNHF2" |
About System ID:
- Are Unique Have unique values per Installation of TQLEngineA-Stack: System ID Values are guaranteed to be Unique for a given Installation of TQLEngineA-Stack.
- Can Value can neither be created given or modified by user: If an attribute is defined of type Sid or SystemId, their values can neither be specified or updated by the user.
- New Values values are generated each time for same model: Each time an instance is deleted and created again new value System ID value.
...