B.3.6 Example 3

The third example provides a more complex Query in which the results are filtered on multiple criteria.

Example 3: Get PersonType.LastName, AnimalType.Name, ScheduleType.Period where a person has a pet and the animal has a feeding schedule and the person has a Zipcode = ‘02138’ and (the Schedule.Period is Daily or Hourly) and Amount to feed is > 10.

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

Table B.16 – Example 3 - NodeTypeDescription
Type Definition Node

Include

Subtypes

QueryDataDescription
RelativePathAttributeIndex Range
PersonTypeFALSE“12:LastName”ValueN/A
“<12:HasPet>12:AnimalType. 12:Name”ValueN/A
“<12:HasPet>12:AnimalType<12:HasSchedule> 12:FeedingSchedule.Period”ValueN/A

The corresponding ContentFilter is illustrated in Figure B.7.

Figure B.7 – Example 3 filter logic tree

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

Table B.17 – Example 3 ContentFilter
Element[]OperatorOperand[0]Operand[1]Operand[2]Operand[3]
0AndElement Operand= 1ElementOperand = 2
1AndElementOperand = 4ElementOperand = 6
2AndElementOperand = 3ElementOperand = 9
3OrElementOperand = 7ElementOperand = 8
4RelatedToAttributeOperand = NodeId: 12:PersonType, BrowsePath “.”, Attribute: NodeId ElementOperand = 5AttributeOperand = NodeId: 12:HasPet, BrowsePath “.”, Attribute: NodeIdLiteralOperand = ‘1’
5RelatedTo

AttributeOperand = Node: 12:AnilmalType, BrowsePath “.”, Attribute: NodeId

Alias: AT

AttributeOperand = NodeId: 12:FeedingScheduleType, BrowsePath “.”, Attribute: NodeId

Alias: FST

AttributeOperand = NodeId: 12:HasSchedule, BrowsePath “.”, Attribute: NodeIdLiteralOperand = ‘1’
6EqualsAttributeOperand = NodeId: 12:PersonType BrowsePath 12:Zipcode “.”, Attribute: ValueLiteralOperand = ‘02138’
7Equals

AttributeOperand = NodeId: 12:PersonType

BrowsePath “12:HasPet>12:AnimalType<12:HasSchedule>12: FeedingSchedule/12:Period”, Attribute: Value

Alias: FST

LiteralOperand = ‘Daily’
8Equals

AttributeOperand = NodeId: 12:PersonType

BrowsePath “12:HasPet>12:AnimalType<12:HasSchedule>12: FeedingSchedule/12:Period”, Attribute: Value

Alias: FST

LiteralOperand = ‘Hourly’
9Greater Than

AttributeOperand = NodeId: 12:PersonType

BrowsePath “12:HasPet>12:AnimalType<12:HasSchedule>12: FeedingSchedule/12:Amount”, Attribute: Value

Alias: FST

ElementOperand = 10
10CastLiteralOperand = 10AttributeOperand = NodeId: Int32, BrowsePath “.”, Attribute: NodeId

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

Table B.18 – Example 3 QueryDataSets
NodeId

TypeDefinition

NodeId

RelativePathValue
12:30 (JFamily1)PersonType“.12:LastName” Jones
“<12:HasPet>12:PersonType. 12:Name”Rosemary
Basil
“<12:HasPet>12:AnimalType<12:HasSchedule>12:FeedingSchedule. 12:Period”Hourly
Daily