Setting simple priorities among rules

Rules have priorities, which can be static or dynamic. Use a constant to define a static priority, or an expression containing a ruleset variable to define a dynamic priority.

To define the order in which rules are run, you set the priority of a rule in the Properties view of the relevant rule artifact, with the priority property.
Note: To be able to edit the property, make sure that the hand icon Hand icon to make properties editable is visible next to the Value column header in the Properties view.

Static priority

Use a static priority to change the sequence of rule execution among rules. Static priorities are integers, the relative values of which determine the priorities among the rules. You can also use a static priority to change the order of execution between several instances of the same rule when they are eligible for execution at the same time.

You define static priorities by using a constant. In the Value field of the priority property, you type a number that represents the priority. The number can be any Java™ integer value between -109 and +109 . The larger the number, the higher the execution priority of the rule.

Dynamic priority

A dynamic priority is an expression whose value depends on ruleset variables bound in the condition part of a rule.
Note: An error message is displayed when a ruleset archive includes a ruletask in sequential mode that selects rules with a dynamic rule priority.

In the Value field of the priority property, you enter an expression that uses a ruleset variable. The expression can use any variables defined in the condition part of the rule provided that its scope is for the entire ruleset. If the expression returns a number that is not an integer, it is converted to an integer following the Java language specification.

Here we have two examples:
  • prior1 + ?p

  • -?a

Constants

You can use constants in rule priorities. These priority values are integers that are written as a literal or an expression that has an integer value.

The following list shows the constants for setting priorities on rules:

  • maximum: The highest priority, its value is one billion.
  • high: The second highest priority, its value is one million.
  • low: The second lowest priority, its value is minus one million.
  • minimum: The lowest priority, its value is minus one billion.