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

rajee.sakthi rajee.sakthivadivelu at rph.com
Tue Oct 18 15:53:13 EDT 2011


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.

When all the rules from the package are removed, then I am removing the
knowledge package.

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?

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.



More information about the rules-users mailing list