Why do you need to worry about only executing rules that are applicable to X.A?<br><br>The Rules Engine is designed to narrow matches to only those rules that are applicable and cause the appropriate activations.<br><br>You can accomplish what you need with agenda-groups; your code would know only X() needs validating and execute the activations on agenda-group that contains rules for validating X().<br>
<br>However the logic you write to determine which agenda-group needs to be activated is already part of the Rules Engine: When you insert X() into WM only rules with X() as a pattern are matched.<br><br>My advice would be to have all rules in WM at once and not worry about which should be executed. Insert your Facts that need validating and call fireAllRules(); then retrieve your validation messages.<br>
<br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 25 March 2011 14:35, Benson Fung <span dir="ltr">&lt;<a href="mailto:benson.redhat@gmail.com">benson.redhat@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I see what you mean.  You are right, that means when the fact A is<br>
inserted , the rule engine will come up an agenda which is A()<br>
related, right?<br>
<br>
OK, let&#39;s take in another way.  If A is one of a variable of a Fact<br>
say X(), then only the 3 rules evaluate the A variable of the Fact X()<br>
in the 1000 rules of rulebase.  How can I only execute the 3 rules<br>
programmatically?<br>
<br>
In fact, the problem comes from the legacy window program.  When we<br>
develop the old window program, we can add lots of field validation of<br>
the field by right clicking the edit box, right?  Right now, we need<br>
to migrate to java-based solution and use the BRMS to store those<br>
validation rules.  The above 3 rules were put in the validation rules<br>
of the edit field of the window program, and now I put these 3 rules<br>
into the BRMS and revamp the window program frontend to whatever<br>
html/GWT/ZK frontend now.<br>
<br>
If cannot get what I mean, please tell me and I try to describe again.<br>
<br>
<br>
Thank you very much and thanks for your patience.<br>
<font color="#888888"><br>
<br>
Benson<br>
</font><div><div></div><div class="h5"><br>
On Fri, Mar 25, 2011 at 9:39 PM, Mauricio Salatino &lt;<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt; wrote:<br>
&gt; so you don&#39;t need to worry about them to fire...<br>
&gt; Drools will evaluate only the meaningful rules for the fact A(). There is no<br>
&gt; need for grouping in your situation.<br>
&gt; Are you having a problem with you other rules and that&#39;s why are you trying<br>
&gt; to separate them?<br>
&gt; Greetings.<br>
&gt;<br>
&gt; On Fri, Mar 25, 2011 at 10:38 AM, Benson Fung &lt;<a href="mailto:benson.redhat@gmail.com">benson.redhat@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; The other 997 rules are for another Fact.  Sorry for my misleading you.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Benson<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Mar 25, 2011 at 9:35 PM, Mauricio Salatino &lt;<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; but you have another 997 rules about the A() Fact? or the other rules<br>
&gt;&gt; &gt; are<br>
&gt;&gt; &gt; about another facts??<br>
&gt;&gt; &gt; Greetings.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Fri, Mar 25, 2011 at 10:29 AM, Benson Fung &lt;<a href="mailto:benson.redhat@gmail.com">benson.redhat@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks Mauricio,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; What I want is to only execute these 3 rules simultaneously out of<br>
&gt;&gt; &gt;&gt; 1000 rules in the rulebase.  Can you advise programmatically how to<br>
&gt;&gt; &gt;&gt; achieve?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Fri, Mar 25, 2011 at 9:19 PM, Mauricio Salatino &lt;<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; If you include all that rules inside a knowledge session and then if<br>
&gt;&gt; &gt;&gt; &gt; you<br>
&gt;&gt; &gt;&gt; &gt; insert A, all the rules will be evaluated.<br>
&gt;&gt; &gt;&gt; &gt; There is no need to create an agenda group for that, unless I&#39;m<br>
&gt;&gt; &gt;&gt; &gt; missing<br>
&gt;&gt; &gt;&gt; &gt; something else that you don&#39;t mention :)<br>
&gt;&gt; &gt;&gt; &gt; Greetings.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; On Fri, Mar 25, 2011 at 10:10 AM, Benson Fung<br>
&gt;&gt; &gt;&gt; &gt; &lt;<a href="mailto:benson.redhat@gmail.com">benson.redhat@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Hi Leonardo,<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Thanks for your patience.  Let me try to describe what I want in<br>
&gt;&gt; &gt;&gt; &gt;&gt; details.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; e.g.  There is a variable A with 3 rules in BRMS.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; The variable A is input by a user via an edit box at the frontend.<br>
&gt;&gt; &gt;&gt; &gt;&gt; Now there are 1000 rules in the BRMS rulebase.  However, 3 out of<br>
&gt;&gt; &gt;&gt; &gt;&gt; 1000<br>
&gt;&gt; &gt;&gt; &gt;&gt; rules are related to this variable A, like<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; rule &#39;check_a_empty&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt; when (( A == null) || (A == &quot;&quot;) )<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; then  return a message &#39;A cannot be empty&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; rule &#39;A_Range_0_100&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt; when ((A &lt; 0 ) || (A &gt; 100) )<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; then return a message &#39;A must be within the range between 0 and 100&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; rule &#39;check_A_Character&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt; when ((A is not an integer))<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; return a message &#39;A must be an integer&#39;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; If I would like to execute the above 3 rules at the same time, how<br>
&gt;&gt; &gt;&gt; &gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt;&gt; write/develop the AgendaFilter class?<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Please advise<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Thank you very much<br>
&gt;&gt; &gt;&gt; &gt;&gt; Benson<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; 2011/3/25 Leonardo Gomes &lt;<a href="mailto:leonardo.f.gomes@gmail.com">leonardo.f.gomes@gmail.com</a>&gt;:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Hi Benson,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; What exactly do you want to achieve? You want to execute rules in<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; parallel?<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; On Fri, Mar 25, 2011 at 2:08 AM, Benson Fung<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; &lt;<a href="mailto:benson.redhat@gmail.com">benson.redhat@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Hi,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; I have setup about 10 rules in the rulebase.  Can you tell me how<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; I<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; can execute more than one specific rule at the same time?  Please<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; help<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Thanks<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Benson<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt; &gt;  - CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a><br>
&gt;&gt; &gt;&gt; &gt;  - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
&gt;&gt; &gt;&gt; &gt;  - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;  - Salatino &quot;Salaboy&quot; Mauricio -<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt;  - CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a><br>
&gt;&gt; &gt;  - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
&gt;&gt; &gt;  - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;  - Salatino &quot;Salaboy&quot; Mauricio -<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;  - CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a><br>
&gt;  - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
&gt;  - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
&gt;<br>
&gt;  - Salatino &quot;Salaboy&quot; Mauricio -<br>
&gt;<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>