Thanks Edson. That should help.
2010/3/9 Edson Tirelli <ed.tirelli(a)gmail.com>
To add constraints to a fact matched by the parent rule, use "from" :
rule "parent"
when
$var : MyFact( ... )
then
end
rule "child" extends "parent"
when
MyFact(...) from $var
then
end
Regarding your other question, Drools allows you to automatically
disable/enable parent rule, cancel rules in a rule group after another rule
fires, etc. but what you want to do is not available declaratively. You will
need to add constraints for that in a similar way to Pavel's suggestion.
[]s
Edson
2010/3/9 Moe Alkhafaji <moe.alkhafaji(a)medcpu.com>
> Thanks Pavel. I was hoping for more of a transparent functionality
> supported by Drools than have my users add those control method calls. I am
> trying to make their rules as "control logic" blind as possible. But, I
> guess they would have to do that.
>
>
> Also, any idea on re-using an object from the parent rule? What is the
> syntax for using an object declared in the parent rule? Thanks.
>
>
> On Tue, Mar 9, 2010 at 11:25 AM, Pavel Tavoda <pavel.tavoda(a)gmail.com>wrote:
>
>> Aha, misunderstanding. Yes you can't use activation group if you want
>> execute more children rules. However you can use fact (Status) to
>> avoid evaluating parent rule. My suggestion:
>>
>> Rule DEFAULT
>> salience -100
>> if A and ! Status(done) then DEFAULT end
>>
>> Rule A
>> if A and B then SOMETHINGB; update(Status(done)) end
>>
>> Rule B
>> if A or B then SOMETHINGB; update(Status(done)) end
>>
>> Rule C
>> if A or C then SOMETHINGC; update(Status(done)) end
>>
>> At beginning insert Status with e.g. "ready". It's possible to use
>> instead of update also insert but because you can fire more children
>> rules it will be waste of memory.
>>
>> Hope this help
>>
>> Pavel
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
> Moe Alkhafaji
> Chief Technology Officer, MedCPU
> Phone: (630) 290-1113
> Email: cto(a)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(a)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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Moe Alkhafaji
Chief Technology Officer, MedCPU
Phone: (630) 290-1113
Email: cto(a)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(a)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.