[rules-users] Issue with Rule X1 extends X2

Davide Sottara dsotty at gmail.com
Fri Mar 29 02:47:19 EDT 2013


Are the two DRLs in the same package?
If not, the extension will not work.
However, I suspect the extension mechanism is indeed bugged,
or at least is debatable in some aspects.

1) Assuming that packageName + ruleName form an identifier,
it should be possible to extend a rule in another package by providing
the "fully qualified name", although allowing free-form names
in rules might make it difficult to separate the package from the rule name

2) Two rules with the same name cannot coexist in the same package:
2.a a single DRL with two rules with the same name will generate a
compilation error
2.b adding a rule to a KB will replace an existing rule with the same
name, if present
2.c using the same knowledgeBuilder to load two separate DRLs (same package)
containing two rules with the same name will cause the latter to
override the former
I'm not sure that 2.a and 2.c are coherent

Davide

On 03/28/2013 10:11 PM, Wolfgang Laun wrote:
> It works for me.
>
> Make sure to test for errors after compilation ( kBuilder.hasErrors() ).
>
> The code you've shown for the 2nd scenario  is incomplete, so no comment.
>
> -W
>
> On 29/03/2013, arul.prashanth at gmail.com <arul.prashanth at gmail.com> wrote:
>> When two rules recide within a same drl extends works as expected.
>>
>> rule "Base_Rule|1.1.2"
>> enabled false
>> when
>>     	$bdy : BDY()
>>     	Vehicles()
>>     then
>>         System.out.println(" >>>> 222 "+$bdy);
>> end
>>
>> rule "TX_Rule|1.1.2" extends "Base_Rule|1.1.2"
>> 	when
>>     then
>>         System.out.println(" >>>> TX 222 "+$bdy);
>> end
>>
>> When the super rule recides in a different DRL and child rule in a
>> different
>> DRL the parent rule is not fired
>>
>> rule "TX_Rule|1.1.1" extends "Base_Rule|1.1.0"
>> 	when
>> 		BDY();
>>     then
>>         System.out.println(" >>>> TX 111 "+$bdy);
>> end
>>
>> Any thoughts ??
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Issue-with-Rule-X1-extends-X2-tp4023114.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> 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
>



More information about the rules-users mailing list