[rules-users] How to Ignore Rule Compilation Error and Continue to Compile Other Rules?

Esteban Aliverti esteban.aliverti at gmail.com
Mon Feb 14 07:16:29 EST 2011


Are you adding rules one by one? Or are you adding files that contains
multiple rules?

If you are adding rules one by one you could try something like this:

   1. create a kbase
   2. for each rule:
      1. create a kbuilder
      2. add the rule to the kbuilder
      3. add the generated package to kbase (only if there are no
      compilation errors)


Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Mon, Feb 14, 2011 at 8:14 AM, hyjshanghai <hyjshanghai at gmail.com> wrote:

>
> Please refer to the Drools Reference Document.
>
> http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch02.html#d0e254
>
> http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch02.html#d0e254
>
> Sample code from it to add rules in a drl file.:
>
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add( ResourceFactory.newClassPathResource(
> "licenseApplication.drl", getClass() ),
>              ResourceType.DRL );
> if ( kbuilder.hasErrors() ) {
>    System.err.println( builder.getErrors().toString() );
> }
> kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/How-to-Ignore-Rule-Compilation-Error-and-Continue-to-Compile-Other-Rules-tp2490203p2491824.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110214/b7d7da53/attachment.html 


More information about the rules-users mailing list