Home | Printable Version
1.1: Conditions
Conditions determine when rules can be fired. Each condition contains XPaths, which are evaluated against the FactBase. The condition is met if the XPaths collectively return a true value.
For conditions, an XPath is considered to return true if:
It evaluates to a non-empty node set It returns the boolean value true. It returns a string that does not have the text value false
Conditions can be simple, typically containing just one XPath, or complex, with a number of parts joined using boolean operators AND, OR, and XOR. If a rule does not contain a condition, it fires as soon as it is encountered.
Simple Conditions
The simplest type of condition consists of just one check against the data. Such conditions can be created by opening up the relevant rule (by clicking the arrow icon on the left) and then clicking the Add Condition link under the IF part of the rule. Condition image
The Condition text box should be used to provide a name for the condition. The name can contain alphanumeric characters, spaces, underscores, and hyphens The Check field should contain the XPath that needs to be true for the rule to fire.
A condition can be removed by clicking the cross icon on the right of the condition name.
Complex Conditions
Complex conditions can be created by combining multiple parts, using AND, OR and XOR operators. Each operator can also contain other operators to allow very complex conditions to be created. example complex condition To add a new operator, you first need to add a simple condition, and then click one of the AND, OR or XOR buttons on the right of the condition. You will need to open up the condition check to see these buttons. Clicking one of these buttons will wrap the condition within an operator of the relevant type and create a second blank condition within it for you to populate. Each operator must have at least two children and you can add additional conditions by using the link at the bottom of the box e.g. Add AND Condition. You can delete operators by clicking the cross button on the right hand side. If the operator has two or more children then they will all be deleted, but if the operator only has one component within it, it will not delete the child component, but will move it into the place of the operator being deleted.
Each operator can contain as many children as required, and the resulting logic is described below.
AND - All components contained by an AND operator must evaluate to true for the operator to give a true value. OR - At least one of the components contained by an OR operator must evaluate to true for the operator to yield a true value. XOR - At least one, but not all, of the components contained by an XOR operator must evaluate to true for the operator to yield a true value.
Looping
A condition can have a loop property activated. This is used to indicate that the condition XPath will return a set of values and the rule should fire for each of the items in that set. During execution, the context point for each XPath will be the current entry in the node set. This feature therefore allows you to handle repeating sets of data. To activate looping, click the LOOP button to the right of the condition name. This will update the condition display as shown below. This button can be clicked again to deactivate looping. condition with 'loop on this selection' flag set Only one condition within a rule can have the loop property activated.
Creating Rules Actions