use of org.kie.pmml.models.drools.ast.KiePMMLDroolsAST in project drools by kiegroup.
the class DroolsModelProviderTest method getPackageDescr.
@Test
public void getPackageDescr() {
KiePMMLDroolsAST kiePMMLDroolsAST = new KiePMMLDroolsAST(Collections.emptyList(), Collections.emptyList());
PackageDescr retrieved = droolsModelProvider.getPackageDescr(kiePMMLDroolsAST, PACKAGE_NAME);
commonVerifyPackageDescr(retrieved, PACKAGE_NAME);
}
use of org.kie.pmml.models.drools.ast.KiePMMLDroolsAST in project drools by kiegroup.
the class DroolsModelProviderTest method getKiePMMLDroolsASTCommon.
@Test
public void getKiePMMLDroolsASTCommon() {
final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = new HashMap<>();
final List<Field<?>> fields = getFieldsFromDataDictionaryAndTransformationDictionaryAndLocalTransformations(pmml.getDataDictionary(), pmml.getTransformationDictionary(), scorecard.getLocalTransformations());
KiePMMLDroolsAST retrieved = droolsModelProvider.getKiePMMLDroolsASTCommon(fields, scorecard, fieldTypeMap);
commonVerifyKiePMMLDroolsAST(retrieved, fieldTypeMap);
commonVerifyFieldTypeMap(fieldTypeMap, pmml.getDataDictionary().getDataFields(), pmml.getTransformationDictionary().getDerivedFields(), scorecard.getLocalTransformations().getDerivedFields());
}
use of org.kie.pmml.models.drools.ast.KiePMMLDroolsAST in project drools by kiegroup.
the class KiePMMLTreeModelASTFactory method getKiePMMLDroolsAST.
/**
* Returns the <code>KiePMMLDroolsAST</code> built out of the given parameters.
* It also <b>populate</b> the <b>fieldNameTypeNameMap</b> with mapping between original field' name and <b>original type/generated type</b> tupla
*
* @param dataDictionary
* @param model
* @param fieldTypeMap
* @param types
* @return
*/
public static KiePMMLDroolsAST getKiePMMLDroolsAST(final List<Field<?>> fields, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLDroolsType> types) {
logger.trace("getKiePMMLDroolsAST {} {}", fields, model);
DATA_TYPE targetType = getTargetFieldType(fields, model);
List<OutputField> outputFields = model.getOutput() != null ? model.getOutput().getOutputFields() : Collections.emptyList();
List<KiePMMLDroolsRule> rules = KiePMMLTreeModelNodeASTFactory.factory(fieldTypeMap, outputFields, model.getNoTrueChildStrategy(), targetType).declareRulesFromRootNode(model.getNode(), "");
return new KiePMMLDroolsAST(types, rules);
}
use of org.kie.pmml.models.drools.ast.KiePMMLDroolsAST in project drools by kiegroup.
the class KiePMMLTreeModelASTFactoryTest method getKiePMMLDroolsGolfingAST.
@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(getFieldsFromDataDictionary(golfingPmml.getDataDictionary()), golfingModel, fieldTypeMap, types);
assertNotNull(retrieved);
assertEquals(types, retrieved.getTypes());
assertFalse(retrieved.getRules().isEmpty());
}
use of org.kie.pmml.models.drools.ast.KiePMMLDroolsAST in project drools by kiegroup.
the class KiePMMLTreeModelASTFactoryTest method getKiePMMLDroolsIrisAST.
@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(getFieldsFromDataDictionary(irisPmml.getDataDictionary()), irisModel, fieldTypeMap, types);
assertNotNull(retrieved);
assertEquals(types, retrieved.getTypes());
assertFalse(retrieved.getRules().isEmpty());
}
Aggregations