|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface KnowledgeBase
The KnowledgeBase is a repository of all the application's knowledge definitions. It will contain rules, processes, functions, type models. The KnowledgeBase itself does not contain runtime data, instead sessions are created from the KnowledgeBase in which data can be inserted and process instances started. Creating the KnowledgeBase can be heavy, where as session creation is very light, so it is recommended that KnowledgeBases 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);
KnowledgeBaseFactory
Method Summary | |
---|---|
void |
addKnowledgePackages(Collection<KnowledgePackage> kpackages)
Add the collection of KnowledgePackages to the KnowledgeBase. |
Set<String> |
getEntryPointIds()
Returns the set of the entry points declared and/or used in this knowledge base |
FactType |
getFactType(String packageName,
String typeName)
Returns the FactType identified by the given package and type names. |
KnowledgePackage |
getKnowledgePackage(String packageName)
Returns a reference to the KnowledgePackage identified by the given name. |
Collection<KnowledgePackage> |
getKnowledgePackages()
Return an immutable collection of the packages that exist in this KnowledgeBase. |
Process |
getProcess(String processId)
Returns a referent to the Process identified by the given processId |
Collection<Process> |
getProcesses()
|
Query |
getQuery(String packageName,
String queryName)
Returns a reference to the Rule identified by the given package and rule names. |
Rule |
getRule(String packageName,
String ruleName)
Returns a reference to the Rule identified by the given package and rule names. |
Collection<StatefulKnowledgeSession> |
getStatefulKnowledgeSessions()
Return a collection of the StatefulKnowledgeSessions that exist in this KnowledgeBase. |
StatefulKnowledgeSession |
newStatefulKnowledgeSession()
Create a new StatefulKnowledgeSession using the default session configuration. |
StatefulKnowledgeSession |
newStatefulKnowledgeSession(KnowledgeSessionConfiguration conf,
Environment environment)
Create a new StatefulKnowledgeSession using the given session configuration and/or environment. |
StatelessKnowledgeSession |
newStatelessKnowledgeSession()
Create a new StatelessKnowledgeSession using the default session configuration. |
StatelessKnowledgeSession |
newStatelessKnowledgeSession(KnowledgeSessionConfiguration conf)
Create a new StatelessKnowledgeSession using the given session configuration. |
void |
removeFunction(String packageName,
String ruleName)
Remove a function from the specified package. |
void |
removeKnowledgePackage(String packageName)
Remove a KnowledgePackage and all the definitions it contains from the KnowledgeBase. |
void |
removeProcess(String processId)
Remove a process from the specified package. |
void |
removeQuery(String packageName,
String queryName)
Remove a rule from the specified package. |
void |
removeRule(String packageName,
String ruleName)
Remove a rule from the specified package. |
Methods inherited from interface org.drools.event.knowledgebase.KnowledgeBaseEventManager |
---|
addEventListener, getKnowledgeBaseEventListeners, removeEventListener |
Method Detail |
---|
void addKnowledgePackages(Collection<KnowledgePackage> kpackages)
knowledgePackage
- Collection<KnowledgePackage> getKnowledgePackages()
KnowledgePackage getKnowledgePackage(String packageName)
packageName
- the name of the KnowledgePackage to return
void removeKnowledgePackage(String packageName)
packageName
- Rule getRule(String packageName, String ruleName)
packageName
- the package name to which the rule belongs to.ruleName
- the name of the rule.
void removeRule(String packageName, String ruleName)
packageName
- ruleName
- Query getQuery(String packageName, String queryName)
packageName
- the package name to which the rule belongs to.ruleName
- the name of the rule.
void removeQuery(String packageName, String queryName)
packageName
- ruleName
- void removeFunction(String packageName, String ruleName)
packageName
- ruleName
- FactType getFactType(String packageName, String typeName)
packageName
- the name of the package the fact belongs to.typeName
- the name of the type.
Process getProcess(String processId)
processId
- the id of the process
void removeProcess(String processId)
processId
- Collection<Process> getProcesses()
StatefulKnowledgeSession newStatefulKnowledgeSession(KnowledgeSessionConfiguration conf, Environment environment)
conf
- environment
-
StatefulKnowledgeSession newStatefulKnowledgeSession()
Collection<StatefulKnowledgeSession> getStatefulKnowledgeSessions()
StatelessKnowledgeSession newStatelessKnowledgeSession(KnowledgeSessionConfiguration conf)
conf
-
StatelessKnowledgeSession newStatelessKnowledgeSession()
Set<String> getEntryPointIds()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |