Search in sources :

Example 1 with KiePMMLMapValues

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

the class KiePMMLMapValuesInstanceFactory method getKiePMMLMapValues.

static KiePMMLMapValues getKiePMMLMapValues(final MapValues mapValues) {
    DATA_TYPE dataType = mapValues.getDataType() != null ? DATA_TYPE.byName(mapValues.getDataType().value()) : null;
    KiePMMLMapValues.Builder builder = KiePMMLMapValues.builder(UUID.randomUUID().toString(), getKiePMMLExtensions(mapValues.getExtensions()), mapValues.getOutputColumn()).withKiePMMLInlineTable(getKiePMMLInlineTable(mapValues.getInlineTable())).withDataType(dataType);
    if (mapValues.getDefaultValue() != null) {
        builder = builder.withDefaultValue(mapValues.getDefaultValue().toString());
    }
    if (mapValues.getMapMissingTo() != null) {
        builder = builder.withMapMissingTo(mapValues.getMapMissingTo().toString());
    }
    if (mapValues.hasFieldColumnPairs()) {
        builder = builder.withKiePMMLFieldColumnPairs(getKiePMMLFieldColumnPairs(mapValues.getFieldColumnPairs()));
    }
    return builder.build();
}
Also used : KiePMMLMapValues(org.kie.pmml.commons.model.expressions.KiePMMLMapValues) DATA_TYPE(org.kie.pmml.api.enums.DATA_TYPE)

Example 2 with KiePMMLMapValues

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

the class KiePMMLMapValuesInstanceFactoryTest method getKiePMMLMapValues.

@Test
public void getKiePMMLMapValues() {
    MapValues toConvert = getRandomMapValues();
    KiePMMLMapValues retrieved = KiePMMLMapValuesInstanceFactory.getKiePMMLMapValues(toConvert);
    commonVerifyKiePMMLMapValues(retrieved, toConvert);
}
Also used : KiePMMLMapValues(org.kie.pmml.commons.model.expressions.KiePMMLMapValues) InstanceFactoriesTestCommon.commonVerifyKiePMMLMapValues(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLMapValues) PMMLModelTestUtils.getRandomMapValues(org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomMapValues) MapValues(org.dmg.pmml.MapValues) KiePMMLMapValues(org.kie.pmml.commons.model.expressions.KiePMMLMapValues) InstanceFactoriesTestCommon.commonVerifyKiePMMLMapValues(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLMapValues) Test(org.junit.Test)

Aggregations

KiePMMLMapValues (org.kie.pmml.commons.model.expressions.KiePMMLMapValues)2 MapValues (org.dmg.pmml.MapValues)1 Test (org.junit.Test)1 DATA_TYPE (org.kie.pmml.api.enums.DATA_TYPE)1 PMMLModelTestUtils.getRandomMapValues (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomMapValues)1 InstanceFactoriesTestCommon.commonVerifyKiePMMLMapValues (org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLMapValues)1