[rules-users] Inheritance-Like Design Question

Moe Alkhafaji moe.alkhafaji at medcpu.com
Tue Mar 9 11:22:35 EST 2010


Thanks Pavel. But, doesn't an activation group only allow you to have one
rule executed within that group? What if I have N child rules, and 1 parent
rule and I may have M child rules execute (where M <= N)? I don't just want
one rule to execute. Is there something I am missing on the activation group
usage? Thanks.

On Tue, Mar 9, 2010 at 10:18 AM, Pavel Tavoda <pavel.tavoda at gmail.com>wrote:

> Sorry don't watch thread in detail but something like this should be
> achieved by defining "salience" on rule. Usually you define same
> condition withing same activation group with e.g. salience -100 which
> will fire as "default" when nothing match.
>
> But maybe I'm totally out of scope
>
> Pavel
>
> 2010/3/9 Moe Alkhafaji <moe.alkhafaji at medcpu.com>:
> > So, in continuation of the main subject of the email. Unfortunately, I
> > cannot use activation group because that will only allow me to execute
> one
> > rule out of many children. I want all eligible children to execute,
> without
> > the parent. And, if none of the children execute, then execute the parent
> > (obviously providing that all conditions are true). Sort of like how
> > overriding works in OOP. Unless the child has an overriding method, the
> one
> > from the super class will execute. Otherwise, the one from the child will
> > execute. I said sort of like  OOP, because here I want when ANY child
> > execute, the parent is not eligible to evaluate anymore, and if NONE of
> the
> > children rules execute (evaluate to false) then evaluate the parent rule.
> >
> > So, here is what I am exploring but I don't know how to do in Drools, and
> > whether there is a support for it:
> >
> > I was hoping that I can use salience to make all child rules evaluation
> > first. If a child rule executes, I want to listen to that event, and
> query
> > this rule to see whether it has a parent rule or not. If it does, then
> > deactivate that parent rule right in the event handler. I couldn't see
> > anything in the API on finding the parent of a given rule. Would this be
> a
> > meta data item or something? Is there a clever way to find out what the
> > parent rule is without introducing a custom method to have the child rule
> > registers itself?
> >
> > My second question is, I am feeding only one fact to the entire rule
> engine
> > instance. I am using the following syntax to define the input object:
> >
> > mpr : MPRFacade()
> >
> > I am declaring that in all my rules. Now, that I am using the "extends"
> > syntax, I cannot declare the same variable in both parent and child
> rules.
> > How can I use the mpr declared in the parent right from within the child
> > rule? I tried this, super, etc. with no success. If it is inaccessible,
> then
> > why the heck it is telling me it is a duplicate when I try to declare it?
> :)
> >
> > Thanks guys and gals!
> >
> > 2010/3/8 Edson Tirelli <ed.tirelli at gmail.com>
> >>
> >>     Thanks for letting us know. Good luck!
> >>
> >>     Edson
> >>
> >> 2010/3/8 Moe Alkhafaji <moe.alkhafaji at medcpu.com>
> >>>
> >>> I just want to report that using Eclipse 3.5.2, inheritance worked
> >>> beautifully! Thanks. Now, I am going to get to the actual problem at
> hand
> >>> and try to find a solution. Thanks Edson for all your help in this.
> >>>
> >>> 2010/3/8 Edson Tirelli <ed.tirelli at gmail.com>
> >>>>
> >>>>    Yes, probably so. Eclipse 3.4 and 3.5 should be fine.
> >>>>
> >>
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> > Moe Alkhafaji
> > Chief Technology Officer, MedCPU
> > Phone: (630) 290-1113
> > Email: cto at medcpu.com
> >
> > This message contains information which may be confidential. Unless you
> are
> > the addressee, you may not use, copy or disclose to anyone the message or
> > any information contained in this message. If you have received this
> email
> > in error, please notify cto at medcpu.com and please delete the message
> > immediately. In order for the contents of this message to be binding on
> > behalf of MedCPU it must be confirmed in writing by an authorized
> signatory
> > of MedCPU. Our company accepts no liability for the content of this email
> > unless it is so confirmed. The views or opinions presented herein do not
> > necessarily represent those of the company.
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Moe Alkhafaji
Chief Technology Officer, MedCPU
Phone: (630) 290-1113
Email: cto at medcpu.com

This message contains information which may be confidential. Unless you are
the addressee, you may not use, copy or disclose to anyone the message or
any information contained in this message. If you have received this email
in error, please notify cto at medcpu.com and please delete the message
immediately. In order for the contents of this message to be binding on
behalf of MedCPU it must be confirmed in writing by an authorized signatory
of MedCPU. Our company accepts no liability for the content of this email
unless it is so confirmed. The views or opinions presented herein do not
necessarily represent those of the company.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100309/e030a6f7/attachment.html 


More information about the rules-users mailing list