Do not use identical rule names for rules that should be available concurrently.<br><br>Better checks against duplications within a single KB build should be implemented, but there may be issues with dynamic resource updates.<br>
<br>-W<br><br><br><div class="gmail_quote">On 15 November 2010 07:08, Bala <span dir="ltr"><<a href="mailto:bala.ganesh@accenture.com">bala.ganesh@accenture.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I am using 5.0.1 version.<br>
<br>
In my application i dont have the rules in DRL files. I keep the Rules as<br>
binary object and add all the rules to knowledge base.<br>
<br>
Here is the code to add the binary rules.<br>
<br>
inputStream = new ByteArrayInputStream(binaryRules);<br>
ObjectInputStream ois = new ObjectInputStream(inputStream);<br>
kpkgs = (Collection<KnowledgePackage>) ois.readObject();<br>
kbase.addKnowledgePackages(kpkgs);<br>
.****************<br>
<br>
Simple way to reproduce.<br>
*******************<br>
<br>
1) Add have two drl files HelloWorld.drl and Hello.drl<br>
<br>
Add the below code in HelloWorldExample java<br>
<br>
kbuilder.add(ResourceFactory.newClassPathResource("HelloWorld.drl",HelloWorldExample.class),<br>
ResourceType.DRL);<br>
kbuilder.add(ResourceFactory.newClassPathResource("Hello.drl",HelloWorldExample.class),<br>
ResourceType.DRL);<br>
<br>
<br>
2)<br>
Add the below rule in HelloWorld.drl<br>
<br>
package org.drools.examples<br>
rule "hi"<br>
when<br>
eval(1==1)<br>
then<br>
System.out.println("Hello1");<br>
end<br>
<br>
3) Add the below rule in Hello.drl<br>
<br>
package org.drools.examples<br>
rule "hi"<br>
when<br>
eval(1==1)<br>
then<br>
System.out.println("Hello2");<br>
end<br>
<br>
4) when i execute the attached HelloWorldExample java, i am getting the<br>
output of the rule of latest added drl to the kbuilder(i.e Hello2 of<br>
Hello.drl).<br>
<br>
5) when i change the rulename, both the rules are getting executed.<br>
<br>
6) But with the same rulename, when i change the LHS to eval(1<3) in one<br>
rule, only the 4th step is getting reproduced.<br>
********************************<br>
am i doing anything wrong?<br>
<br>
Thanks,<br>
Bala<br>
<br>
<br>
<br>
<a href="http://drools-java-rules-engine.46999.n3.nabble.com/file/n1902934/HelloWorldExample.java" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/file/n1902934/HelloWorldExample.java</a><br>
HelloWorldExample.java<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Rules-selection-logic-tp1894132p1902934.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Rules-selection-logic-tp1894132p1902934.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>