/// <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); } }
/// <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); }
/// <summary> /// 获取可以进行推理的事件 /// </summary> /// <param name="oInferEvents"></param> /// <returns></returns> public static bool ObtainInferEvents(ref List <vMRClsDef.TriggeringEvent> oInferEvents) { return(FactObtain.ObtainEventList(ref oInferEvents)); }