Home   :   Matrix Language   :   Primitive Action Statements   :   Traverse Statements

Traverse Statements

 

Statements

 

    Traverse

    Navigation

    TraverseSelection

    NullTraverseSelection

 

 

Traverse Statement

 

    Traverse

        Navigation

            Bank_Level : Floor_accesses_in           : Bank

            Bank       : Defines_service_features_of : Shaft

        TraverseSelection

            ...

        NullTraverseSelection

            ...

 

The Traverse statement enables an entity to cross over to another entity and take on the new entity as the current context.

 

Although a traverse is defined at the entity level it is realised at the object level, so that a traverse starting from a single source object may iterate over many target objects, each of which become a new context.

 

Whether a source object iterates over one or many target objects depends upon the relationship or relationships navigated in the Navigation statement.   

 

In effect, the Traverse statement makes the associated process in the source entity become part of the target entity.  Indeed the Traverse statement can be implemented as a procedure call on the target entity by the source entity (just like an object calling a method on another object).

 

 

Navigation Statement

 

    Traverse

        Navigation

            Bank_Level : Floor_accesses_in           : Bank

            Bank       : Defines_service_features_of : Shaft

 

The Navigation statement specifies a path for a traverse.  The path is made up from a number of relationship steps specified in the data subregion.  Each step has a source entity, role and target entity.

 

Although data subregion lists are unordered this is one of the rare cases where we enforce an order to ensure clarity.

 

 

TraverseSelection Statement

 

    Traverse

        Navigation

            Bank_Level : Floor_accesses_in           : Bank

            Bank       : Defines_service_features_of : Shaft

        TraverseSelection

            ...

 

This statement provides a new set of object contexts determined by the navigated relationship steps.  If this region is entered there will always be at least one object context available.

 

 

NullTraverseSelection Statement

 

    Traverse

        Navigation

            Bank_Level : Floor_accesses_in           : Bank

            Bank       : Defines_service_features_of : Shaft

        NullTraverseSelection

            ...

 

The NullTraverseSelection subregion is executed if no objects are returned by the navigation.  The statement can only appear if there is at least one conditional relationship in the navigation.

 

Copyright 2017 Dark Matter Systems Ltd. All Rights Reserved.