Completeness analysis
Completeness analysis is a mechanism for checking whether there are rules missing from a set of rules.
A ruleset is considered complete if for any possible case at least one rule applies.
- Check whether a ruleset is complete.
- Obtain a report of the missing rules.
- Add the missing rules to the ruleset.
For more information, see Analyzing a rule project.
Completeness mechanism
The completeness mechanism analyzes the condition part of each rule in a ruleset and detects whether there are cases where no rule applies.
To check that a ruleset is complete, the completeness mechanism proceeds as follows to identify the cases that are missing:
If the rule project contains a ruleflow, the completeness mechanism analyzes the ruleflow task by task, to check that each rule task is complete.
For example, if a rule is missing in several rule tasks, the report lists the rule tasks where the rule is missing.
If the rule project does not contain any ruleflow, the completeness mechanism takes into account all the rules in the project.
Note:A ruleflow must contain at least one rule task.
Example of completeness analysis
In
the following example, the ruleset is composed of five rules that
define the customer and
that set the category of the customer to
Silver, Platinum, or Gold.
Rule 1
if the value of the customer is at least 500 and the value of the customer is less than 1000 then set the category of the customer to "Silver";
Rule 2
if the age of the customer is at least 65 and the value of the customer is less than 500 then set the category of the customer to "Platinum";
Rule 3
if the value of the customer is at least 1000 and the value of the customer is less than 1500 then set the category of the customer to "Gold";
Rule 4
if the value of the customer is at least 1500 then set the category of the customer to "Platinum";
Rule 5
if the value of the customer is less than 500 and the age of the customer is less than 50 then set the category of the customer to "Platinum";
Ruleset completeness analysis detects that no rule applied in the case where the customer is between 50 and 65 and has a value of less than 500.
This missing case is presented as a rule skeleton that you can use to create the missing rule:
definitions
set 'Customer1' to a customer ;
if
the value of Customer1 is less than 500
and the age of Customer1 is less than 65
and the age of Customer1 is at least 50
then
<action>
Missing rules
If completeness analysis shows that your ruleset is not complete, it proposes additional rules to complete the ruleset. These new rules are skeleton rules. You must edit the missing rule to define the action to be done.
The completeness mechanism analyzes the conditions of each rule in the ruleset to define the set
of conditions for the proposed rule. If the rules match a Customer object but test different attributes, for example age, value, and
shopping cart, the set of conditions in the proposed
rule takes into account the attributes tested in the analyzed rules. Therefore, the condition part
in the suggested rule might seem complex and include many condition statements. It can be simplified
to reflect a more natural way of expressing the rule conditions. The analysis is based on the
objects used in the existing rules and that match the working memory. For more information, see
Ruelset debugging tools.
In the following
example, the suggested rule tests the value and
the age attributes. You
can simplify the rule by removing either condition.
Example
If completeness analysis proposes the following rule:
definitions
set 'Customer1' to a customer ;
if
the value of Customer1 is less than 500
and the age of Customer1 is less than 65
and the age of Customer1 is at least 50
then
<action>
you can remove the condition on the age of the customer, and keep only the condition on the value:
definitions
set 'Customer1' to a customer ;
if
the value of Customer1 is less than 500
then
<action>
If the ruleset contains only action rules, the proposed missing rules are verbalized. However, if the ruleset includes technical rules or decision tables, or if there is too little information on verbalization, the missing rules are presented in IRL.
The completeness mechanism might generate rules that overlap. You can modify the conditions of these rules.
Performance
The performance of completeness analysis depends on several factors such as the number of rules in the ruleset, the number of rule tasks, and most importantly the number of missing rules.
To improve performance and reduce execution time of completeness analysis, set a limit to the number of missing rules to propose. For example, limit the results to ten missing rules. Once you have integrated the first ten missing rules, run completeness analysis again to identify other missing rules.