Search in sources :

Example 1 with KnowledgeBaseInterpreter

use of org.openksavi.sponge.kb.KnowledgeBaseInterpreter in project sponge by softelnet.

the class DefaultInteractiveMode method getScriptKnowledgeBaseInterpreter.

protected ScriptKnowledgeBaseInterpreter getScriptKnowledgeBaseInterpreter() {
    KnowledgeBase knowledgeBase = kbName != null ? engine.getKnowledgeBaseManager().getKnowledgeBase(kbName) : engine.getKnowledgeBaseManager().getMainKnowledgeBase();
    KnowledgeBaseInterpreter interpreter = knowledgeBase.getInterpreter();
    if (!(interpreter instanceof ScriptKnowledgeBaseInterpreter)) {
        throw new SpongeException("Knowledge base '" + kbName + "' is not script-based.");
    }
    return (ScriptKnowledgeBaseInterpreter) interpreter;
}
Also used : KnowledgeBase(org.openksavi.sponge.kb.KnowledgeBase) SpongeException(org.openksavi.sponge.SpongeException) ScriptKnowledgeBaseInterpreter(org.openksavi.sponge.kb.ScriptKnowledgeBaseInterpreter) KnowledgeBaseInterpreter(org.openksavi.sponge.kb.KnowledgeBaseInterpreter) ScriptKnowledgeBaseInterpreter(org.openksavi.sponge.kb.ScriptKnowledgeBaseInterpreter)

Aggregations

SpongeException (org.openksavi.sponge.SpongeException)1 KnowledgeBase (org.openksavi.sponge.kb.KnowledgeBase)1 KnowledgeBaseInterpreter (org.openksavi.sponge.kb.KnowledgeBaseInterpreter)1 ScriptKnowledgeBaseInterpreter (org.openksavi.sponge.kb.ScriptKnowledgeBaseInterpreter)1