<br><font size=2 face="sans-serif">Pritham,</font>
<br>
<br><font size=2 face="sans-serif">I've experienced this issue before as
well. &nbsp;It has to do with the way that the KnowledgeAgent subscribes
to resources. &nbsp;I believe behind the scenes the resources are loaded
in an arbitrary order. &nbsp;There is a JIRA bug report already filed:</font>
<br>
<br><a href="https://jira.jboss.org/jira/browse/JBRULES-2377"><font size=2 face="sans-serif">https://jira.jboss.org/jira/browse/JBRULES-2377</font></a>
<br>
<br><font size=2 face="sans-serif">Hope this helps,</font>
<br><font size=2 face="sans-serif"><br>
</font><font size=3>Steve</font>
<br>
<br><tt><font size=2>rules-users-bounces@lists.jboss.org wrote on 01/26/2010
01:07:29 PM:<br>
<br>
&gt; [image removed] </font></tt>
<br><tt><font size=2>&gt; <br>
&gt; [rules-users] KnowledgeAgent doesn't load dsl files and dslr file
<br>
&gt; from a change-set correctly</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Pritham </font></tt>
<br><tt><font size=2>&gt; <br>
&gt; to:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; rules-users</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; 01/26/2010 01:10 PM</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Sent by:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; rules-users-bounces@lists.jboss.org</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Please respond to Rules Users List</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; <br>
&gt; I have a folder in classpath:<br>
&gt; <br>
&gt; dsl/global.dsl<br>
&gt; rules/section-A.dslr<br>
&gt; rules/section-A/page-1.dslr<br>
&gt; <br>
&gt; I create a knowledge base like this:<br>
&gt; <br>
&gt; public KnowledgeBase createKnowledgeBase() throws DroolsParserException,<br>
&gt; IOException {<br>
&gt; <br>
&gt; &nbsp; &nbsp; KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .newKnowledgeBuilder();<br>
&gt; <br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; knowledgeBuilder.add(ResourceFactory<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .newClassPathResource(&quot;dsl/global.dsl&quot;),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ResourceType.DSL);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; knowledgeBuilder.add(ResourceFactory<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .newClassPathResource(&quot;rules/section-A.dslr&quot;),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ResourceType.DSLR);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; knowledgeBuilder.add(ResourceFactory<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .newClassPathResource(&quot;rules/section-A/page-1.dslr&quot;),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ResourceType.DSLR);
&nbsp; <br>
&gt; <br>
&gt; &nbsp; &nbsp; if (knowledgeBuilder.hasErrors()) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; throw new RuntimeException(knowledgeBuilder.getErrors().toString());<br>
&gt; &nbsp; &nbsp; }<br>
&gt; <br>
&gt; &nbsp; &nbsp; KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();<br>
&gt; &nbsp; &nbsp;<br>
&gt; knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());<br>
&gt; <br>
&gt; &nbsp; &nbsp; return knowledgeBase;<br>
&gt; }<br>
&gt; <br>
&gt; // code<br>
&gt; knowledgeBase = createKnowledgeBase();<br>
&gt; session = knowledgeBase.newStatefulKnowledgeSession();<br>
&gt; // insert facts<br>
&gt; session.fireAllRules();<br>
&gt; session.dispose(); &nbsp; <br>
&gt; <br>
&gt; The above code works and I can get a unit test to work that processes
rules<br>
&gt; accordingly. I can see my dslr converting to a drl using the &quot;drl
viewer&quot;<br>
&gt; correctly (provided I temporarily place the dsl file in the same location<br>
&gt; since expander doesn't accept a relative path).<br>
&gt; <br>
&gt; The problem, however is when I use a change-set.xml and a KnowledgeAgent,<br>
&gt; things don't work <br>
&gt; <br>
&gt; code for loading via knowledgeAgent<br>
&gt; <br>
&gt; public static KnowledgeBase loadKnowledgeBase() throws<br>
&gt; DroolsParserException, IOException {<br>
&gt; &nbsp; &nbsp; agent = KnowledgeAgentFactory.newKnowledgeAgent(&quot;msll
agent&quot;);<br>
&gt; &nbsp; &nbsp;<br>
&gt; agent.applyChangeSet(ResourceFactory.newClassPathResource(&quot;change-set.xml&quot;));<br>
&gt; <br>
&gt; &nbsp; &nbsp; return agent.getKnowledgeBase();<br>
&gt; } &nbsp; <br>
&gt; <br>
&gt; <br>
&gt; &lt;change-set xmlns='http://drools.org/drools-5.0/change-set'<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd'<br>
&gt; &gt;<br>
&gt; &nbsp; &nbsp;&lt;add&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;&lt;resource source='classpath:dsl/' type='DSL'
/&gt; &nbsp;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;&lt;resource source='classpath:rules/'
type='DSLR' /&gt; &nbsp; &nbsp;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;&lt;resource source='classpath:rules/section-A/'
type='DSLR' /&gt;<br>
&gt; &nbsp; &nbsp; &lt;/add&gt;<br>
&gt; &lt;/change-set&gt;<br>
&gt; <br>
&gt; <br>
&gt; I get the following generic drools errors:<br>
&gt; ERR 103] Line 4:0 rule 'rule_key' failed predicate:<br>
&gt; {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule[7,0]:
[ERR 101]<br>
&gt; Line 7:0 no viable alternative at input 'import' in rule Con in rule<br>
&gt; attribute<br>
&gt; ...<br>
&gt; ...<br>
&gt; <br>
&gt; The rules are same, folder location is the same. I believe that drools
has a<br>
&gt; problem resolving path (expander global.dsl) from the dslr file when
using a<br>
&gt; KnowlegeAgent since in the earlier strategy, one could build a dsl
into the<br>
&gt; knowledgeBuilder directly from the classpath.<br>
&gt; <br>
&gt; Pl suggest.<br>
&gt; -- <br>
&gt; View this message in context: </font></tt><a href="http://n3.nabble.com/KnowledgeAgent-"><tt><font size=2>http://n3.nabble.com/KnowledgeAgent-</font></tt></a><tt><font size=2><br>
&gt; doesn-t-load-dsl-files-and-dslr-file-from-a-change-set-correctly-<br>
&gt; tp139702p139702.html<br>
&gt; Sent from the Drools - User mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; </font></tt><a href="https://lists.jboss.org/mailman/listinfo/rules-users"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/rules-users</font></tt></a><tt><font size=2><br>
</font></tt>