Пример #1
0
        public static void ConstructInferResult(ClipsEngine.Result oClipsInferResult,
                                                List <vMRClsDef.DataModel> lstNewFact, ref vMRClsDef.OutputInfo oOutputInfo)
        {
            //触发事件的中文名信息获取
            oOutputInfo.oTriggeringEvent.oEvent.strEventCNName = ClipsFactObtain.ObtainEventCNNamewithEventName(oOutputInfo);
            //诊断或治疗结构化推理结论
            oOutputInfo.oInference.lstStructedInferMessage.AddRange(lstNewFact);

            //诊断、治疗和自我监测非结构化推理结论
            for (int i = 0; i < oClipsInferResult.Recommendations.Count; i++)
            {
                vMRClsDef.UnStructMessage oRecommendation = new vMRClsDef.UnStructMessage();
                oRecommendation.strUnStructMessage = oClipsInferResult.Recommendations[i];
                oOutputInfo.oInference.lstUnstructedInferenceMessage.Add(oRecommendation);
            }

            //推理所缺数据
            for (int j = 0; j < oClipsInferResult.DataNotice.Data.Count; j++)
            {
                vMRClsDef.DataModel oShortDataModel = new vMRClsDef.DataModel();
                oShortDataModel.strDataName   = oClipsInferResult.DataNotice.Data[j];
                oShortDataModel.strDataCNName = ClipsFactObtain.ObtainDataCNNamewithDataName(oOutputInfo, oShortDataModel.strDataName);
                oOutputInfo.lstShortDataModel.Add(oShortDataModel);
            }

            //解释过程
            for (int k = 0; k < oClipsInferResult.lstInInterpretation.Count; k++)
            {
                ExplanationService.ConstructExplanation(oClipsInferResult.lstInInterpretation[k], ref oOutputInfo);
            }
        }
Пример #2
0
        private static void ObtainDataModel(string strFilePath, string strFileName, ref vMRClsDef.InputDataModel oInputDataModel)
        {
            //string strFilePath = ClipsConfig.ReadConfig("Filepath");
            OpenXmlDoc(strFilePath + strFileName);
            string strEvent = oInputDataModel.oTriggeringEvent.oEvent.strEventName;

            XmlNodeList nl_DataModel = null;
            XmlNodeList nl_Event     = FindMulInstance("EventModel");//查找出xml文件中所有的触发事件节点

            foreach (XmlNode n_Event in nl_Event)
            {
                //得到事件名字
                string strEventENName = n_Event.SelectSingleNode("x:ENName", m_xmlManager).InnerText;
                if (strEventENName == strEvent)
                {
                    //得到事件包含的数据模型
                    nl_DataModel = n_Event.SelectNodes("x:DataModel", m_xmlManager);//查找该事件包含的所有数据模型
                    //循环,依次取出datamodel中data的变量名和它的类型
                    foreach (XmlNode n_DataModel in nl_DataModel)
                    {
                        vMRClsDef.DataModel oDataModel = new vMRClsDef.DataModel();
                        oDataModel.strDataName   = n_DataModel.SelectSingleNode("x:Data/x:DataName", m_xmlManager).InnerText;//数据名字
                        oDataModel.strDataCNName = n_DataModel.SelectSingleNode("x:Data/x:DisplayName", m_xmlManager).InnerText;
                        oDataModel.strDataCode   = n_DataModel.SelectSingleNode("x:Code", m_xmlManager).InnerText;
                        oDataModel.m_emDataType  = vMRClsDef.EnumDataType.STRING;
                        oDataModel.strDataValue  = "NULL";
                        oInputDataModel.lstDataModel.Add(oDataModel);
                    }
                    break;
                }
            }
        }
Пример #3
0
        public static bool ObtainConcludeWithEventFromCLIPSDataModel(string strEvent, ref List <vMRClsDef.DataModel> lstNewFact)
        {
            string strFilePath         = AppDomain.CurrentDomain.BaseDirectory + ClipsConfig.ReadConfig("Filepath");
            string strConcludeFileName = ClipsConfig.ReadConfig("ConcludeFileName");

            OpenXmlDoc(strFilePath + strConcludeFileName);

            XmlNodeList nl_DataModel = null;
            XmlNodeList nl_Event     = FindMulInstance("EventModel");//查找出xml文件中所有的触发事件节点

            foreach (XmlNode n_Event in nl_Event)
            {
                //得到事件名字
                string strEventENName = n_Event.SelectSingleNode("x:ENName", m_xmlManager).InnerText;
                if (strEventENName == strEvent)
                {
                    //得到事件包含的数据模型
                    nl_DataModel = n_Event.SelectNodes("x:DataModel", m_xmlManager);//查找该事件包含的所有数据模型
                    //循环,依次取出datamodel中data的变量名和它的类型
                    foreach (XmlNode n_DataModel in nl_DataModel)
                    {
                        vMRClsDef.DataModel oDataModel = new vMRClsDef.DataModel();
                        oDataModel.strDataName   = n_DataModel.SelectSingleNode("x:Data/x:DataName", m_xmlManager).InnerText;//数据名字
                        oDataModel.strDataCNName = n_DataModel.SelectSingleNode("x:Data/x:DisplayName", m_xmlManager).InnerText;
                        oDataModel.strDataCode   = n_DataModel.SelectSingleNode("x:Code", m_xmlManager).InnerText;
                        oDataModel.m_emDataType  = vMRClsDef.EnumDataType.STRING;
                        oDataModel.strDataValue  = "NULL";
                        lstNewFact.Add(oDataModel);
                    }
                    break;
                }
            }
            return(true);
        }
Пример #4
0
 /// <summary>
 /// 获取clips推理过程中新生成的facts
 /// </summary>
 /// <param name="lstNewFact"></param>
 private void GetNewAddFact(ref List <vMRClsDef.DataModel> lstNewFact)
 {
     for (int i = 0; i < lstNewFact.Count; i++)
     {
         vMRClsDef.DataModel oDataModel = new vMRClsDef.DataModel();
         oDataModel = lstNewFact[i];
         if (HTFactInfo.Contains(oDataModel.strDataName) == true)
         {
             FactInfo fi = (FactInfo)HTFactInfo[oDataModel.strDataName];
             lstNewFact[i].strDataValue = fi.FactValue;
         }
     }
 }
Пример #5
0
        public static void FormFactInDataModel(vMRClsDef.InputDataModel oInputDataModel, ref List <vMRClsDef.DataModel> lstDataModelForIE)
        {
            //Add Diesease into DataModels
            vMRClsDef.DataModel oDataModel = new vMRClsDef.DataModel();
            oDataModel.strDataName  = oInputDataModel.oTriggeringEvent.oEvent.strEventName;
            oDataModel.m_emDataType = vMRClsDef.EnumDataType.STRING;
            oDataModel.strDataValue = "on";
            lstDataModelForIE.Add(oDataModel);

            //Add Symptoms into DataModels
            lstDataModelForIE.AddRange(oInputDataModel.oTriggeringEvent.oSymptoms.lstSymptoms);

            //Add DataModels into DataModels
            lstDataModelForIE.AddRange(oInputDataModel.lstDataModel);
        }