Hi Justin,<br><br>Try this:<br><br>KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br>        <br>Resource resource = ResourceFactory.newClassPathResource(&quot;MyDrl.drl&quot;, MyClass.class);<br>
        kbuilder.add(resource, ResourceType.DRL);<br><br>KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br><br>kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br><br>Hope to help,<br><br>Nestor<br>
<br><div class="gmail_quote">2009/8/27 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;">
Anyone at all? I still haven&#39;t found a way to do this.<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Tue, Aug 25, 2009 at 11:03 AM, Justin King <span dir="ltr">&lt;<a href="mailto:justin.matthew.king@gmail.com" target="_blank">justin.matthew.king@gmail.com</a>&gt;</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;">Hi Everyone,<br><br>I found an old example that shows how to add a rule at runtime:<br><br>
<span style="color: rgb(51, 102, 255);">function void addRule(String pkgName, String rule, RuleBase ruleBase ) {</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">
   PackageBuilder builder = new PackageBuilder();</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">
   builder.addPackgeFromDrl( new StringReader( rule ) );</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">
   ruleBase.addPackage ( builder.addPackage() );</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">
}</span><br><br>I&#39;m trying to do a similar thing with Drools 5 but things seem to have changed. What I want is to add a rule (just as a string) to an already existing set of rules I&#39;ve loaded from a drl file (the new rule does not have to be saved to the actual file though). I see KnowledgeBase has a remove rule method but no add rule. <br>


I should also note that the set of rules I wish to add to is already executing (as in I&#39;ve called <i>fireUntilHalt()</i>) I hope this wont make a difference.<br><br>Thanks in advance for any help, this mailing list saves me every time!<br>


<br>Cheers,<br><font color="#888888"><br>Justin<br>
</font></blockquote></div><br>
</div></div><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>