Home   :   Matrix Language   :   Pattern Statements   :   Traverse Identifier Statements

Traverse Identifier Statements

 

Statements

 

TraverseIdentifier

TraverseKey

NullIdentifierSelection

 

 

General

 

The purpose of the TraverseIdentifier statement is to select a particular object when navigating a relationship using identifying attributes.

 

The TraverseIdentifier statement is used within the Traverse and TraverseUnique statements.

 

 

TraverseIdentifier Statement

 

StateAction

Traverse

TraverseIdentifier:Dog:Dog_Name

TraverseKey

Dog       : Name : Dog_name

Dog_Owner : Name : Dog_owner_name

NullIdentifierSelection

| An object of Dog could not be found with the supplied

| identifying attributes.

 

The TraverseIdentifier statement introduces one TraverseKey statement and one optional NullIdentifierSelection statement.

 

 

TraverseKey Statement

 

StateAction

Traverse

TraverseIdentifier:Dog:Dog_Name

TraverseKey

Dog       : Name : Dog_name

Dog_Owner : Name : Dog_owner_name

 

The TraverseKey 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.

 

 

NullIdentifierSelection Statement

 

StateAction

Traverse

TraverseIdentifier:Dog_Home:Dog_Home_Name

TraverseKey

Dog_Home : Name : Dog_home_name

NullIdentifierSelection

| An object of Dog Home could not be found with the

| supplied identifying attribute.

Template

<<|>>Only the original context of Manager is available

<<:>>in this subregion. Thus <<#Manager.Name>> is valid.

 

The optional NullIdentifierSelection statement provides a subregion where the statements are only executed if during the navigation an object fails to match with identifying values.

 

If the NullIdentifierSelection subregion is executed then neither the TraverseSelection subregion or the NullTraverseSelection subregion are executed and no new context is created.

 

 

Traverse Identifier Example

 

Declare Manager entity:

 

Entity:Manager

Attribute

Text : Name

Relationship

Governs ->> Dog_Home

Identifier:Manager_Name

OwnKey

Name

 

Declare Dog Home entity:

 

Entity:Dog_Home

Attribute

Text : Name

Relationship

Employs ->> Attendant

Identifier:Dog_Home_Name

OwnKey

Name

 

Declare Attendant entity:

 

Entity:Attendant

Attribute

Text : Name

Relationship

Works_at    --> Dog_Home

Assigned_to ->> Kennel

Identifier:Attendant_Name

OwnKey

Name

ForeignKey

Works_at : Dog_Home : Dog_Home_Name

 

Declare Kennel entity:

 

Entity:Kennel

Attribute

Number : Number

Relationship

Houses |>> Dog

Identifier:Kennel_Number

OwnKey

Number

 

Declare Dog Owner entity:

 

Entity:Dog_Owner

Attribute

Text : Name

Identifier:Dog_Owner_Name

OwnKey

Name

 

Declare Dog entity:

 

Entity:Dog

Attribute

Text : Name

Relationship

Belongs_to --> Dog_Owner

Wears      -|> Gps_Collar

Identifier:Dog_Name

OwnKey

Name

ForeignKey

Belongs_to : Dog_Owner : Dog_Owner_Name

 

Declare GPS Collar entity:

 

Entity:Gps_Collar

Attribute

Number : Number

Identifier:Gps_Number

OwnKey

Number

 

In the Manager entity state action context (as shown) or in any Manager context in another entity:

 

StateAction

Traverse

TraverseIdentifier:Dog_Home:Dog_Home_Name

TraverseKey

Dog_Home : Name : Dog_home_name

NullIdentifierSelection

| An object of Dog Home could not be found with the

| supplied identifying attribute. Neither TraverseSelection

| or NullTraverseSelection are executed.

Template

<<|>>Only the original context of Manager is available

<<:>>in this subregion. Thus <<#Manager.Name>> is valid.

TraverseIdentifier:Attendant:Attendant_Name

TraverseKey

Attendant : Name : Attendant_name

Dog_Home  : Name : Dog_home_name

TraverseIdentifier:Kennel:Kennel_Number

TraverseKey

Kennel : Number : Kennel_number

TraverseIdentifier:Dog:Dog_Name

TraverseKey

Dog       : Name : Dog_name

Dog_Owner : Name : Dog_owner_name

NullIdentifierSelection

| An object of Dog could not be found with the supplied

| identifying attributes. Neither TraverseSelection or

| NullTraverseSelection are executed.

Template

<<|>>Only the original context of Manager is available

<<:>>in this subregion. Thus <<#Manager.Name>> is valid.

Navigation

Manager   : Governs     : Dog_Home

Dog_Home  : Employs     : Attendant

Attendant : Assigned_to : Kennel

Kennel    : Houses      : Dog

Dog       : Wears       : Gps_Collar

TraverseSelection

| All identifier specified objects were found when examined

| and all conditional relationships (if any) were instantiated.

Template

<<|>>The following contexts are available:

<<:>>    <<#Manager.Name>>

<<:>>    <<#Dog_Home.Name>>

<<:>>    <<#Attendant.Name>>

<<:>>    <<#Kennel.Number>>

<<:>>    <<#Dog.Name>>

<<:>>    <<#Gps_Collar.Number>>

NullTraverseSelection

| Although identifier specified objects were found when

| examined, one or more conditional relationships were not

| instantiated.

Template

<<|>>Only the original context of Manager is available

<<:>>in this subregion. Thus <<#Manager.Name>> is valid.

Copyright 2017 Dark Matter Systems Ltd. All Rights Reserved.