Thanks Edson  for a quick response.

Actually our requirement is to have our own custom rule builder which will use drools as a rule engine behind. So we are using Drools API to create the drl. since the end-user who models a rule is a business guy it is difficult to ask him to manage the dependencies. In this case it may not be possible for us to know when to update a fact. Initially we were by default adding modify() block to update the facts for every rule. In this case if more than one rule is eligible to fire then its going into a loop firing all the rules again and again in a loop. Is there a way we can handle this requirement.
Below is the sample rule that we created which ran into loop through drools API 
rule "PolicyTierClassification"
no-loop true
when
healthInsuredbindings : HealthInsured( weight >= 285 , weight < 327 , height == "6ft 6in" , gender == "Male" )

then
modify(healthInsuredbindings){setPolicyTier("Standard II")};
list.add("To determine tier based on insured gender, height and weight(weight>=285 , weight<327 , height==6ft 6in , gender==Male ) -> (PolicyTier = Standard II)"); end



On Fri, Jan 9, 2009 at 8:27 PM, Edson Tirelli <tirelli@post.com> wrote:

   Sudhir:

   In Rete, you must tell the engine a fact has changed, either by using a modify() block (recommended), or update() or property listeners.

   LEAPS is a different algorithm that was originally maintained by a community user that long ago abandoned it. It is no longer included in the drools distribution.

   []s
   Edson

2009/1/9 Sudhir M <sudhir.cse@gmail.com>
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.


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users