" Person( $christianName, $surname; )\n" +
" then\n" +
" insert( new Person( $christianName, null ) );\n" +
"end";
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newByteArrayResource(drl.getBytes()), ResourceType.DRL );
if ( kbuilder.hasErrors() ) {
throw new RuntimeException("" + kbuilder.getErrors());
}
FileManager fileManager = new FileManager().setUp();
try {
File root = fileManager.getRootDirectory();
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File(root, "test.drl.compiled")));
out.writeObject( kbuilder.getKnowledgePackages());
out.close();
KieBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kconf.setOption( RuleEngineOption.PHREAK );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kconf);