Hierarchies

You can use a hierarchy of rulesets to extend a rule model. You can also use hierarchies as a filtering mechanism.

The structure of the items that are managed in a rule project are defined by a rule model. You can extend this rule model by adding custom properties to the rule class or by creating a hierarchy property. A hierarchy defines a tree of values and the hierarchical relationship between the nodes of the tree.

Runtime rule selection can use hierarchies as a way of providing a further filtering mechanism.

The following figure shows an example of a geography hierarchy, where USA is the root node. A location custom property has been defined for each rule.

Diagram of hierarchy between rulesets

The following table shows the BAL constructs that you can use to write the runtime rule selection for the geography example:

Table 1. Location property examples
BAL construct Description
the location of the rule is  ‘Florida’
Returns true if the location value is equal to Florida. In this example, rule 2 is selected for execution.
the location of the rule is under  ‘Florida’
Returns true if the location value is one of the values from the Florida node (included) to the hierarchy leaves (the children of the Florida node). In this example, Florida and Miami, which captures rule 2 and rule 3.
the location of the rule is over  ‘Florida’
Returns true if the location value is one of the values from the hierarchy root to the Florida node (included). In this example, USA and Florida, which captures rule 1 and rule 2.