[rules-users] Rules from Multiple DRLs use the same namespace

Wolfgang Laun wolfgang.laun at gmail.com
Wed Oct 19 02:09:23 EDT 2011


Your description seems somewhat incomplete.

On 18 October 2011 21:53, rajee.sakthi <rajee.sakthivadivelu at rph.com> wrote:

> Hi,
>
> I am a newbie to DROOLs. I want to cross check with you for any potential
> issues that you see about my DROOLs usage.
> I have a requirement to create multiple DRLs that use the same namespace.
> Hence, I am adding rules from DRL1, DRL2, DRL3 to a package named
> "com.myproj.pkg".
> And at some point I am removing rules of DRL1 from the knowledge package
> leaving rest of the rules.
>
So the rules from DRL2 and DRL3 remain in the package.


>
> When all the rules from the package are removed, then I am removing the
> knowledge package.
>
Which, according my previous statment (which reflects your description),
will never happen.


> This is all done with StatefulSession.
>
> So my rules removal code looks like this:
>
> String pkgName = kpkg.getName();
> Collection<Rule> rules = kpkg.getRules();
>
> for(Rule rule : rules) {
>            knowledgeBase.removeRule(pkgName, rule.getName());
> }
>
> KnowledgePackage pkgAfterRemove =
> knowledgeBase.getKnowledgePackage(pkgName);
> Collection<Rule> rulesAfterCleanup = pkgAfterRemove.getRules()
> if(rulesAfterCleanup == null || rulesAfterCleanup.isEmpty()) {
>        knowledgeBase.removeKnowledgePackage(pkgName);
> }
>
> I tested this logic and it works fine but does anyone see any side effects
> of such logic?
>

A knowledge base is just a bunch of data with rules, functions, etc. There's
not much point in removing the package after all the rules are gone, so why
bother?

And one wonders: is the remaining knowledge base still good for creating
sessions?

-W


> I did a short search in the forum and couldnt find any similar posts.
>
> Thanks a bunch,
> Rajee
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-from-Multiple-DRLs-use-the-same-namespace-tp3432304p3432304.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111019/f36e35be/attachment.html 


More information about the rules-users mailing list