-
Language:
English
-
Language:
English
11.24. Rule Attributes
Table 11.1. Rule Attributes
Attribute Name | Default Value | Type | Description |
---|---|---|---|
no-loop
|
false
|
Boolean
|
When a rule's consequence modifies a fact it may cause the rule to activate again, causing an infinite loop. Setting no-loop to true will skip the creation of another Activation for the rule with the current set of facts.
|
ruleflow-group
|
N/A
|
String
|
Ruleflow is a Drools feature that lets you exercise control over the firing of rules. Rules that are assembled by the same ruleflow-group identifier fire only when their group is active.
|
lock-on-active
|
false
|
Boolean
|
Whenever a ruleflow-group becomes active or an agenda-group receives the focus, any rule within that group that has lock-on-active set to true will not be activated any more; irrespective of the origin of the update, the activation of a matching rule is discarded. This is a stronger version of no-loop, because the change could now be caused not only by the rule itself. It's ideal for calculation rules where you have a number of rules that modify a fact and you don't want any rule re-matching and firing again. Only when the ruleflow-group is no longer active or the agenda-group loses the focus those rules with lock-on-active set to true become eligible again for their activations to be placed onto the agenda.
|
salience
|
0
|
Integer
|
Each rule has an integer salience attribute which defaults to zero and can be negative or positive. Salience is a form of priority where rules with higher salience values are given higher priority when ordered in the Activation queue.
|
agenda-group
|
MAIN
|
String
|
Agenda groups allow the user to partition the Agenda providing more execution control. Only rules in the agenda group that has acquired the focus are allowed to fire.
|
auto-focus
|
false
|
Boolean
|
When a rule is activated where the auto-focus value is true and the rule's agenda group does not have focus yet, then it is given focus, allowing the rule to potentially fire.
|
activation-group
|
N/A
|
String
|
Rules that belong to the same activation-group, identified by this attribute's string value, will only fire exclusively. In other words, the first rule in an activation-group to fire will cancel the other rules' activations, i.e., stop them from firing.
|
dialect
|
As specified by the package
|
String
|
The dialect species the language to be used for any code expressions in the LHS or the RHS code block. Currently two dialects are available, Java and MVEL. While the dialect can be specified at the package level, this attribute allows the package definition to be overridden for a rule.
|
date-effective
|
N/A
|
String, containing a date and time definition
|
A rule can only activate if the current date and time is after date-effective attribute.
|
date-expires
|
N/A
|
String, containing a date and time definition
|
A rule cannot activate if the current date and time is after the date-expires attribute.
|
duration
|
no default value
|
long
|
The duration dictates that the rule will fire after a specified duration, if it is still true.
|