Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Using pattern inheritance for rule resolution

Updated on November 15, 2021

Rule resolution always first looks for a rule that it needs in the class initially provided.

When the Find by name first (Pattern) check box (which corresponds to the Rule-Obj-Class.pyPatternInheritance property) is selected on the Class rule form, the system uses pattern inheritance for a class. Pattern inheritance causes the system to next search for a rule in classes derived from the current class name by truncating, from the right, alphanumeric segments that follow a hyphen.

For example, a request for a rule in the WalCare-Financial-Credit class causes the system to search through these classes, in the order indicated:

  • WalCare-Financial-Credit
  • WalCare-Financial-
  • WalCare-Financial
  • WalCare-
  • WalCare

If this check box is selected and the rule is not found, rule resolution forms a sequence of candidate classes to search by truncating, from the left, portions of the class name that consist only of a hyphen, or consist only of characters other than a hyphen. If no class exists for one of these computed names, rule resolution continues with the next prefix.

The algorithm

For a class using pattern inheritance, the following is a simplified description of the rule resolution algorithm:

  1. Search each class formed by repeatedly truncating the original class name, stopping if the needed rule is found.
  2. If the pattern search finishes without finding a rule, go back to the original class and use directed inheritance to find the parent of the original class.
  3. If the parent class identified in step 2 was searched during step 1, skip it and skip to step 5.
  4. If the parent class was not previously searched, search it. Stop if the needed rule is found.
  5. If not found, determine whether the parent class uses pattern inheritance. If so, repeat this algorithm, starting at step 1, with the parent class.
  6. Otherwise, identify the parent of the parent. Continue at step 4.

The ultimate base class @baseclass is searched last.

Example

For example, assume your application requests a rule from WalCare-Financial-Credit, which derives from PegaCare-Financial-Credit, and WalCare-Financial-Credit uses pattern inheritance.

The system searches for the rule as follows:

  1. Is the rule in WalCare-Financial-Credit? If not,
  2. Is the rule in WalCare-Financial- ? If not,
  3. Is the rule in WalCare-Financial ? If not,
  4. Is the rule in WalCare- ? If not,
  5. Is the rule in WalCare ? This is the end of the pattern. If the system still cannot find the rule, it returns to Walcare-Financial-Credit and looks at the parent. If the parent was previously checked because of a similar pattern, it continues with the parent's parent.
  6. Is the rule in PegaCare-Financial-Credit? If not, see if PegaCare-Financial-Credit uses pattern inheritance first. If so, start the sequence again. If not, go next to the parent of PegaCare-Financial-Credit.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us