KiePMMLTreeModelASTFactory extends KiePMMLAbstractModelASTFactory { public static KiePMMLDroolsAST getKiePMMLDroolsAST(final DataDictionary dataDictionary, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLDroolsType> types) { logger.trace("getKiePMMLDroolsAST {} {}", dataDictionary, model); DATA_TYPE targetType = getTargetFieldType(dataDictionary, model); final List<KiePMMLOutputField> outputFields = getOutputFields(model); List<KiePMMLDroolsRule> rules = KiePMMLTreeModelNodeASTFactory.factory(fieldTypeMap, outputFields, model.getNoTrueChildStrategy(), targetType).declareRulesFromRootNode(model.getNode(), ""); return new KiePMMLDroolsAST(types, rules); } private  KiePMMLTreeModelASTFactory(); static KiePMMLDroolsAST getKiePMMLDroolsAST(final DataDictionary dataDictionary,
                                                       final TreeModel model,
                                                       final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                       final List<KiePMMLDroolsType> types);  }
@Test public void getKiePMMLDroolsGolfingAST() { final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(golfingPmml.getDataDictionary(), golfingPmml.getTransformationDictionary(), golfingModel.getLocalTransformations()); List<KiePMMLDroolsType> types = Collections.emptyList(); KiePMMLDroolsAST retrieved = KiePMMLTreeModelASTFactory.getKiePMMLDroolsAST(golfingPmml.getDataDictionary(), golfingModel, fieldTypeMap, types); assertNotNull(retrieved); assertEquals(types, retrieved.getTypes()); assertFalse(retrieved.getRules().isEmpty()); }
@Test public void getKiePMMLDroolsIrisAST() { final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(irisPmml.getDataDictionary(), irisPmml.getTransformationDictionary(), irisModel.getLocalTransformations()); List<KiePMMLDroolsType> types = Collections.emptyList(); KiePMMLDroolsAST retrieved = KiePMMLTreeModelASTFactory.getKiePMMLDroolsAST(irisPmml.getDataDictionary(), irisModel, fieldTypeMap, types); assertNotNull(retrieved); assertEquals(types, retrieved.getTypes()); assertFalse(retrieved.getRules().isEmpty()); }
@Test public void getKiePMMLDroolsSimpleSetAST() { final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(simpleSetPmml.getDataDictionary(), simpleSetPmml.getTransformationDictionary(), simpleSetModel.getLocalTransformations()); List<KiePMMLDroolsType> types = Collections.emptyList(); KiePMMLDroolsAST retrieved = KiePMMLTreeModelASTFactory.getKiePMMLDroolsAST(simpleSetPmml.getDataDictionary(), simpleSetModel, fieldTypeMap, types); assertNotNull(retrieved); assertEquals(types, retrieved.getTypes()); assertFalse(retrieved.getRules().isEmpty()); }