The fourth example provides an illustration of the Hop parameter that is part of the RelatedTo Operator.
Example 4: Get PersonType.LastName where a person has a child who has a child who has a pet.
Table B.12 describes the NodeTypeDescription parameters used in the example.
Table B.12 – Example 4 NodeTypeDescription
Type Definition Node |
Include Subtypes |
QueryDataDescription |
Relative Path |
Attribute |
Index Range |
PersonType |
FALSE |
“.12:LastName” |
value |
N/A |
The corresponding ContentFilter is illustrated in Figure B.8.
Figure B.8 – Example 4 filter logic tree
Table B.13 describes the elements, operators and operands used in the example.
Table B.13 – Example 4 ContentFilter
Element[] |
Operator |
Operand[0] |
Operand[1] |
Operand[2] |
Operand[3] |
0 |
RelatedTo |
AttributeOperand = NodeId: 12:PersonType, BrowsePath “.”, Attribute: NodeId |
Element Operand = 1 |
AttributeOperand = NodeId: 12:HasChild, BrowsePath “.”, Attribute: NodeId |
LiteralOperand = ‘2’ |
1 |
RelatedTo |
AttributeOperand = NodeId: 12:PersonType, BrowsePath “.”, Attribute: NodeId |
AttributeOperand = NodeId: 12:AnimalType, BrowsePath “.”, Attribute: NodeId |
AttributeOperand = NodeId: 12:HasPet, BrowsePath “.”, Attribute: NodeId |
LiteralOperand = ‘1’ |
The results from this query would contain the QueryDataSets shown in Table B.14. It is worth noting that the pig “Pig1” is referenced as a pet by Sara, but is referenced as a farm animal by Sara’s parent Paul.
Table B.14 – Example 4 QueryDataSets
NodeId |
TypeDefinition NodeId |
RelativePath |
Value |
12:42 (HFamily1) |
PersonType |
“.12:LastName” |
Hervey |
NOTE The RelativePath column and browse name (in parentheses in the NodeId column) are not in the QueryDataSet and are only shown here for clarity. The TypeDefinition NodeId would be an integer not the symbolic name that is included in the table.