PMMLMiningModelEvaluator implements PMMLModelEvaluator<KiePMMLMiningModel> { PMMLRuntime getPMMLRuntime(final String kModulePackageName, final KieBase knowledgeBase, final String containerModelName) { final String key = containerModelName + "_" + kModulePackageName; InternalKnowledgeBase kieBase = MAPPED_KIEBASES.computeIfAbsent(key, s -> { final KiePackage kiePackage = knowledgeBase.getKiePackage(kModulePackageName); final List<KiePackage> packages = kiePackage != null ? Collections.singletonList(knowledgeBase.getKiePackage(kModulePackageName)) : Collections.emptyList(); RuleBaseConfiguration conf = new RuleBaseConfiguration(); conf.setClassLoader(((KnowledgeBaseImpl) knowledgeBase).getRootClassLoader()); InternalKnowledgeBase toReturn = KnowledgeBaseFactory.newKnowledgeBase(kModulePackageName, conf); toReturn.addPackages(packages); return toReturn; }); KieRuntimeFactory kieRuntimeFactory = KieRuntimeFactory.of(kieBase); return kieRuntimeFactory.get(PMMLRuntime.class); }  @Override PMML_MODEL getPMMLModelType(); @Override PMML4Result evaluate(final KieBase knowledgeBase,
                                final KiePMMLMiningModel model,
                                final PMMLContext pmmlContext);  }
@Test public void getPMMLRuntime() { final KieServices kieServices = KieServices.Factory.get(); final KieContainer kieContainer = kieServices.newKieClasspathContainer(); final KieBase kieBase = kieContainer.getKieBase(); String kModulePackageName = "kModulePackageNameA"; String containerModelName = "containerModelNameA"; PMMLRuntime retrieved = evaluator.getPMMLRuntime(kModulePackageName, kieBase, containerModelName); assertNotNull(retrieved); PMMLRuntime secondRetrieved = evaluator.getPMMLRuntime(kModulePackageName, kieBase, containerModelName); assertEquals(retrieved.getKnowledgeBase(), secondRetrieved.getKnowledgeBase()); kModulePackageName = "kModulePackageNameB"; containerModelName = "containerModelNameB"; PMMLRuntime thirdRetrieved = evaluator.getPMMLRuntime(kModulePackageName, kieBase, containerModelName); assertNotNull(thirdRetrieved); assertNotEquals(retrieved.getKnowledgeBase(), thirdRetrieved.getKnowledgeBase()); }