The Query Tree


The Query Tree is generated by the Parser from the Token Tree. The Syntax of the Query is already checked at this point and several operations have been eliminated for the Query to work. The Query Tree has an Object Context given by the Class Index for that object (using the abstract)


Leaf Node: Predicate Tree.   P 
NonLeaf Nodes: Association Query   A
Bag Query   B
Intersect   I
Union   U
Except / Difference   E
Data members:
Class Index  All
Distinct Flag All NonLeaf Nodes 
Pointer to Children  All NonLeaf Nodes
Predicate String A, B 
Association Name  A
Predicate Tree Object P
Intersection Object P
The Class Index specifies the object class the Query is to run on. Allowed classes are


Name Alias
sxpPCatObject pobj
sxpPCatField pfld
sxpPCatRun prun
sxpPCatDescriptor pdes
sxpSCatObject sobj
sxpSCatTarget stgt

 A Distinct Flag on every NonLeaf Node tells us whether a Bag or a Set should be the result of the operation.

The Predicate String is only needed for the Bag and Association Queries because they operate on an incoming bag.

The Association Name defines the Member Chain for the Association Query.

The Predicate Tree and Intersection objects are explained below.

For the details of the class structure and the format of the input/output stream consult the appendix.


                 The multiple node:          

                 The binary nodes


                   The unary nodes

                    The leaf node The rules of how these are put together are displayed above. A Q means a Query Tree, a P a predicate tree. At any node the incoming branches have to have the same class. The only node that can change the class is an Association.