[rules-users] problem in firing dependent rules..

Sudhir M sudhir.cse at gmail.com
Fri Jan 9 06:00:02 EST 2009


Hi All,
I don't know whether I have encountered a strange problem or my
understanding of drools is wrong.

I have 3 rules out of which two are dependent. Between the dependent ones
 one rule makes the other rule eligible to fire but I don't know why the
dependent rule is not firing. Below are the rules I have written.
package com.valueMomentum;
import com.valuemomentum.eligibilitymodel.oo.*;
import java.util.ArrayList;
global java.util.ArrayList list;

rule "PolicyTierClassification"
 no-loop true
 when
healthInsuredbindings : HealthInsured( weight >= 134 , weight < 157 , height
== "4ft 10in" , gender == "Male" )

 then
healthInsuredbindings.setPolicyTier("Standard I");

System.out.println("PolicyTierClassification");
list.add("To determine tier based on insured gender, height and
weight(weight>=134 , weight<157 , height==4ft 10in , gender==Male ) ->
(PolicyTier = Standard I)"); ;end

rule "AlcoholConsumptionClassRule"
 no-loop true
 when
healthInsuredbindings : HealthInsured( alcoholConsumptionFrequencyPerWeek ==
"2-3" )

 then
healthInsuredbindings.setAlcoholConsumptionClass("B");
 System.out.println("AlcoholConsumptionClassRule");
list.add("To derive the alcohol consumption class based on consumption
frequencyalcoholConsumptionFrequencyPerWeek==2-3 -> (AlcoholConsumptionClass
= B)"); end


rule "UnderwritingFactorRule"
 no-loop true
 when
healthInsuredbindings : HealthInsured( alcoholConsumptionClass =="B" )

 then
 healthInsuredbindings.setUnderwritingFactor(1);
 System.out.println("UnderwritingFactorRule");
     list.add("To derive UnderwritingFactor from  alcoholConsumptionClass==B
-> (UnderwritingFactor = 1)");end

this my initial fact HealthInsured healthInsured = new HealthInsured();
healthInsured.setAge(25);
healthInsured.setGender("Male");
healthInsured.setWeight(140);
healthInsured.setHeight("4ft 10in");
healthInsured.setTobaccoUser("No");
healthInsured.setMotorcycleRider("No");
healthInsured.setRelationToInsured("Insured");
healthInsured.setUnderwritingFactor(0);
healthInsured.setPolicyTier("Preferred");
healthInsured.setAlcoholConsumptionFrequencyPerWeek("2-3");
healthInsured.setAlcoholConsumptionClass("A");
Based on the above fact PolicyTierClassification, AlcoholConsumptionClassRule
are eligible  to fire. AlcoholConsumptionClassRule  is setting a property
alcoholConsumptionClass to B based on which UnderwritingFactorRule rule
becomes eligible fire but in this case the dependent rule is not firing. I
think we can use update in  AlcoholConsumptionClassRule  but I think if we
have to manage those dependencies it will be more error prone and the
results are might be more inconsistent.

I have tested it Using RETEOO in drools 3.x and 4.x which yields me the same
results. But when I used LEAPS algorithm then i even got the dependent rule
i.e UnderwritingFactorRule  rule  also fired.

Thanks in Advance,

sudhir.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090109/d0a6c463/attachment.html 


More information about the rules-users mailing list