use of org.kie.pmml.models.drools.tree.model.KiePMMLTreeModel in project drools by kiegroup.
the class TreeModelImplementationProviderTest method getKiePMMLModel.
@Test
public void getKiePMMLModel() throws Exception {
final PMML pmml = getPMML(SOURCE_1);
KnowledgeBuilderImpl knowledgeBuilder = new KnowledgeBuilderImpl();
final CommonCompilationDTO<TreeModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, (TreeModel) pmml.getModels().get(0), new HasKnowledgeBuilderMock(knowledgeBuilder));
final KiePMMLTreeModel retrieved = PROVIDER.getKiePMMLModel(compilationDTO);
assertNotNull(retrieved);
commonVerifyIsDeepCloneable(retrieved);
}
use of org.kie.pmml.models.drools.tree.model.KiePMMLTreeModel in project drools by kiegroup.
the class KiePMMLTreeModelFactory method getKiePMMLTreeModel.
public static KiePMMLTreeModel getKiePMMLTreeModel(final DroolsCompilationDTO<TreeModel> compilationDTO) throws IllegalAccessException, InstantiationException {
logger.trace("getKiePMMLTreeModel {} {}", compilationDTO.getPackageName(), compilationDTO.getModel());
Map<String, String> sourcesMap = getKiePMMLTreeModelSourcesMap(compilationDTO);
try {
Class<?> kiePMMLTreeModelClass = compilationDTO.compileAndLoadClass(sourcesMap);
return (KiePMMLTreeModel) kiePMMLTreeModelClass.newInstance();
} catch (Exception e) {
throw new KiePMMLException(e);
}
}
use of org.kie.pmml.models.drools.tree.model.KiePMMLTreeModel in project drools by kiegroup.
the class KiePMMLTreeModelFactoryTest method getKiePMMLTreeModel.
@Test
public void getKiePMMLTreeModel() throws InstantiationException, IllegalAccessException {
final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(pmml.getDataDictionary(), pmml.getTransformationDictionary(), treeModel.getLocalTransformations());
KnowledgeBuilderImpl knowledgeBuilder = new KnowledgeBuilderImpl();
final CommonCompilationDTO<TreeModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, treeModel, new HasKnowledgeBuilderMock(knowledgeBuilder));
final DroolsCompilationDTO<TreeModel> droolsCompilationDTO = DroolsCompilationDTO.fromCompilationDTO(compilationDTO, fieldTypeMap);
KiePMMLTreeModel retrieved = KiePMMLTreeModelFactory.getKiePMMLTreeModel(droolsCompilationDTO);
assertNotNull(retrieved);
assertEquals(treeModel.getModelName(), retrieved.getName());
assertEquals(TARGET_FIELD, retrieved.getTargetField());
}
Aggregations