hierarchy
hierarchy keyword defines a hierarchical
property.
Purpose
This keyword is used to define a hierarchy that defines values and gives a partial order between those values.
Context
At the top level of rulesets
Syntax
hierarchy hierarchyName
{ "rootName"
{ "nodeName1" { "nodeName11" "nodeName12" ... }
"nodeName2"
"nodeName3" { "nodeName31" { "nodeName311" } }
}
}
Description
IRL rules can have hierarchical properties. Specific predicates are defined to deal with hierarchical properties and get the rules that have a specific property value.
When a rule hierarchical property is accessed, its value is considered to be a string.
Example
This example defines
three rules r1, r2, and r3.
All define the location property which is a hierarchical
property.
hierarchy Geography
{ "North"
{ "USA" { "California" { "San Francisco" } "Texas" { "Houston" "Paris" } }
"Europe" { "France" { } "Germany" }
}
}
propertydefinition { Geography location; }
rule r1 { property location = "North/USA/Texas/Paris" when { ... } then { ... }
}
rule r2 { property location = "France" when { ... } then { ... } }
rule r3 { property location = "North/Europe/France/Paris" when { ... } then {
... } } In r1 and r3,
the location value is given as a path from the hierarchy
root to the final leaf, so as to resolve the ambiguity between the
two nodes named Paris. The r2 location property
value is France which refers to a unique node in
the hierarchy.