| ILOG JRules User Guide > Querying and Reporting > Concepts > Static Rule Analysis |
Static Rule Analysis |
PREVIOUS NEXT |
Static rule analysis is a mechanism for checking whether rules are semantically consistent. Inconsistencies can be found either in a single rule or in a set of rules. For example:
Rule analysis also goes beyond the simple syntax of rules to consider semantics as well. That is, how the rule behaves during execution. Using Rule Studio, you can specify which checks are carried out.
Static rule analysis checks can be categorized into two types:
This occurs when the conditions of the rule can never be met. Typically, the syntax of such rules is correct but the rules contain common logic errors. For example:
In order to reduce the risk of errors, some members can only be assigned values within a specified range. For example, the yearly interest rate on a loan may be limited to values between 0 and 10.
If a rule contains an action that tries to assign a value that is not within the permitted range, Rule Studio displays a range violation error in the report and in the Rule Editor.
This occurs where two rules contain condition parts have the same meaning and their actions are different yet not in conflict.
Note that rules with equivalent conditions do not necessarily represent an error situation, but they may be good candidates to be merged.
Equivalent rules are reported when both their conditions and actions are the same. In the following example, Rule1 and Rule2 are equivalent:
Rule1
definitions set minDiscount to 5 set ageDiscount to 10 if the age of the borrower is more than 65 then set the discount to minDiscount + ageDiscount
Rule2
if the age of the borrower is at least 66 then set the discount to 15
Although the syntax of these two rules is different, rule analysis evaluates the numerical expressions and reports that the rules are equivalent. You can therefore delete one of them.
| Note |
| Equivalent rules often arise between a decision table that you create and an existing rule. |
When two rules have the same actions, a rule become redundant when its conditions are included in the conditions of the other.
In the following example, the Else part of Rule2 makes Rule1 redundant:
Rule1
if the category of the customer is Gold then set the discount to 10
Rule2
if the category of the customer is Platinum then set the discount to 15 else set the discount to 10
Although Rule1 is correct, it is redundant and can therefore be deleted.
| Note |
| Redundant rules often arise between a decision table that you create and an existing rule. |
Rules may conflict when the actions of two different rules set a different value to the same business term (member). Conflicts occur in these two rules in circumstances in which the conditions are equivalent or cover the same values.
Rule1
if the loan report is approved and the amount of the loan is at least 300 000 then set the category of the borrower to Gold
Rule2
if the age of the latest bankruptcy of the borrower is less than 1 and the category of the borrower is not Platinum then set the category of the borrower to No Category
Rule1 and Rule2 will conflict when the loan report is approved, the amount of the loan is 300 000 (or more), the borrower has not had a bankruptcy in the last year, and the category is anything but Platinum. In these specific circumstances, the rules will set the category of the borrower to different values.
Conflicting rules can be corrected by changing the conditions, deleting one of the rules, or setting different priorities on the rules.
A rule is self-conflicting when two executions of a rule assign different values to the same member. For example, a self-conflicting rule:
For example:
if the customer category is Gold then set the discount of the cart to the bonus points of the customer
To check decision tables, you need to enable the option Include decision tables and decision trees in the inter-rule checks. Static rule analysis then handles decision tables as follows:
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |