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;
        }
        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);
            }
        }
        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);
        }
        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;
                }
            }
        }
示例#5
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;
         }
     }
 }