org.kie.pmml.commons.model.KiePMMLModelWithSources Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kie-pmml-commons Show documentation
Show all versions of kie-pmml-commons Show documentation
Common code for PMML module
/*
* Copyright 2021 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.pmml.commons.model;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.kie.pmml.api.exceptions.KiePMMLException;
import org.kie.pmml.api.models.MiningField;
import org.kie.pmml.api.models.OutputField;
import org.kie.pmml.api.models.TargetField;
import org.kie.pmml.api.runtime.PMMLRuntimeContext;
/**
* Interface used to identify a given HasSourcesMap
as container for KiePMMLModel' sources
*/
public class KiePMMLModelWithSources extends KiePMMLModel implements HasSourcesMap {
private static final long serialVersionUID = -7528313589316228283L;
private final String kmodulePackageName;
private final List miningFields;
private final List outputFields;
private final List targetFields;
private final Map sourcesMap;
private final boolean isInterpreted;
public KiePMMLModelWithSources(final String fileName,
final String modelName,
final String kmodulePackageName,
final List miningFields,
final List outputFields,
final List targetFields,
final Map sourcesMap,
final boolean isInterpreted) {
super(fileName, modelName, Collections.emptyList());
this.kmodulePackageName = kmodulePackageName;
this.miningFields = miningFields;
this.outputFields = outputFields;
this.targetFields = targetFields;
this.sourcesMap = sourcesMap;
this.isInterpreted = isInterpreted;
}
@Override
public Object evaluate(final Map requestData,
final PMMLRuntimeContext context) {
throw new KiePMMLException("KiePMMLModelWithSources is not meant to be used for actual evaluation");
}
@Override
public List getMiningFields() {
return miningFields;
}
@Override
public List getOutputFields() {
return outputFields;
}
public List getTargetFields() {
return targetFields;
}
@Override
public Map getSourcesMap() {
return Collections.unmodifiableMap(sourcesMap);
}
@Override
public void addSourceMap(String key, String value) {
sourcesMap.put(key, value);
}
@Override
public String getKModulePackageName() {
return kmodulePackageName;
}
@Override
public boolean isInterpreted() {
return isInterpreted;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy