Exemple #1
0
        public void CreateCBRContext(ConfigInfo config, ICBRContext ctx)
        {
            //create case retrieve method
            ctx.SetCaseRetrievalMethod((IMethod)CreateInstance(config,
                                                               MappingKey.KEY_CASE_RETRIEVEL_METHOD));
            //create the computing similarity method
            ctx.SetSimilarity((ISimilarity)CreateInstance(config,
                                                          MappingKey.KEY_SIMILARITY));
            //create the case reuse method
            ctx.SetCaseReuseMethod((IMethod)CreateInstance(config,
                                                           MappingKey.KEY_CASE_REUSE_METHOD));
            //create the strategy of case reuse
            ctx.SetCaseReuseStrategy((ICaseReuseStrategy)CreateInstance(config,
                                                                        MappingKey.KEY_CASE_REUSE_STRATEGY));

            //create the case revise method
            ctx.SetCaseReviseMethod((IMethod)CreateInstance(config,
                                                            MappingKey.KEY_CASE_REVISE_METHOD));

            //create the case restore method
            ctx.SetCaseRestoreMethod((IMethod)CreateInstance(config,
                                                             MappingKey.KEY_CASE_RESTORE_METHOD));
            //create the input method of case base
            ctx.SetCaseBaseInput((ICaseBaseInput)CreateInstance(config,
                                                                MappingKey.KEY_CASEBASE_INPUT));
            //create the case base method
            ctx.SetCaseBase((ICaseBase)CreateInstance(config,
                                                      MappingKey.KEY_CASEBASE));
            //init the similarity threhold parameter
            string threhold = (string)CreateParameter(config,
                                                      MappingKey.KEY_PARAM_SIMILARITY_THREHOLD);

            if (threhold != null)
            {
                ctx.SetSimilarityThrehold(Convert.ToDouble(threhold));
            }
            //init the case base input type
            string type = (string)CreateParameter(config,
                                                  MappingKey.KEY_PARAM_CASEBASE_INPUT_TYPE);

            if (type != null)
            {
                ctx.SetCaseBaseInputType(Convert.ToInt32(type));
            }
            //init the case base url
            string url = (string)CreateParameter(config,
                                                 MappingKey.KEY_PARAM_CASEBASE_URL);

            ctx.SetCaseBaseURL(url);
        }