Пример #1
0
 /// <summary>
 /// 根据推理类型,选择CLIPS推理入口文件
 /// </summary>
 /// <param name="strRuleLevel"></param>
 /// <param name="oTriggeringEvent"></param>
 /// <returns></returns>
 public static string ObtainRuleEntrance(string strRuleLevel, vMRClsDef.TriggeringEvent oTriggeringEvent)
 {
     if (strRuleLevel == "LEVEL_CLINICIANS")
     {
         switch (oTriggeringEvent.m_emInferenceResultType)
         {
             case vMRClsDef.EnumInferenceResultType.DIAGNOSIS:
             case vMRClsDef.EnumInferenceResultType.THERAPY:
             case vMRClsDef.EnumInferenceResultType.SELFMONITOR:
             case vMRClsDef.EnumInferenceResultType.MSEVALUATION:
                 return "Entrance.clp";
             case vMRClsDef.EnumInferenceResultType.DIETARY:
                 return "MS_DietDataJudge.clp";
             case vMRClsDef.EnumInferenceResultType.PHYSICALACTIVITY:
                 return "MS_SportDataJudge.clp";
             case vMRClsDef.EnumInferenceResultType.RISKEVALUATION:
                 return "MS_MSRiskDegreeEvaluation.clp";
             default:
                 return string.Empty;
         }
     }
     else
     {
         return string.Empty;
     }
 }
        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 ConstructExplanation(ClipsEngine.Interpretation oClipsInterpration,ref vMRClsDef.OutputInfo oOutputInfo)
 {
     vMRClsDef.CLIPSInterpretation oIEInterpration = new vMRClsDef.CLIPSInterpretation();
     oIEInterpration.lstFactUsed.AddRange(oClipsInterpration.lstFactUsed);
     oIEInterpration.lstRecomm.AddRange(oClipsInterpration.lstRecomm);
     oIEInterpration.strInterpretationIndex = oClipsInterpration.strInterpretationIndex;
     oOutputInfo.oExplanation.lstClipsInterpretation.Add(oIEInterpration);
 }
 /// <summary>
 /// �������������������
 /// </summary>
 /// <param name="oRoles"></param>
 /// <param name="lstDataModelForIE"></param>
 /// <param name="oIEOutputInfo"></param>
 /// <returns></returns>
 public static bool BeginInference(
     vMRClsDef.Role oRoles,
     List<vMRClsDef.DataModel> lstDataModelForIE, 
     ref vMRClsDef.OutputInfo oIEOutputInfo)
 {
     ForwardsInference(oRoles, lstDataModelForIE, ref oIEOutputInfo);
     BackwardsInference();
     return true;
 }
 /// <summary>
 /// ����User��ɫѡ��Rule Level
 /// </summary>
 /// <param name="oRoles"></param>
 /// <returns></returns>
 public static string ChooseRuleLevelWithRole(vMRClsDef.Role oRoles)
 {
     string strRoleLevel = oRoles.oClinician.strClinicianLevel;
     switch (strRoleLevel)
     {
         default:
             //���ݽ�ɫѡ�����
             return "LEVEL_CLINICIANS";
     }
 }
Пример #6
0
        public static bool ObtainDataModelWithEventFromCLIPSDataModel(ref vMRClsDef.InputDataModel oInputDataModel)
        {
            string strFilePath = AppDomain.CurrentDomain.BaseDirectory + ClipsConfig.ReadConfig("Filepath");
            string strDataModelFileName = ClipsConfig.ReadConfig("DataModelFileName");
            string strManualAddDataModelFileName = ClipsConfig.ReadConfig("ManualAddDataModelFileName");
            ObtainDataModel(strFilePath, strDataModelFileName, ref oInputDataModel);
            //ObtainDataModel(strFilePath, strManualAddDataModelFileName, ref oInputDataModel);

            return true;
        }
Пример #7
0
 public static void MapEvent(string strEventName, ref vMRClsDef.TriggeringEvent oTriggeringEvent)
 {
     switch(strEventName)
     {
         case ClipsEventsDef.CONST_EVENTENNAME_HeadacheDiagnosis:
             oTriggeringEvent.oDisease.strDiseaseCNName = "Headache_Diagnosis_Event";
             oTriggeringEvent.m_emInferenceResultType = vMRClsDef.EnumInferenceResultType.DIAGNOSIS;
             return;
         default:
             return;
     }
 }
        public static void AddIEStructedInfo(vMRClsDef.IEvMROutput oIEvMROutput)
        {
            foreach(vMRClsDef.OutputInfo oOutputInfo in oIEvMROutput.lstOutputInfo)
            {
                StructedConclude oStructedIEInfo = new StructedConclude();
                oStructedIEInfo.oEventModel.strEventENName = oOutputInfo.oTriggeringEvent.oEvent.strEventName;
                oStructedIEInfo.oEventModel.strEventCNName = oOutputInfo.oTriggeringEvent.oEvent.strEventCNName;
                oStructedIEInfo.lstConclude.AddRange(oOutputInfo.oInference.lstStructedInferMessage);

                lstStructedConclude.Add(oStructedIEInfo);
            }
        }
Пример #9
0
 /// <summary>
 /// ��������˾��ߴ���������ʵ�֣�UI�˵���
 /// </summary>
 /// <param name="oIEvMRInputDataValue"></param>
 /// <param name="oIEvMROutput"></param>
 /// <returns></returns>
 public static bool vMRDataValueFromUItoIE(vMRClsDef.IEvMRInput oIEvMRInputDataValue, ref vMRClsDef.IEvMROutput oIEvMROutput)
 {
     oIEvMROutput.oRoles = oIEvMRInputDataValue.oRoles;
     foreach(vMRClsDef.InputDataModel oInputDataModel in oIEvMRInputDataValue.lstInputDataModel)
     {
         List<vMRClsDef.DataModel> lstDataModelForIE = new List<vMRClsDef.DataModel>();
         vMRClsDef.OutputInfo oIEOutputInfo = new vMRClsDef.OutputInfo();
         FactConstruct.FormFactInDataModel(oInputDataModel, ref lstDataModelForIE);
         oIEOutputInfo.oTriggeringEvent = oInputDataModel.oTriggeringEvent;
         InferenceService.BeginInference(oIEvMROutput.oRoles, lstDataModelForIE, ref oIEOutputInfo);
         ExplanationService.BeginExplanation();
         oIEvMROutput.lstOutputInfo.Add(oIEOutputInfo);
     }
     return true;
 }
Пример #10
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);
        }
Пример #11
0
 /// <summary>
 /// ��������
 /// </summary>
 /// <param name="oRoles"></param>
 /// <param name="lstDataModelForIE"></param>
 /// <param name="oIEOutputInfo"></param>
 /// <returns></returns>
 public static bool ForwardsInference(
     vMRClsDef.Role oRoles, 
     List<vMRClsDef.DataModel> lstDataModelForIE,
     ref vMRClsDef.OutputInfo oIEOutputInfo)
 {
     string strRuleLevel = ChooseRuleLevelWithRole(oRoles);
     if (strRuleLevel != string.Empty)
     {
         return ReasonWithCLIPSEngine(strRuleLevel, lstDataModelForIE, ref oIEOutputInfo);
     }
     else
     {
         return false;
     }
 }
Пример #12
0
        public static string ObtainEventCNNamewithEventName(vMRClsDef.OutputInfo oOutputInfo)
        {
            if(lstTriggeringEvents.Count == 0)
            {
                ObtainTriggeringEventListFromCLIPSDataModel();
            }

            foreach(vMRClsDef.TriggeringEvent oTriggeringEvent in  lstTriggeringEvents)
            {
                if(oOutputInfo.oTriggeringEvent.oEvent.strEventName == oTriggeringEvent.oEvent.strEventName)
                {
                    return oTriggeringEvent.oEvent.strEventCNName;
                }
            }

            return string.Empty;
        }
Пример #13
0
 /// <summary>
 /// ��֪ʶ���ȡ����ģ��
 /// </summary>
 /// <param name="oIEvMRInputDataModel"></param>
 /// <returns></returns>
 public static bool vMRDataModelFromIEtoUI(ref vMRClsDef.IEvMRInput oIEvMRInputDataModel)
 {
     for (int i = 0; i < oIEvMRInputDataModel.lstInputDataModel.Count; i++)
     {
         vMRClsDef.InputDataModel oInputDataModel = new vMRClsDef.InputDataModel();
         oInputDataModel.oTriggeringEvent
             = oIEvMRInputDataModel.lstInputDataModel[i].oTriggeringEvent;
         //���ȸ����¼���ȡDataModel
         FactObtain.ObtainFactWithDisease(ref oInputDataModel);
         oIEvMRInputDataModel.lstInputDataModel[i].lstDataModel.AddRange(oInputDataModel.lstDataModel);
         //�������󣬸���Symptom��ȡDataModel;
         oInputDataModel.lstDataModel.Clear();
         FactObtain.ObtainFactWithSymptoms(ref oInputDataModel);
         oIEvMRInputDataModel.lstInputDataModel[i].lstDataModel.AddRange(oInputDataModel.lstDataModel);
     }
     return true;
 }
Пример #14
0
 /// <summary>
 /// ���ݼ�����ȡ����ģ��
 /// </summary>
 /// <param name="oInputDataModel"></param>
 /// <returns></returns>
 public static bool ObtainFactWithDisease(ref vMRClsDef.InputDataModel oInputDataModel)
 {
     return ClipsFactObtain.ObtainDataModelWithEventFromCLIPSDataModel(ref oInputDataModel);
 }
Пример #15
0
 public static FunctionTypeDef.EnumInferenceResultType MapInferResultTypevMRtoFunction(
     vMRClsDef.EnumInferenceResultType em_vMRInferResult)
 {
     switch(em_vMRInferResult)
     {
         case vMRClsDef.EnumInferenceResultType.DIAGNOSIS:
             return FunctionTypeDef.EnumInferenceResultType.DIAGNOSIS;
         case vMRClsDef.EnumInferenceResultType.THERAPY:
             return FunctionTypeDef.EnumInferenceResultType.THERAPY;
         case vMRClsDef.EnumInferenceResultType.SELFMONITOR:
             return FunctionTypeDef.EnumInferenceResultType.SELFMONITOR;
         case vMRClsDef.EnumInferenceResultType.MSEVALUATION:
             return FunctionTypeDef.EnumInferenceResultType.MSEVALUATION;
         case vMRClsDef.EnumInferenceResultType.RISKEVALUATION:
             return FunctionTypeDef.EnumInferenceResultType.RISKEVALUATION;
         case vMRClsDef.EnumInferenceResultType.DIETARY:
             return FunctionTypeDef.EnumInferenceResultType.DIETARY;
         case vMRClsDef.EnumInferenceResultType.PHYSICALACTIVITY:
             return FunctionTypeDef.EnumInferenceResultType.PHYSICALACTIVITY;
         default:
             return FunctionTypeDef.EnumInferenceResultType.OTHER;
      }
 }
Пример #16
0
 public static void MapIEOutputToUI(vMRClsDef.IEvMRInput oIEvMRInput, vMRClsDef.IEvMROutput oIEvMROutput)
 {
     //TODO IE������ӳ�䣬��������ʾ
     foreach(vMRClsDef.OutputInfo oOutputInfo in oIEvMROutput.lstOutputInfo)
     {
         int i;
         for ( i = 0; i < oIEvMRInput.lstInputDataModel.Count; i++)
         {
             if(oOutputInfo.oTriggeringEvent.oEvent.strEventCNName
                 == oIEvMRInput.lstInputDataModel[i].oTriggeringEvent.oEvent.strEventCNName)
             {
                 break;
             }
         }
         FormatResult(oIEvMRInput.lstInputDataModel[i], oOutputInfo);
     }
 }
Пример #17
0
        /// <summary>
        /// DataModel code��SystemDataӳ�䣬����oIEvMRInput���и�ֵ
        /// </summary>
        /// <param name="oIEvMRInput"></param>
        /// <returns></returns>
        public static bool MapDataToFact(ref vMRClsDef.IEvMRInput oIEvMRInput)
        {
            //TODO ����ӳ�����ʵ��
            for(int i = 0; i < oIEvMRInput.lstInputDataModel.Count; i++)
            {
                for(int j = 0; j < oIEvMRInput.lstInputDataModel[i].lstDataModel.Count; j++)
                {
                    string strStandDataCode
                        = oIEvMRInput.lstInputDataModel[i].lstDataModel[j].strDataCode;

                    //string strClassName
                    //    = MappingToClassFromXml.ObtainClassNameWithDataCode(strStandDataCode);
                    //if (strClassName != string.Empty)
                    //{
                    //    object objClassDataValue = DynamicMapperToSystemData.GetMapperValue(strClassName);
                    //    if (objClassDataValue != null)
                    //    {
                    //        oIEvMRInput.lstInputDataModel[i].lstDataModel[j].strDataValue
                    //            = objClassDataValue.ToString();
                    //    }
                    //    else
                    //    {
                    //        oIEvMRInput.lstInputDataModel[i].lstDataModel[j].strDataValue
                    //        = "NULL";
                    //    }

                    //}
                    //else
                    //{
                    //    oIEvMRInput.lstInputDataModel[i].lstDataModel[j].strDataValue = "NULL";
                    //}

                    oIEvMRInput.lstInputDataModel[i].lstDataModel[j].strDataValue
                    = TempDataMap.ObtainDataValueWithDataCode(strStandDataCode);
                }
            }

            return true;
        }
Пример #18
0
 public static void FormatShortDataInfo(vMRClsDef.InputDataModel oIEInputDataModel, vMRClsDef.OutputInfo oOutputInfo, ref string strExistShortData)
 {
     //string strShortData = string.Empty;
     for(int i = 0; i < oOutputInfo.lstShortDataModel.Count; i++)
     {
         string strDataName = oOutputInfo.lstShortDataModel[i].strDataName;
         foreach(vMRClsDef.DataModel oDataModel in oIEInputDataModel.lstDataModel)
         {
             //BugDB00005686 revised by wbf 2009-03-26
             if(oDataModel.strDataName == strDataName)
             {
                 if (!strExistShortData.Contains(oDataModel.strDataCNName))
                 {
                     strExistShortData += oDataModel.strDataCNName + " ";
                 }
             }
         }
     }
 }
Пример #19
0
 public static void FormatResult(vMRClsDef.InputDataModel oIEInputDataModel, vMRClsDef.OutputInfo oOutputInfo)
 {
     switch (oOutputInfo.oTriggeringEvent.m_emInferenceResultType)
     {
         case vMRClsDef.EnumInferenceResultType.DIAGNOSIS:
             FormatDiagnosiResult(oIEInputDataModel, oOutputInfo);
             //FormatExplanation(oIEInputDataModel, oOutputInfo);
             break;
         //case vMRClsDef.EnumInferenceResultType.MSEVALUATION:
         //    FormatMSEvaluationResult(oOutputInfo);
         //    break;
         //case vMRClsDef.EnumInferenceResultType.THERAPY:
         //    FormatTherpayResult(oIEInputDataModel, oOutputInfo);
         //    break;
         //case vMRClsDef.EnumInferenceResultType.SELFMONITOR:
         //    FormatSelfMonitorResult(oIEInputDataModel, oOutputInfo);
         //    break;
         //case vMRClsDef.EnumInferenceResultType.RISKEVALUATION:
         //    FormatMSRiskEvaluationResult(oOutputInfo);
         //    break;
         //case vMRClsDef.EnumInferenceResultType.DIETARY:
         //    FormatDietary(oIEInputDataModel, oOutputInfo);
         //    break;
         //case vMRClsDef.EnumInferenceResultType.PHYSICALACTIVITY:
         //    FormatPhysicalActivity(oIEInputDataModel, oOutputInfo);
         //    break;
         default:
             break;
     }
 }
Пример #20
0
        public static void FormatDiagnosiResult(vMRClsDef.InputDataModel oIEInputDataModel, vMRClsDef.OutputInfo oOutputInfo)
        {
            int iResultIndex = DiseaseInfoExisted(oOutputInfo);

            string result = string.Empty;
            string tmpresult = string.Empty;
            for (int i = 0; i < oOutputInfo.oInference.lstStructedInferMessage.Count; i++)
            {
                tmpresult = oOutputInfo.oInference.lstStructedInferMessage[i].strDataValue;

                if (tmpresult != "")
                    result = result + MapStructedInfoToCN(tmpresult) + " ";
            }
            GlobalData.DiagnosedResult.DiseaseDiagnosedResultList[iResultIndex].Result = result;
            FormatShortDataInfo(oIEInputDataModel, oOutputInfo, ref GlobalData.DiagnosedResult.DiseaseDiagnosedResultList[iResultIndex].DataNeeded);
        }
Пример #21
0
        public static int DiseaseInfoExisted(vMRClsDef.OutputInfo oOutputInfo)
        {
            for (int i = 0; i < GlobalData.DiagnosedResult.DiseaseDiagnosedResultList.Count; i++)
            {
                if (GlobalData.DiagnosedResult.DiseaseDiagnosedResultList[i].Name == oOutputInfo.oTriggeringEvent.oDisease.strDiseaseCNName)
                {
                    return i;
                }
            }

            CDSSOneDiseaseDiagnosedResult oOneDiseaseDiagnosedResult = new CDSSOneDiseaseDiagnosedResult();
            oOneDiseaseDiagnosedResult.Name = oOutputInfo.oTriggeringEvent.oDisease.strDiseaseCNName;
            GlobalData.DiagnosedResult.DiseaseDiagnosedResultList.Add(oOneDiseaseDiagnosedResult);

            return GlobalData.DiagnosedResult.DiseaseDiagnosedResultList.Count - 1;
        }
Пример #22
0
 /// <summary>
 /// UI�˾��ߴ�������������ʵ�֣���������˵���
 /// </summary>
 /// <param name="oIEvMROutput"></param>
 /// <returns></returns>
 public static bool OutputFromIEtoUI(ref vMRClsDef.IEvMROutput oIEvMROutput)
 {
     return true;
 }
Пример #23
0
 /// <summary>
 /// ����Symptoms��ȡ����ģ��
 /// </summary>
 /// <param name="oInputDataModel"></param>
 /// <returns></returns>
 public static bool ObtainFactWithSymptoms(ref vMRClsDef.InputDataModel oInputDataModel)
 {
     return ClipsFactObtain.ObtainDataModelWithSymptomsFromCLIPSDataModel(ref oInputDataModel);
 }
Пример #24
0
 public static string ObtainDataCNNamewithDataName(vMRClsDef.OutputInfo oOutputInfo, string strDataName)
 {
     return string.Empty;
 }
Пример #25
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;
                }
            }
        }
Пример #26
0
        /// <summary>
        /// Clips推理接口调用
        /// </summary>
        /// <param name="strRuleLevel"></param>
        /// <param name="lstDataModelForIE"></param>
        /// <param name="lstNewFact"></param>
        /// <param name="oTriggeringEvent"></param>
        /// <returns></returns>
        public bool DoInference(string strRuleLevel, List<vMRClsDef.DataModel> lstDataModelForIE,
            ref List<vMRClsDef.DataModel> lstNewFact, vMRClsDef.TriggeringEvent oTriggeringEvent)
        {
            bool bRet = true;
            string strRuleEntrance = ObtainRuleEntrance(strRuleLevel, oTriggeringEvent);
            UserDefinedFun();
            m_oRuleEngine.Watch("all");
            //////////////////////////////////////////////////////////////////////////
            string strfilepath = AppDomain.CurrentDomain.BaseDirectory + ClipsConfig.ReadConfig("Filepath");

            //////////////////////////////////////////////////////////////////////////
            m_oRuleEngine.Load(strfilepath + strRuleEntrance); //load rule
            m_oRuleEngine.Load(strfilepath + "function.clp"); //load deffunction
            DataObject d = m_oRuleEngine.CreateDataObject();
            OperateFact("filepath", "\"" + strfilepath.Replace("\\", "\\\\") + "\"");//load fact filepath

            //load fact of data
            foreach (vMRClsDef.DataModel oDataModel in lstDataModelForIE)
            {
                OperateFact(oDataModel.strDataName, oDataModel.strDataValue);
            }

            //bool bDribbleOn = m_oRuleEngine.DribbleOn("..\\Rule\\out.txt");
            string strIEProcessName =
                System.DateTime.Now.ToString("yyyyMMddHHmmss") + "_"
                + oTriggeringEvent.oEvent.strEventName;
            //////////////////////////////////////////////////////////////////////////
            string strLogPath = AppDomain.CurrentDomain.BaseDirectory + ClipsConfig.ReadConfig("LogPath");
            string strLogFlag = AppDomain.CurrentDomain.BaseDirectory + ClipsConfig.ReadConfig("LogFlag");
            //////////////////////////////////////////////////////////////////////////
            string strIELogDirectory = strLogPath + "IELog\\";

            //如果日志文件目录不存在,则创建该目录
            if (Directory.Exists(strIELogDirectory) == false)
            {
                Directory.CreateDirectory(strIELogDirectory);
            }
            strIELogDirectory = strIELogDirectory + strIEProcessName + ".txt";
            if (strLogFlag == "1")
            {
                bool bDribbleOn = m_oRuleEngine.DribbleOn(strIELogDirectory);
            }

            int nRunRet = m_oRuleEngine.Run(-1);
            m_oRuleEngine.DribbleOff();
            GetNewAddFact(ref lstNewFact);

            return bRet;
        }
Пример #27
0
 /// <summary>
 /// ʹ��CLIPS���������������
 /// </summary>
 /// <param name="strRuleLevel"></param>
 /// <param name="lstDataModelForIE"></param>
 /// <param name="oIEOutputInfo"></param>
 /// <returns></returns>
 public static bool ReasonWithCLIPSEngine(string strRuleLevel, List<vMRClsDef.DataModel> lstDataModelForIE,
     ref vMRClsDef.OutputInfo oIEOutputInfo)
 {
     //ClipsEngine oClipsEngine = new ClipsEngine();
     oClipsEngine.Clear();
     List<vMRClsDef.DataModel> lstNewFact = new List<vMRClsDef.DataModel>();
     FactObtain.ObtainConcludeWithEvent(oIEOutputInfo.oTriggeringEvent.oEvent.strEventName, ref lstNewFact);
     if (oIEOutputInfo.oTriggeringEvent.m_emInferenceType
         == vMRClsDef.EnumInferenceType.PRIMARY)
     {
         oClipsEngine.DoInference(strRuleLevel, lstDataModelForIE, ref lstNewFact, oIEOutputInfo.oTriggeringEvent);
         InferenceResultConstruct.ConstructInferResult(oClipsEngine.InferResult, lstNewFact, ref oIEOutputInfo);
         return true;
     }
     else if (oIEOutputInfo.oTriggeringEvent.m_emInferenceType
         == vMRClsDef.EnumInferenceType.SECONDTIME)
     {
         //GoOnInference();
         return true;
     }
     else
     {
         return false;
     }
 }
Пример #28
0
 public static bool ObtainDataModelWithSymptomsFromCLIPSDataModel(ref vMRClsDef.InputDataModel oInputDataModel)
 {
     //�����ݲ�ʵ��
     return true;
 }