[rules-users] Inheritance-Like Design Question

Moe Alkhafaji moe.alkhafaji at medcpu.com
Tue Mar 9 11:08:48 EST 2010


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100309/c47ef2d6/attachment.html 


More information about the rules-users mailing list