Statements
IdentifierSelection
IdentifierKey
KeySelection
NullKeySelection
General
IdentifierSelection statements allow a specific object to be found from the objects that belong to an entity using identifying attributes.
The Model Compiler should use the underlying mechanisms and facilities available to make any search as efficient as possible and certainly more efficient than if the same functionality was written in the equivalent primitive statements.
Typically, the values used in the search originate from the Real World as event data.
Once the object has been found it can be manipulated as required and new relationships can be formed. A new relationship can be established with the object through use of the Relate statement; when this is done the IdentifierSelection statement is no longer required as the object is simply accessed via the Traverse statement. The object in the new relationship must belong to a non-identifying entity as the searched for object must already have a relationship with an identifying object.
Associated Statements
The IdentifierSelection statements are used with the following Identifier statements:
Identifier
OwnKey
ForeignKey
An identifier is declared by the Identifier statements and actioned by the IdentifierSelection statements.
IdentifierSelection Statement
StateAction
IdentifierSelection:Dog:Dog_Identifier
IdentifierKey
Dog : Name : Dog_name
Dog_Owner : Name : Dog_owner_name
KeySelection
| This subregion in the single context of the Dog.
NullKeySelection
| No Dog was found with the supplied identifying values.
The IdentifierSelection statement introduces the IdentifierKey, KeySelection and NullKeySelection statements.
IdentifierKey Statement
StateAction
IdentifierSelection:Dog:Dog_Identifier
IdentifierKey
Dog : Name : Dog_name
Dog_Owner : Name : Dog_owner_name
KeySelection
| This subregion in the single context of the Dog.
The IdentifierKey statement's data subregion specifies the values to be used for the identifying attributes. The attributes may belong to the searched entity or to a foreign entity. The fields of the data region are: name of the entity, name of the identifying attribute, name of data item containing the value to be matched.
KeySelection Statement
StateAction
IdentifierSelection:Dog:Dog_Identifier
IdentifierKey
Dog : Name : Dog_name
Dog_Owner : Name : Dog_owner_name
KeySelection
| This subregion in the single context of the Dog.
The KeySelection statement provides a subregion where the found object is in context.
NullKeySelection Statement
StateAction
IdentifierSelection:Dog:Dog_Identifier
IdentifierKey
Dog : Name : Dog_name
Dog_Owner : Name : Dog_owner_name
NullKeySelection
| No Dog was found with the supplied identifying values.
If no object exists with the identifying attribute values specified, the statements in the NullKeySelection subregion are executed.
Identifier Selection Example
Declare Dog Owner entity:
Entity:Dog_Owner
Attribute
Text : Name
Identifier:Dog_Owner_Identifier
OwnKey
Name
Declare Dog entity:
Entity:Dog
Attribute
Text : Name
Relationship
Belongs_to --> Dog_Owner
Identifier:Dog_Identifier
OwnKey
Name
ForeignKey
Belongs_to : Dog_Owner : Dog_Owner_Identifier
The IdentifierSelection statement does not depend on the context and can be used anywhere:
StateAction
IdentifierSelection:Dog:Dog_Identifier
IdentifierKey
Dog : Name : Dog_name
Dog_Owner : Name : Dog_owner_name
KeySelection
| This subregion in the single context of the Dog.
Template
<<:>>The identifying values for the Dog found are:
<<:>> <<#Dog.Name>> / <<#Dog_owner_name>>
NullKeySelection
| This subregion in the original state action context.
Template
<<:>>No Dog was found with the identifying values:
<<:>> <<#Dog_name>> / <<#Dog_owner_name>>
|