use of org.kie.internal.builder.KnowledgeBuilderResult in project drools by kiegroup.
the class PMML4Compiler method compile.
public String compile(InputStream source, ClassLoader classLoader) {
this.results = new ArrayList<KnowledgeBuilderResult>();
PMML pmml = loadModel(PMML, source);
return compile(pmml, classLoader);
}
use of org.kie.internal.builder.KnowledgeBuilderResult in project drools by kiegroup.
the class PMML4Compiler method precompile.
public List<PMMLResource> precompile(InputStream stream, ClassLoader classLoader, KieBaseModel rootKieBaseModel) {
List<PMMLResource> resources = new ArrayList<>();
KieServices services = KieServices.Factory.get();
KieModuleModel module = services.newKieModuleModel();
this.results = new ArrayList<KnowledgeBuilderResult>();
PMML pmml = loadModel(PMML, stream);
helper.setResolver(classLoader);
PMML4Unit unit = new PMML4UnitImpl(pmml);
if (unit.containsMiningModel()) {
Miningmodel rootModel = unit.getRootMiningModel();
resources = buildResourcesFromModel(pmml, rootModel, null, classLoader, module);
} else {
PMML4Model rootModel = unit.getRootModel();
if (rootModel != null) {
helper.setPack(rootModel.getModelPackageName());
KieBaseModel kbm = module.newKieBaseModel(rootModel.getModelId());
kbm.addPackage(helper.getPack()).setDefault(true).setEventProcessingMode(EventProcessingOption.CLOUD);
PMMLResource resource = new PMMLResource(helper.getPack());
resource.setKieBaseModel(kbm);
resource.addRules(rootModel.getModelId(), this.compile(pmml, classLoader));
resources.add(resource);
}
}
return resources;
}
Aggregations