3.12. Example Rule Flows
Figure 3.4. A Simple Rule Flow
The rule flow above specifies that the rules in the
Check Order group must be executed before the rules in the Process Order group. You could achieve similar results using salience, but this is harder to maintain and makes a time relationship implicit in the rules (or Agenda groups.) By contrast, using a rule-flow makes the processing order explicit, in its own layer on top of the rule structure, allowing you to manage complex business processes more easily.
In practice, if you are using rule-flow, you are most likely doing more than just setting a linear sequence of groups to progress though. You will be using Split and Join nodes to model branches and define flows by connections, from the Start to ruleflow-groups, to Splits and then on to more groups, Joins, and so on. Do all of via a graphical editor:
Figure 3.5. A Complex Rule Flow
The rule flow depicted above represents a more complex business process for finalizing an insurance claim:
First of all, the claim data validation rules are processed. These perform data integrity checks for consistency and completeness.
Next, in a Split node, a conditional decision is made based on the value of the claim. Processing will either move on to an auto-settlement group, or to another Split node, which checks whether there was a fatality in the incident.
If so, it determines whether the "regular" set of fatality-specific rules should take effect, with more processing to follow.
Based on a few conditions, many different control flows are possible.
Note
All the rules can be in one package, with the control flow definition being stored separately.
To edit Split nodes, follow this process:
Firstly, click on the node.
From the properties panel that appears, choose the type:
AND, OR or XOR. If you choose OR, then any of the split's potential outputs will be allowed to occur, meaning that processing can proceed in parallel along two or more different paths. If you chose XOR, then only one path will be taken.
If you choose
OR or XOR, there will be a square button on the right-hand side of the Constraints row.
Click on this button to open the Constraint Editor. This is a text editor with which you add constraints (which are like the conditional part of a rule.)
Note
These constraints operate on facts in the working memory. In the example above, there is a check for claims with a value of less than 250. Should this condition be true, then the associated path will be followed.
Set the conditions that will decide which outgoing path to follow.