Rule resolution is the search algorithm that the system uses to find the best or most appropriate rule instance to apply in a situation.
Rule resolution applies to all but a few rule types — classes that inherit from the Rule- class. Rule resolution does not apply to instances of classes derived from the Work-, Data-, or any other base class.
While the rule resolution algorithm is fast and invisible, it is important to understand how it operates. As you create applications, make your choices of values for key parts based on how you want rules to be found by rule resolution.
An in-memory rule cache helps the rule resolution process operate faster. If the system finds an instance (or instances) of the rule in question in the cache, it accepts what is in the cache as the candidate rules and skips many steps in the resolution process (see below).
The benefits of rule resolution include:
The inputs to the rule resolution process are:
The output of the resolution process is the first rule found that matches all the criteria. (Sometimes no rule instance is found, and execution stops.) The system then executes the selected rule. Often this causes one or more additional rules to become needed. These are also found by rule resolution.
The steps in the rule resolution process are as follows:
Using rules already in the rules cache avoids additional database lookups.
If the rule is there, go to Step 8. If not, continue to Step 2.
The purpose, or "family name" combines all the key properties of a rule, excluding the "defined on" class.
For an activity rule, the key properties include:
- the Applies To class that the activity is defined on
- the activity name
The purpose in this case is the activity name.
For a Field Value, the key properties include:
- the Applies To class, as above
- the Field Name
- the Field Value
The purpose in this case is the Field Name plus the Field Value, for example "pyActionPrompt.ViewHistory".
The system chooses all items of the appropriate purpose and puts them in a temporary list.
The system drops unavailable rules from the temporary list.
The system drops from the list rules that belong to rulesets and versions that are not enabled for the current requestor. For instance, if the user's profile includes the ruleset version ThisRuleSet: 05-01, rules belonging to ThisRuleSet: 04- or ThisRuleSet: 06- are dropped.
Only rules found in classes from which the current class descends by either pattern or direct inheritance will be retained in the list.
This step is not used for rules which do not have the Use class-based inheritance to arrive at the correct rule to execute check box selected in their class definition.
The system ranks the remaining rules on the list in order of
Note that:
Step 6a: Discard choices that occur after the first "default" rule
A default rule (with no qualifiers defined) is considered a match for any Circumstance, Circumstance Date, or Date/Time range. Therefore, the process discards any rules lower in the list than the first default rule it finds.
The process adds the rules that remain on the list to the cache as being selectable for use.
The process searches down the list for the first rule that:
When it finds a rule that matches these conditions, the process checks whether the next rule in the list is equally correct. If it is, the process sends a message that there are duplicate rules in the system and stops processing.
If no duplicates are found, the system prepares to use the rule that matched the listed conditions.
The process checks Availability again, to see whether it is set to Blocked for this rule. If it is, the system sends a message that it could not find an appropriate rule to use.
The process finally verifies that the requestor has authorization to access the selected rule. If so, the system uses it. If not, is sends a message that it could not find an appropriate rule to use.
Your use of an application can cause Pega Platform to search for a flow named Repair in the class Work-Contract-Application-Complete.
The system first examines in the Work-Contract-Application-Complete class, and then (if no match is found) searches higher classes in the class hierarchy. Only flows belonging to rulesets and versions that are present on your ruleset list are candidates.
A few rule types have instances that are not associated with a ruleset and version and no rule resolution processing occurs when an instance of these classes is needed. For example, access roles (Rule-Access-Role-Name rule type) must have names that are unique system-wide.
Additionally, some other rule types do not support circumstanced processing.