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