Search in sources :

Example 36 with KiePMMLDroolsRule

use of org.kie.pmml.models.drools.ast.KiePMMLDroolsRule 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);
}
Also used : KiePMMLDroolsAST(org.kie.pmml.models.drools.ast.KiePMMLDroolsAST) OutputField(org.dmg.pmml.OutputField) KiePMMLDroolsRule(org.kie.pmml.models.drools.ast.KiePMMLDroolsRule) DATA_TYPE(org.kie.pmml.api.enums.DATA_TYPE)

Aggregations

KiePMMLDroolsRule (org.kie.pmml.models.drools.ast.KiePMMLDroolsRule)36 Test (org.junit.Test)33 ArrayList (java.util.ArrayList)25 HashMap (java.util.HashMap)14 KiePMMLOriginalTypeGeneratedType (org.kie.pmml.models.drools.tuples.KiePMMLOriginalTypeGeneratedType)14 KiePMMLASTTestUtils.getPredicateASTFactoryData (org.kie.pmml.models.drools.utils.KiePMMLASTTestUtils.getPredicateASTFactoryData)14 SimplePredicate (org.dmg.pmml.SimplePredicate)9 Attribute (org.dmg.pmml.scorecard.Attribute)6 KiePMMLFieldOperatorValue (org.kie.pmml.models.drools.ast.KiePMMLFieldOperatorValue)6 CompoundPredicate (org.dmg.pmml.CompoundPredicate)5 SimpleSetPredicate (org.dmg.pmml.SimpleSetPredicate)5 List (java.util.List)4 DATA_TYPE (org.kie.pmml.api.enums.DATA_TYPE)4 OutputField (org.dmg.pmml.OutputField)3 Characteristic (org.dmg.pmml.scorecard.Characteristic)3 ResultCode (org.kie.pmml.api.enums.ResultCode)3 KiePMMLDroolsAST (org.kie.pmml.models.drools.ast.KiePMMLDroolsAST)3 Map (java.util.Map)2 Field (org.dmg.pmml.Field)2 True (org.dmg.pmml.True)2