Summary of Rule Evaluation

The following section provides a brief summary of what has been described in the previous sections regarding rule evaluation and action execution in Aware IM.

  1. Rules are evaluated when the following happens:
    1. An instance of a business object is created (provided that there are rules attached to this business object)
    2. Value of an attribute of a business object instance is modified (provided that there are rules attached to this business object)
    3. A process implemented by rules is started
    4. Aware IM receives notification (provided that there are rules associated with this event)
    5. Notification is created (provided that there are rules associated with this event)
    6. Scheduling rules are triggered by a timer event
    7. Values of attributes of business objects are taken from the Context except for aggregate operations such as EXISTS. When aggregate operations are evaluated Aware IM looks at all data available in the system – see Aggregate Operations.
  2. The following events change the contents of the Context (see How Context is Formed):
    1. Business objects found or selected by the FIND or PICK FROM actions are written into the Context of an ordered rule collection or into the Context of the currently executing action block of an un-ordered rule collection.
    2. Business objects and notifications created by the CREATE and ENTER NEW actions are written into the Context of an ordered rule collection or into the Context of the currently executing action block of an un-ordered rule collection.
    3. Before a rule collection attached to a business object is evaluated the instance of the business object for which evaluation occurs is written into the Context.
    4. Before a rule collection attached to a notification event (creation or receiving) is evaluated the instance of the notification for which evaluation occurs is written into the Context.
    5. Instances of business objects representing process input are written into the Context prior to execution of the process.
  3. Whenever a change to the system state occurs as a result of the creation of a new instance of a business object or notification or modification of the existing instance, Aware IM starts evaluation of the appropriate set of rules, i.e.
    1. Rules attached to a business object, an instance of which has been created or modified.
    2. Rules attached to other business objects that referto the business object instance that has been created or modified (cross-reference rules).
  4. Cross-reference rules are rules attached to some business object that also refer to some other object via a reference attribute or check whether an existing element in a list has been changed – see Cross-reference Rules.
  5. When a reference attribute of some object is modified and this reference attribute has matching attribute on the referred object, the referred object is modified as well and its rules (if any) are evaluated.
  6. Rule collections can be ordered and un-ordered. Ordered rule collections are evaluated one-by-one in exactly the same order that they appear in the rule collection. Un-ordered rule collections are evaluated by the rule engine using a special algorithm – see Evaluation of Rule Collections.
  7. The rule engine works as follows (see Overview of Rule Engine Framework):
    1. Initially all rules of the un-ordered rule collection are evaluated and the initial agenda is formed.
    2. The first action block is taken off the agenda. The block is taken off according to its priority. If priorities of actions blocks on the agenda are equal the block is taken off at random.
    3. The actions of the action block are executed. The changes to the system facts occur.
    4. Rules that depend on the changed facts are re-evaluated. The remaining actions on the agenda are also reviewed to check if the conditions that triggered them are still valid. The new agenda is formed.
    5. Another action block is taken off the agenda and executed. The process is repeated until there are no more actions on the agenda.
  8. Even though actions may be randomly taken off the agenda by the rule engine the end result is the same provided that business rules are self-contained and consistent.
  9. Rules may support “while semantics” in which case conditions of the rule that triggered action execution will be repeatedly re-evaluated irrespective of whether rule conditions depend on changed facts – see While Semantics.
  10. Actions that assign an attribute value equal to the existing value do not cause re-evaluation of rules, as the system’s state is not changed as a result of such an action – see Did it Change?
  11. Aware IM assigns default priorities to rules – actions that modify attribute have highest priority; actions that call “system services” have lower priority and actions that generate documents from templates have the lowest priority – see Rule Priorities.
  12. It is possible to distinguish between instances of the same business object by using instance prefixes – see Instance Prefixes.
  13. The last stable version is the version of a business object instance that is stored in the system and no rule processing of the rules attached to the object is occurring. The WAS CHANGED expressions compare the current value of an attribute (or the current state of a list) with the value of the last stable version – see Evaluation of Rules Containing WAS CHANGED.
  14. Initialization rules are rules that set attribute values either unconditionally or after checking whether the value is undefined. Such rules are executed before a form for the new instance of a business object is displayed – see Initialization Rules.
  • Last modified: 2022/09/13 18:15