[rules-users] Infinite loop when re-activating rules

orchid maya.pollack at gmail.com
Sun Jan 17 07:23:28 EST 2010


Hi All,

I have a question about avoiding infinite loop, not  using 'no-loop' or
'lock-active' since I want to re-activate rules. Suppose I have one complex
class C and a chain of rules in which Rule2 checks the result of Rule1, Rule
3 checks the result of rule 2, etc... In the last rule ("Rule5") I want to
modify the class instance and re-activate the rules. 

rule "Rule1" 
  when 
    $c:C(/*some conditions*/)
  then 
    modify ($c){addRule("Rule1")} 
end 

rule "Rule2" 
  when 
    $c:C(rules contains "Rule1" && /*few more conditions*/)
  then 
    modify ($c){addRule("Rule2")} 
end 
...
...
...
rule "Rule5" 
  when 
    $c:C(rules contains "Rule4" && /*few more conditions*/) 
  then 
    modify ($c){changeAttribute("...")} 
end 

In order to avoid infinite loop I added 'lock-on-active' to Rule1, and
'no-loop true' to the rest rules. But, then the rules are not re-activated
as a result of Rule5. How can I cause re-activation of the rules. I hope I
was clear enough :))

Thanks in advance !!!

-- 
View this message in context: http://n3.nabble.com/Infinite-loop-when-re-activating-rules-tp123918p123918.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list