}//deleteRule(Rule ruleToDelete, List<Rule> rules)

        public KnowledgeBase DecompressTemplates(string path)
        {
            List <System.Data.DataTable> dataTables = loadTemplateData(path);

            if (dataTables.Count == 0)
            {
                return(null);
            }

            KnowledgeBase newKB = new KnowledgeBase();

            newKB.Build   = this.Build;
            newKB.Changed = true;
            newKB.Id      = this.Id;
            newKB.Version = this.Version;
            newKB.Info    = this.Info;
            newKB.Rules   = this.Rules;

            foreach (ResourceFile rf in this.ResourceFiles)
            {
                if (rf.Filetype != ResourceFileType.TemplateDataFile)
                {
                    newKB.ResourceFiles.Add(rf);
                }
            }

            foreach (System.Data.DataTable dataTable in dataTables)
            {
                if (this.containsTemplateRule(newKB.Rules, dataTable))
                {
                    newKB.Rules = this.decompressRules(newKB.Rules, dataTable);
                }
            }    //foreach dataTable in dataTables
            return(newKB);
        }        //DecompressTemplates(string path)
Пример #2
0
        public void ReloadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
        {
            CompiledKnowledgeBase ckb = this.LoadKnowledgeBase(kb, knowledgeBaseItem);
            string stPath             = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename;

            this.addOrReplaceCompiledKnowlegeBase(stPath, ckb);
        }
Пример #3
0
        public CompiledKnowledgeBase LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
        {
            CompiledKnowledgeBase ckb = new CompiledKnowledgeBase();

            ckb.Build                = kb.Build;
            ckb.Name                 = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename;
            ckb.OnRuleCompiled      += new CompiledKnowledgeBase.RuleCompiled(this.compiledKnowledgeBase_OnRuleCompiled);
            ckb.OnRuleCompileFailed += new CompiledKnowledgeBase.RuleCompileFailed(this.compiledKnowledgeBase_OnRuleCompileFailed);
            ckb.OnCompileError      += new Conversive.Verbot5.CompiledKnowledgeBase.CompileError(ckb_OnCompileError);
            ckb.OnCompileWarning    += new Conversive.Verbot5.CompiledKnowledgeBase.CompileWarning(ckb_OnCompileWarning);
            ckb.LoadKnowledgeBase(kb, knowledgeBaseItem);
            return(ckb);
        }
Пример #4
0
        public void LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
        {
            this.knowledgeBaseItem = knowledgeBaseItem;
            this.knowledgeBaseInfo = kb.Info;
            this.LoadResourceFiles(kb.ResourceFiles);
            KnowledgeBase decompressedKB = kb.DecompressTemplates(knowledgeBaseItem.Fullpath);

            if (decompressedKB != null)
            {
                this.compileRules("_root", decompressedKB.Rules);
            }
            else
            {
                this.compileRules("_root", kb.Rules);
            }
            this.csToolbox.Compile();
        }
Пример #5
0
        public KnowledgeBase DecompressTemplates(string path)
        {
            List<System.Data.DataTable> dataTables = loadTemplateData(path);
            if(dataTables.Count == 0)
                return null;

            KnowledgeBase newKB = new KnowledgeBase();
            newKB.Build = this.Build;
            newKB.Changed = true;
            newKB.Id = this.Id;
            newKB.Version = this.Version;
            newKB.Info = this.Info;
            newKB.Rules = this.Rules;

            foreach(ResourceFile rf in this.ResourceFiles)
            {
                if(rf.Filetype != ResourceFileType.TemplateDataFile)
                {
                    newKB.ResourceFiles.Add(rf);
                }
            }

            foreach(System.Data.DataTable dataTable in dataTables)
            {
                if(this.containsTemplateRule(newKB.Rules, dataTable))
                {
                    newKB.Rules = this.decompressRules(newKB.Rules, dataTable);
                }
            }//foreach dataTable in dataTables
            return newKB;
        }
Пример #6
0
 public void LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
 {
     this.knowledgeBaseItem = knowledgeBaseItem;
     this.knowledgeBaseInfo = kb.Info;
     this.LoadResourceFiles(kb.ResourceFiles);
     KnowledgeBase decompressedKB = kb.DecompressTemplates(knowledgeBaseItem.Fullpath);
     if(decompressedKB != null)
         this.compileRules("_root", decompressedKB.Rules);
     else
         this.compileRules("_root", kb.Rules);
     this.csToolbox.Compile();
 }
Пример #7
0
 public void ReloadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
 {
     CompiledKnowledgeBase ckb = this.LoadKnowledgeBase(kb, knowledgeBaseItem);
     string stPath = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename;
     this.addOrReplaceCompiledKnowlegeBase(stPath, ckb);
 }
Пример #8
0
 public CompiledKnowledgeBase LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
 {
     CompiledKnowledgeBase ckb = new CompiledKnowledgeBase();
     ckb.Build = kb.Build;
     ckb.Name = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename;
     ckb.OnRuleCompiled += new CompiledKnowledgeBase.RuleCompiled(this.compiledKnowledgeBase_OnRuleCompiled);
     ckb.OnRuleCompileFailed += new CompiledKnowledgeBase.RuleCompileFailed(this.compiledKnowledgeBase_OnRuleCompileFailed);
     ckb.OnCompileError += new Conversive.Verbot5.CompiledKnowledgeBase.CompileError(ckb_OnCompileError);
     ckb.OnCompileWarning += new Conversive.Verbot5.CompiledKnowledgeBase.CompileWarning(ckb_OnCompileWarning);
     ckb.LoadKnowledgeBase(kb, knowledgeBaseItem);
     return ckb;
 }
Пример #9
0
 public CompiledKnowledgeBase CompileKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
 {
     return LoadKnowledgeBase(kb, knowledgeBaseItem);
 }
Пример #10
0
 public CompiledKnowledgeBase CompileKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
 {
     return(LoadKnowledgeBase(kb, knowledgeBaseItem));
 }
Пример #11
0
        }        //LoadCompiledKnowledgeBase(string stPath)

        public KnowledgeBase LoadKnowledgeBase(string stPath)
        {
            KnowledgeBase vkb = (KnowledgeBase)this.xmlToolbox.LoadXML(stPath);

            return(vkb);
        }