Hi Edson, thanks for the response.
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.
Thanks,
Justin
2009/9/15 Edson Tirelli <tirelli(a)post.com>
Justin,
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.
If still not working, please add a testcase and create a JIRA and we
will look into it.
[]s
Edson
2009/9/9 Justin King <justin.matthew.king(a)gmail.com>
> Hi,
>
> 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:
>
> String rule = "rule \"GeneralClause-2\" " +
> "when " +
> "ObligationComplianceEvent(term == \"term2\",
obligation
> == \"obligation1\", level == 2) " +
> "then " +
> "System.out.println(\"GeneralClause-2\");" +
> "contract1.setState(\"Hello\");" +
> "end";
>
> Resource ruleResource = ResourceFactory.newReaderResource((Reader) new
> StringReader(rule));
> kbuilder.add(ruleResource, ResourceType.DRL);
> kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
>
> 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
> 'accumulate' 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.
>
> 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?
>
> Any input at all would be greatly appreciated as this is very critical to
> our project.
>
> Cheers,
>
> Justin
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users