Rule behavior

Rules are matched and selected for execution by a condition controlled mechanism. The actions of a rule can influence which rules are matched after the rule is executed.

A rule agent has a working memory that contains the current event and previously received events, if these events are within the event time horizon. A rule agent also has a parameter that provides access to its bound entity.

When a rule agent receives a new event, the agent matches and selects the rules that are applicable according to the when, definitions, and if clauses in the rules. The process of matching and selecting rules is repeated until there are no rules applicable.
Match
The match step creates applicable rule instances if the conditions of the rule are satisfied. A rule instance is created by binding the variables in each rule to objects, such as entities or events. For example, the variable 'the customer' is matched to an entity named "John Doe". Each rule instance is added to a list of matched rules.
Select
The select step selects one of the rule instances from the list. The selection is based on certain criteria, such as the rule priority. Each rule instance in the list of matched rules cannot be executed more than once. In other words, after a rule instance is executed the condition of that rule must become false and then true again for the same rule to be executed a second time.
Act
The act step applies the action of the selected rule instance. The execution can modify the state of the entity and therefore might affect the result of the following match step.
Rule processing mechanism