The KnowlegeBase is a repository of all the application's knowledge definitions. It will contain rules, processes, functions, type models. The KnowledgeBase itself does not contain data, instead sessions are created from the KnowledgeBase in which data can be inserted and process instances started. Creating the KnowlegeBase can be heavy, where as session creation is very light, so it is recommended that KnowleBase's be cached where possible to allow for repeated session creation. The KnowledgeAgent can be used for this purpose. The KnowledgeBase is created from the KnowledgeBaseFactory, and a KnowledgeBaseConfiguration can be used.
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
Create sequential KnowledgeBase using the given ClassLoader.
Properties properties = new Properties(); properties.setProperty( "org.drools.sequential", "true"); KnowledgeBaseConfiguration kbConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties, myClassLoader); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
@see org.drools.KnowledgeBaseFactory