コード例 #1
0
        public void ReloadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
        {
            var ckb    = this.LoadKnowledgeBase(kb, knowledgeBaseItem);
            var stPath = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename;

            this._compiledKnowledgeBases[stPath] = ckb;
        }
コード例 #2
0
        public CompiledKnowledgeBase AddKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
        {
            var ckb    = this.LoadKnowledgeBase(kb, knowledgeBaseItem);
            var stPath = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename;

            if (ckb != null)
            {
                this._compiledKnowledgeBases[stPath] = ckb;
            }
            return(ckb);
        }
コード例 #3
0
        public CompiledKnowledgeBase LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
        {
            var ckb = new CompiledKnowledgeBase
            {
                Build = kb.Build,
                Name  = knowledgeBaseItem.Fullpath + knowledgeBaseItem.Filename
            };

            ckb.KbList.Add(kb);
            ckb.OnRuleCompiled      += this.compiledKnowledgeBase_OnRuleCompiled;
            ckb.OnRuleCompileFailed += this.compiledKnowledgeBase_OnRuleCompileFailed;
            ckb.OnCompileError      += ckb_OnCompileError;
            ckb.OnCompileWarning    += ckb_OnCompileWarning;
            ckb.LoadKnowledgeBase(kb, knowledgeBaseItem);
            return(ckb);
        }
コード例 #4
0
        } //deleteRule(Rule ruleToDelete, ArrayList rules)

        public KnowledgeBase DecompressTemplates(string path)
        {
            var dataTables = LoadTemplateData(path);
            if (dataTables.Count == 0)
                return null;

            var newKb = new KnowledgeBase();
            newKb.Build = Build;
            newKb.Changed = true;
            newKb.Id = Id;
            newKb.Version = Version;
            newKb.Info = Info;
            newKb.Rules = Rules;

            foreach (ResourceFile rf in ResourceFiles)
                if (rf.Filetype != ResourceFileType.TemplateDataFile)
                    newKb.ResourceFiles.Add(rf);

            foreach (DataTable dataTable in dataTables)
                if (ContainsTemplateRule(newKb.Rules, dataTable))
                    newKb.Rules = DecompressRules(newKb.Rules, dataTable);
            return newKb;
        } //DecompressTemplates(string path)
コード例 #5
0
 public CompiledKnowledgeBase CompileKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem)
 {
     return(LoadKnowledgeBase(kb, knowledgeBaseItem));
 }