Use Case: --------- Test whether an object that has attributes A, B and C passes through a set of rules. Rule 1: pass if Condition1: attribute A = "A1" & Condition2: attribute B = "Y" Rule 2: pass if Condition1: attribute A = "A1" & Condition3: attribute C = "C1" Rule 3: pass if Condition4: A = "A3".
An object that has the attributes A="A4", B="Y" and C="C1" is asserted into the working memory. Scenario 1: Rules are built using a DRL file with the rules hardcoded into the DRL file. When the above object is asserted, Rule1/Condition1 is tested, and since it doesn't evaluate to true, Rule 2 is not executed. Rule 3 is tested however, and I can see from the Dumper output that the rules are organized into a tree structure based on the results of each condition. Scenario 2: The rules are built using the Native method manually building the rule set using the Condition and Consequence objects. Rule 2 is tested, even if Rule 1 Condition1 does not pass. I do get the correct results from the Rules engine, but from an execution point of view, it doesn't seem to be organized/optimized as expected. Using the native rule definition method, how do I define the conditions such that they are organized as in Scenario 1? So, in the above example, if Condition1 in Rule 1 does not pass, Rule 2 should not be even tested, but Rule 3 should be tested. Any help would be greatly appreciated.
