These classes are not part of the "stable API", which is considered safe, i.e., not
threatened by future changes. Also, the lack of javadoc is appalling. And
if that's not enough, creating and maintaining any but the simplest LHS
compositions programmatically is a mind-straining exercise, for which
you need a very, very good reason,...
A much easier way for generating rules programmatically is based on
templates.
If your goal is simply speeding up the Knowledge Base initialization process,
then the standard procedure is to use (Drools 5):
// create precompiled package
OutputStream os = new FileOutputStream( "src/main/rules/x/y.pkg" );
ObjectOutputStream oos = new ObjectOutputStream( os );
oos.writeObject( kBuilder.getKnowledgePackages() );
oos.close();
// load precompiled packag
InputStream is = new FileInputStream( "src/main/rules/movie/Movie.pkg" );
ObjectInputStream ois = new ObjectInputStream( is );
@SuppressWarnings("unchecked")
Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>) ois.readObject();
ois.close();
kBase.addKnowledgePackages( kpkgs );
This is equivalent to
kBase.addKnowledgePackages( kBuilder.getKnowledgePackages() );
but can, obviously, done by different programs.
-W
Hi,
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 ?
Thanks,
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users