<br> Ck,<br><br> You need to think different when using forward chaining. Your data will drive the execution, not your "goals".<br> So, the state of your facts match rule B twice, it will fire twice.<br><br>
"Stupid" example:<br><br>rule "1. increment counter"<br> salience 10<br>
when<br>
$c : Counter( value < 2 )<br>
then<br> System.out.println( "firing rule 1" );<br>
$c.setValue( $c.getValue() + 1 );<br> modify( $c );<br>end<br><br>rule "2. diplay counter"<br>when<br> Counter( $value : value )<br>then<br> System.out.println("Value = "+$value);<br>end<br>
<br> If you do:<br><br>wm.assertObject( new Counter( 0 ) );<br>wm.fireAllRules();<br><br> Rules will fire:<br><br>1 -> 1 -> 2<br><br> But that is because your "state" (facts) drive them in that way. Do you understand that? Try removing salience attribute and check if there is any difference. Try making rule 2 higher salience than rule 1. Try asserting different values for the counter, like new Counter( 2 ).
<br><br> []s<br> Edson<br><br> <br><div><span class="gmail_quote">2007/5/9, ch4nd4n <<a href="mailto:chandan_kumar@msn.com">chandan_kumar@msn.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi,<br>is there a possibility to fire a particular rule twice?<br><br>For example if I have Rules "A", "B", "C", "D" and I am putting a Person<br>Object with few parameters,<br>
<br>Then how can I fire in following order<br><br>A -> B -> C -> B -> D<br><br>Thanks,<br>Ck<br><a href="http://www.gfour.net">http://www.gfour.net</a><br>--<br>View this message in context: <a href="http://www.nabble.com/reuse-a-rule-already-fired-tf3714857.html#a10391552">
http://www.nabble.com/reuse-a-rule-already-fired-tf3714857.html#a10391552</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><br>_______________________________________________
<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @
<a href="http://www.jboss.com">www.jboss.com</a>