<br>&nbsp;&nbsp;&nbsp; Michael is right. It is just harder to explain than to do it. Just take a look at agenda-groups or ruleflow-groups. Chose which one you prefer to use it, place your rules in two separate groups: A and B.<br><br>&nbsp;&nbsp;&nbsp; If using agenda-groups, set initial focus to A, fireAllRules and make sure that on the consequence of one of the rules from group A you set focus to B. So if that rule never fires, B will never have the focus and will never fire. Just remeber that agenda-groups work like a stack, so if you want ALL rules from A to execute before B, add the setFocus on the rule with the lowest salience in A.<br>
<br>&nbsp;&nbsp;&nbsp; Using ruleflow-groups is similar, but you draw your &quot;flow&quot; graphically, and it does not work like a stack. Sometimes easier for your use case.<br><br>&nbsp;&nbsp;&nbsp; []s<br>&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">
2009/1/21 Anstis, Michael (M.) <span dir="ltr">&lt;<a href="mailto:manstis1@ford.com">manstis1@ford.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
See below.<br>
<br>
&quot;executing a rule&quot; is really two parts: LHS pattern matching (which<br>
can&#39;t be stopped for a given RuleBase) and execution of the RHS (which<br>
can be controlled by the agenda and truth maintenance).<br>
<br>
I hope my time away hasn&#39;t led to me giving wrong advice.<br>
<div class="Ih2E3d"><br>
Mike<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Thierry B<br>
</div><div class="Ih2E3d">Sent: 21 January 2009 12:53<br>
To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
Subject: RE: [rules-users] Run a set of rules in a group B from a rule<br>
in agroup A<br>
<br>
<br>
Hello,<br>
<br>
So if I&#39;ve well understand :<br>
<br>
- before calling fireAllRules(), Drools know for all rules (from any<br>
group)<br>
definied in DRL files, those which all patterns in the LHS of a rule are<br>
matched, and those rules are placed on a agenda.<br>
<br>
At which moment exactly, Drools verified from a rule that all of its<br>
pattern<br>
in the LHS are matched, if it&#39;s before callling fireAllRules() ?<br>
<br>
</div>&gt;&gt;&gt; Yes, LHS is evaluated on workingMemory.insert(o). A call to<br>
fireAllRules() executes the activations on the agenda (i.e. RHS queued<br>
as a consequence of LHS being matched on workingMemory.insert(o)).<br>
<div class="Ih2E3d"><br>
- And fireAllRules() permit to execute all rules that are placed on<br>
agenda<br>
<br>
</div>&gt;&gt;&gt; Yes<br>
<div class="Ih2E3d"><br>
- When using setFocus() from a java class or a rule, we can control the<br>
order of rules to specify to execute rules from group B, and group C...<br>
<br>
</div>&gt;&gt; I believe so.<br>
<div class="Ih2E3d"><br>
- So it&#39;s not possible to tell Drools that we don&#39;t want to execute a<br>
group<br>
of rules if a rule A is not matched : in that group of rules : those<br>
which<br>
all paterns match LHS will be inevitably executed.<br>
<br>
</div>&gt;&gt;&gt; Wrong. The rules won&#39;t be executed (read as activations - RHS -<br>
won&#39;t be run) but you can&#39;t stop the LHS being evaluated.<br>
<div><div></div><div class="Wj3C7c"><br>
All these points that I said, are exact?<br>
<br>
Thanks :-)<br>
<br>
<br>
Anstis, Michael (M.) wrote:<br>
&gt;<br>
&gt; Please accept that my knowledge is based on 4.x and there might be<br>
other<br>
&gt; alternatives in 5.<br>
&gt;<br>
&gt; Rules are not &quot;ran&quot; but their patterns (LHS) evaluated as facts<br>
&gt; (objects) are inserted into Working Memory. When all patterns in the<br>
LHS<br>
&gt; of a rule are matched activations are placed on the agenda for<br>
execution<br>
&gt; of the consequence (RHS) when fireAllRules() is called (or other<br>
&gt; mechanisms to run what is on the agenda are invoked; such as<br>
RuleFlow).<br>
&gt; So you could have rules in Group A cause Group B to receive the focus<br>
&gt; but it is the RHS&#39;s execution order you control and not the pattern<br>
&gt; matching - which will happen for Group A and Group B when facts are<br>
&gt; inserted into WM.<br>
&gt;<br>
&gt; Look at Agenda Groups and RuleFlow. This should help.<br>
&gt;<br>
&gt; With kind regards,<br>
&gt;<br>
&gt; Mike<br>
&gt;<br>
&gt;<br>
<br>
--<br>
View this message in context:<br>
<a href="http://www.nabble.com/Run-a-set-of-rules-in-a-group-B-from-a-rule-in-a-group-A-tp21580767p21582595.html" target="_blank">http://www.nabble.com/Run-a-set-of-rules-in-a-group-B-from-a-rule-in-a-g<br>
roup-A-tp21580767p21582595.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>