Hi Charles,
The KnowledgeBuilder will build your knowledge based in your resources when:
kbuilder.add(Resource arg0, ResourceType arg1)
The ResourceFactory.newUrlResource, newClassPathResource, or others will
return a Resource instance
kBuilder.add( the resource with ResourceFactory, and ResourceType as
DSL/DRL/CHANGE_SET(xml from guvnor) and others)
you can optionally add a resource with your specific configuration:
kbuilder.add(Resource arg0, ResourceType arg1, ResourceConfiguration arg2)
after finishing to add your resources, you finished to build your knowledge
base and now you can get the instace of the knowledge base doing that:
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
and after get the knowledge packages from knowledgeBuilder to the
knowledgeBase:
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
its good idea to check for errors:
if (kbuilder.hasErrors()) {
System.err.println(kbuilder.getErrors().toString());
System.exit(1);
}
the resources could be written with errors or the mix of Resources could not
match each other.
After that, you have your knowledge base build as a point start to start
your sessions.
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
add your facts, and after fire your rules.
I hope this helps you,
Daniel Souza - Brazil
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-read-DRL-files-not-in-resource-c...
Sent from the Drools: User forum mailing list archive at
Nabble.com.