Search in sources :

Example 1 with KiePMMLExpression

use of org.kie.pmml.commons.model.expressions.KiePMMLExpression in project drools by kiegroup.

the class KiePMMLOutputFieldInstanceFactory method getKiePMMLOutputField.

public static KiePMMLOutputField getKiePMMLOutputField(final OutputField outputField) {
    String name = outputField.getName() != null ? outputField.getName().getValue() : "" + outputField.hashCode();
    final String targetField = outputField.getTargetField() != null ? outputField.getTargetField().getValue() : null;
    final RESULT_FEATURE resultFeature = outputField.getResultFeature() != null ? RESULT_FEATURE.byName(outputField.getResultFeature().value()) : null;
    final DATA_TYPE dataType = outputField.getDataType() != null ? DATA_TYPE.byName(outputField.getDataType().value()) : null;
    final KiePMMLExpression kiePMMLExpression = outputField.getExpression() != null ? getKiePMMLExpression(outputField.getExpression()) : null;
    final KiePMMLOutputField.Builder builder = KiePMMLOutputField.builder(name, Collections.emptyList()).withResultFeature(resultFeature).withTargetField(targetField).withValue(outputField.getValue()).withDataType(dataType).withRank(outputField.getRank()).withKiePMMLExpression(kiePMMLExpression);
    return builder.build();
}
Also used : KiePMMLOutputField(org.kie.pmml.commons.model.KiePMMLOutputField) RESULT_FEATURE(org.kie.pmml.api.enums.RESULT_FEATURE) KiePMMLExpression(org.kie.pmml.commons.model.expressions.KiePMMLExpression) KiePMMLExpressionInstanceFactory.getKiePMMLExpression(org.kie.pmml.compiler.commons.factories.KiePMMLExpressionInstanceFactory.getKiePMMLExpression) DATA_TYPE(org.kie.pmml.api.enums.DATA_TYPE)

Example 2 with KiePMMLExpression

use of org.kie.pmml.commons.model.expressions.KiePMMLExpression in project drools by kiegroup.

the class KiePMMLExpressionInstanceFactoryTest method getKiePMMLExpression.

@Test
public void getKiePMMLExpression() {
    Expression toConvert = getRandomApply();
    KiePMMLExpression retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomConstant();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomDiscretize();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomFieldRef();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomMapValues();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomNormContinuous();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomNormDiscrete();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
    toConvert = getRandomTextIndex();
    retrieved = KiePMMLExpressionInstanceFactory.getKiePMMLExpression(toConvert);
    commonVerifyKiePMMLExpression(retrieved, toConvert);
}
Also used : KiePMMLExpression(org.kie.pmml.commons.model.expressions.KiePMMLExpression) Expression(org.dmg.pmml.Expression) InstanceFactoriesTestCommon.commonVerifyKiePMMLExpression(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLExpression) KiePMMLExpression(org.kie.pmml.commons.model.expressions.KiePMMLExpression) InstanceFactoriesTestCommon.commonVerifyKiePMMLExpression(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLExpression) Test(org.junit.Test)

Aggregations

KiePMMLExpression (org.kie.pmml.commons.model.expressions.KiePMMLExpression)2 Expression (org.dmg.pmml.Expression)1 Test (org.junit.Test)1 DATA_TYPE (org.kie.pmml.api.enums.DATA_TYPE)1 RESULT_FEATURE (org.kie.pmml.api.enums.RESULT_FEATURE)1 KiePMMLOutputField (org.kie.pmml.commons.model.KiePMMLOutputField)1 InstanceFactoriesTestCommon.commonVerifyKiePMMLExpression (org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLExpression)1 KiePMMLExpressionInstanceFactory.getKiePMMLExpression (org.kie.pmml.compiler.commons.factories.KiePMMLExpressionInstanceFactory.getKiePMMLExpression)1