Databases Reference
In-Depth Information
When there are multiple activations with the same priority, the most recently added
activation is the next rule to fire. However, it's quite common for multiple activations
to be added to the ruleset at the same time. The ordering of these activations is
not specified.
Rule firing
Once all rule conditions have been evaluated, the rule engine will start processing
the agenda. It will take the rule activation at the top of the agenda and execute the
action block for the fact set row and the corresponding rule.
During the execution of the action block, the rule may assert new facts, assert
updated facts, or retract existing facts from the working memory. As the rule engine
does this, it may cause existing activations to be removed from the agenda or add
new activations to the agenda.
When an activation is added to the agenda, it will be inserted into the agenda based
on the priority of the rule. If there are already previous activations on the agenda with
the same priority, the new activation will be inserted in front of these activations, that
is, the set of new activations will be processed before any of the older activations with
the same priority, but after any activation with a higher priority.
If a rule asserts a fact that is mentioned in its rule condition,
and the rule condition is still true , then a new activation for
the same fact set row will be added back to the agenda. So the
rule will be fired again. This can result in a rule continually
firing itself and thus the ruleset never completing.
Once the rule engine has completed the execution of the action block for an
activation, it will take the next activation from the agenda and process that. Once
all activations on the agenda have been processed, the rule engine has completed
execution of the ruleset.
Retrieving result
Once the ruleset has completed, the decision function will query the working
memory of the rule session for the result, specifically, the facts that we configured
as outputs of the decision service, which the decision function will then return to
the caller.
 
Search WWH ::




Custom Search