Errata exists for this version of the document.

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.9 describes the NodeTypeDescription parameters used in the example.

Table B.9 – Example 3 - NodeTypeDescription

Type Definition Node

Include

Subtypes

QueryDataDescription

RelativePath

Attribute

Index Range

PersonType

FALSE

“12:LastName”

Value

N/A

“<12:HasPet>12:AnimalType. 12:Name”

Value

N/A

“<12:HasPet>12:AnimalType<12:HasSchedule> 12:FeedingSchedule.Period”

Value

N/A

The corresponding ContentFilter is illustrated in Figure B.7.

image049.png

Figure B.7 – Example 3 Filter Logic Tree

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

Table B.10 – Example 3 ContentFilter

Element[]

Operator

Operand[0]

Operand[1]

Operand[2]

Operand[3]

0

And

Element Operand= 1

ElementOperand = 2

1

And

ElementOperand = 4

ElementOperand = 6

2

And

ElementOperand = 3

ElementOperand = 9

3

Or

ElementOperand = 7

ElementOperand = 8

4

RelatedTo

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

ElementOperand = 5

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

LiteralOperand = ‘1’

5

RelatedTo

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

Alias: AT

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

Alias: FST

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

LiteralOperand = ‘1’

6

Equals

AttributeOperand = NodeId: 12:PersonType BrowsePath 12:Zipcode “.”, Attribute: Value

LiteralOperand = ‘02138’

7

Equals

AttributeOperand = NodeId: 12:PersonType

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

Alias: FST

LiteralOperand = ‘Daily’

8

Equals

AttributeOperand = NodeId: 12:PersonType

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

Alias: FST

LiteralOperand = ‘Hourly’

9

Greater Than

AttributeOperand = NodeId: 12:PersonType

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

Alias: FST

ElementOperand = 10

10

Cast

LiteralOperand = 10

AttributeOperand = NodeId: Int32, BrowsePath “.”, Attribute: NodeId

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

Table B.11 – Example 3 QueryDataSets

NodeId

TypeDefinition

NodeId

RelativePath

Value

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

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.