Annex B (informative) ContentFilter and Query examples ToC Previous

B.2 Complex Examples of Query Filters ToC Previous

B.2.5 Example 2 ToC Previous Next

The second example illustrates receiving a list of disjoint Nodes and also illustrates that an array of results can be received.

Example 2: Get PersonType.LastName, AnimalType.Name where a person has a child or (a pet is of type cat and has a feeding schedule).

The NodeTypeDescription parameters used in the example are described in Table B.6.

Table B.6 – Example 2 NodeTypeDescription

Type Definition Node    IncludeSubtypes QueryDataDescription    
    Relative Path Attribute Index Range
PersonType FALSE “.12:LastName” Value N/A
AnimalType TRUE “.12:Name” Value N/A

The corresponding ContentFilter is illustrated in Figure B.6.

readme_files/image048.png readme_files/image049.png readme_files/image050.png readme_files/image051.png readme_files/image052.png readme_files/image053.png readme_files/image054.png readme_files/image055.png readme_files/image056.png readme_files/image057.png readme_files/image058.png readme_files/image058.png readme_files/image059.png readme_files/image060.png readme_files/image056.png readme_files/image061.png readme_files/image062.png readme_files/image063.png readme_files/image064.png readme_files/image065.png readme_files/image066.png readme_files/image067.png readme_files/image068.png Figure B.6 – Example 2 filter logic tree

Table B.7 describes the elements, operators and operands used in the example. It is worth noting that a CatType is a subtype of AnimalType.

Table B.7 – Example 2 ContentFilter

Element[] Operator Operand[0] Operand[1] Operand[2] Operand[3]
0 Or ElementOperand=1 ElementOperand = 2    
1 RelatedTo AttributeOperand = NodeId: PersonType, BrowsePath “.”, Attribute: NodeId AttributeOperand = NodeId: PersonType, BrowsePath “.”, Attribute: NodeId AttributeOperand = NodeId: HasChild, BrowsePath “.”, Attribute: NodeId LiteralOperand = ‘1’
2 RelatedTo AttributeOperand = NodeId: CatType, BrowsePath “.”, Attribute: NodeId AttributeOperand = NodeId: FeedingScheduleType, BrowsePath “.”, Attribute: NodeId AttributeOperand = NodeId: HasSchedule, BrowsePath “.”, Attribute: NodeId LiteralOperand = ‘1’

The results from this query would contain the QueryDataSets shown in Table B.8.

Table B.8 – Example 2 QueryDataSets

NodeId TypeDefinition NodeId RelativePath Value
12:30 (Jfamily1) PersonType . 12:LastName Jones
12:42 (HFamily1) PersonType . 12:LastName Hervey
12:48 (HFamily2) PersonType . 12:LastName Hervey
12:70 (Cat1) CatType . 12:Name Rosemary
12:74 (Cat2) CatType . 12:Name Basil

NOTE The relative path 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 a NodeId not the symbolic name that is included in the table.

Previous Next