Annex B (informative) Content Filter and Query Examples ToC Previous

B.2 Complex Examples of Query Filters ToC Previous

B.2.10 Example 7 ToC Previous Next

The seventh example provides an illustration a request in which a Client wants to display part of the AddressSpace based on a starting point that was obtained via browsing. This request includes listing References as something that is to be returned. In this case the Person Browsed to Area2 and wanted to Query for information below this starting point.

Example 7: Get PersonType.NodeId, AnimalType.NodeId, PersonType.HasChild Reference, PersonType.HasAnimal Reference where the person is in Area2 (Cleveland nodes) and the person has a child.

Table B.22 describes the NodeTypeDescription parameters used in the example.

Table B.22 – Example 7 NodeTypeDescription

Type Definition Node Include
Subtypes
QueryDataDescription    
    Relative Path Attribute Index Range
PersonType FALSE “.NodeId” Value N/A
    <12:HasChild> Value N/A
    <12:HasAnimal>NodeId Value N/A
    <12:HasAnimal> Value N/A

The corresponding ContentFilter is illustrated in Figure B.11. Note that the Browse call would typically return a NodeId, thus the first filter is for the BaseObjectType with a NodeId of 95 where 95 is the NodeId associated with the Area2 node, all Nodes descend from BaseObjectType, and NodeId is a base Property so this filter will work for all Queries of this nature.

readme_files/image052.png Figure B.11 – Example 7 Filter Logic Tree

Table B.23 describes the elements, operators and operands used in the example.

Table B.23 – Example 7 ContentFilter

Element[] Operator Operand[0] Operand[1] Operand[2] Operand[3]
0 RelatedTo ElementOperand = 2 ElementOperand = 1 AttributeOperand = Node:HierachicalReference, BrowsePath “.”, Attribute:NodeId LiteralOperand = ‘1’
1 RelatedTo AttributeOperand =
NodeId: 12:PersonType, BrowsePath “.”, Attribute: NodeId
AttributeOperand = NodeId: 12:PersonType, BrowsePath “.”, Attribute: NodeId AttributeOperand =
NodeId: 12:HasChild, BrowsePath “.”,
Attribute: NodeId
LiteralOperand = ‘1’
2 Equals AttributeOperand =
NodeId: BaseObjectType, BrowsePath “.”,
Attribute: NodeId,
LiteralOperand = ‘95    

The results from this Query would contain the QueryDataSets shown in Table B.24.

Table B.24 – Example 7 QueryDataSets

NodeId TypeDefinition
NodeId
RelativePath Value
12:42 (HFamily1) PersonType “.NodeId” 12:42 (HFamily1)
    <12:HasChild> HasChild ReferenceDescription
    <12:HasAnimal>12:AnimalType.NodeId NULL
    <12:HasAnimal> HasFarmAnimal ReferenceDescription
12:48 (HFamily2) PersonType “.NodeId” 12:48 (HFamily2)
    <12:HasChild> HasChild ReferenceDescription
    <12:HasAnimal>12:AnimalType.NodeId 12:91 (Pig1)
    <12:HasAnimal> HasFarmAnimal ReferenceDescription

NOTE The RelativePath and browse name (in parentheses) is not in the QueryDataSet and is only shown here for clarity and the TypeDefinition NodeId would be an integer not the symbolic name that is included in the table. The value field would in this case be the NodeId where it was requested, but for the example the browse name is provided in parentheses and in the case of Reference types on the browse name is provided. For the References listed in Table B.24, the value would be a ReferenceDescription which are described in 7.25.

Previous Next