I have made progresses on that, and think I have found some bugs.

First, I was using category rules having bindings in their conditions. A JIRA mentionned that, and correction is made for 5.1 version. Thus, with my 5.0.1, it could not work....
After removing bindings in my category rules, it was still not working ...

Then, I tried to use root categories instead of my original one which was under a parent root category.
With that modification, now my rules has the magic word "extends" with my category rule. So the DRL seems to be generated well, but only with root categories ...
In the class org.drools.guvnor.server.contenthandler.ContentHandler, in method 'parentNameFromCategory' (l. 117 in my 5.0.1 file), the category is identified by its name, ie not its full path to its root. And as the category rules are stored by full path, it cannot work.
So I modified to get the full path here. That corrects the problem for sub-category, and generates rules with the correct 'extends' part in the big package DRL (and also with "view source" action).
Another potential problem : the category used to check against a gategory rule is only the first one. So for a rule with more than one category, this can be a real problem ...

But even with that correction and the proper "extends", my rules still ignore the "inherited" LHS.
After a time (and a lot of testing), I've found that inheritance only works if parent rules are defined BEFORE rules extending them. In a DRL file written in Eclipse this is not a problem, but Guvnor has its own ordering : alphabetical ordering.
So, to make my category rule work properly, I must name them so that they appear before other rules (same order than rules listing in grid), for instance "AAAA_something". This is pretty ugly, but I suppose it cannot be changed easily ...

I will add a JIRA for the sub-category problem (I checked in the 5.1 trunk, and it is the same code for that method), and for the ordering constraint.

Let me know your feelings about that.


Le 22/09/2010 14:44, Vincent Legendre a écrit :
  Hi all,

I can't make my rules inherit from category rules.
I saw a JIRA reporting a malfunction for this, but it shoud be corrected.
I am using version 5.0.1
I tried a category rule writen un DRL, or in BRL. Same for rules that 
should inherit the LHS (tested with pure DRL, BRL ...) from one of their 
categories. And yes I tried to inspect the big DRL generated from 
package, and also tried with compiled binary.

Does anyone have some kind of doc or sample using this function ?
Is there some restrictions on rules than can use this, either for 
category rules and/or rules that should inherit some LHS ?

Thanks !



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Vincent LEGENDRE
Chef de projets en optimisation

EURODECISION
9A rue de la Porte de Buc 78000 VERSAILLES
Tél. : +33 (0)1 39 07 12 40
Direct : +33 (0)1 39 07 26 16
www.eurodecision.com

EURODECISION