These classes are not part of the "stable API", which is considered safe, i.e., not<br>threatened by future changes. Also, the lack of javadoc is appalling. And<br>if that's not enough, creating and maintaining any but the simplest LHS<br>
compositions programmatically is a mind-straining exercise, for which<br>you need a very, very good reason,...<br><br>A much easier way for generating rules programmatically is based on<br>templates.<br> <br>If your goal is simply speeding up the Knowledge Base initialization process,<br>
then the standard procedure is to use (Drools 5):<br><br>// create precompiled package<br>OutputStream os = new FileOutputStream( "src/main/rules/x/y.pkg" );<br>ObjectOutputStream oos = new ObjectOutputStream( os );<br>
oos.writeObject( kBuilder.getKnowledgePackages() );<br>oos.close();<br><br>// load precompiled packag<br>InputStream is = new FileInputStream( "src/main/rules/movie/Movie.pkg" );<br>ObjectInputStream ois = new ObjectInputStream( is );<br>
@SuppressWarnings("unchecked")<br>Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>) ois.readObject();<br>ois.close();<br>kBase.addKnowledgePackages( kpkgs );<br><br>This is equivalent to <br>
kBase.addKnowledgePackages( kBuilder.getKnowledgePackages() );<br>but can, obviously, done by different programs.<br>-W<br><br><div class="gmail_quote">2009/8/24 Ashish Soni <span dir="ltr"><<a href="mailto:learnspring@gmail.com">learnspring@gmail.com</a>></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, <br><br>Please let me know if it is good idea to use classes from org.drools.lang.descr package directly to create a rulebase and then use it for execution ?<br>
<br>Thanks,<br><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>