<br>   Yes, once you do:<br><br>kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br><br>   Throw away your kbuilder and use a new one to add new rules. Obviously, keep the same kbase.<br><br>   []s<br>   Edson<br>
   <br><br><div class="gmail_quote">2009/9/14 Justin King <span dir="ltr">&lt;<a href="mailto:justin.matthew.king@gmail.com">justin.matthew.king@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Edson, thanks for the response.<br><br>Are you sure about the no reusable kbuilder thing? If I dont reuse the same one It does not work for me. Inserting the new rule has no effect.<br><br>Thanks,<br><br>Justin<br><br>
<br>
<br><div class="gmail_quote">2009/9/15 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>   Justin,<br><br>   This is a valid use case and should work just fine. Just make sure you your a new kbuilder instance every time. KnowledgeBuilders should not be reused, but when you add the knowledge package to the knowledge base, Drools will merge packages as necessary.<br>


<br>   If still not working, please add a testcase and create a JIRA and we will look into it.<br><br>   []s<br>   Edson<br><br><div class="gmail_quote">2009/9/9 Justin King <span dir="ltr">&lt;<a href="mailto:justin.matthew.king@gmail.com" target="_blank">justin.matthew.king@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Hi,<br><br>We have a project where we are attempting to add new rules to an existing knowledgebase (read from a .drl file). We add them by using strings using the following code: <br>


<br>String rule = &quot;rule \&quot;GeneralClause-2\&quot; &quot; +<br>
            &quot;when &quot; +<br>                &quot;ObligationComplianceEvent(term == \&quot;term2\&quot;, obligation == \&quot;obligation1\&quot;, level == 2) &quot; +<br>            &quot;then &quot; +<br>                &quot;System.out.println(\&quot;GeneralClause-2\&quot;);&quot; +<br>



                &quot;contract1.setState(\&quot;Hello\&quot;);&quot; +<br>            &quot;end&quot;;<br>            <br> Resource ruleResource = ResourceFactory.newReaderResource((Reader) new StringReader(rule));<br> kbuilder.add(ruleResource, ResourceType.DRL); <br>



 kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br><br>We do not even halt the currently running session to add the new rule (although halting and re-firing appears to make little difference). This appears to have strange effects. Some rules (specifically those that use &#39;accumulate&#39; most of the time) will stop working after inserting the new rule at runtime, even though they are completely unrelated. The timing in which you add the new rule also seems to have an effect (e.g. before inserting some events, after. etc). We cant seem to come to any logical conclusion about the strange behavior our rules seem to give us. <br>



<br>My question is this: Is this a valid way to use Drools? Or are we somehow breaking something (perhaps the rete tree or something) behind the scenes by doing this? If so, is there a correct way?<br><br>Any input at all would be greatly appreciated as this is very critical to our project. <br>



<br>Cheers,<br><font color="#888888"><br>Justin <br>
</font><br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div></div></div><br>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>