Search in sources :

Example 1 with PMMLRuntime

use of org.kie.pmml.api.runtime.PMMLRuntime in project drools by kiegroup.

the class DMNKiePMMLTrustyInvocationEvaluator method getPMMLRuntimeFromDMNRuntimeKBWrappingIKB.

private PMMLRuntime getPMMLRuntimeFromDMNRuntimeKBWrappingIKB(DMNRuntimeKBWrappingIKB runtimeKB) {
    String pmmlFilePath = documentResource.getSourcePath();
    String pmmlFileName = pmmlFilePath.contains("/") ? pmmlFilePath.substring(pmmlFilePath.lastIndexOf('/') + 1) : pmmlFilePath;
    PMMLRuntime toReturn = PMML_RUNTIME_FACTORY.getPMMLRuntimeFromFileNameModelNameAndKieBase(pmmlFileName, model, runtimeKB.getInternalKnowledgeBase());
    if (!toReturn.getPMMLModel(model).isPresent()) {
        File pmmlFile = getPMMLFile();
        toReturn = PMML_RUNTIME_FACTORY.getPMMLRuntimeFromFile(pmmlFile);
    }
    return toReturn;
}
Also used : PMMLRuntime(org.kie.pmml.api.runtime.PMMLRuntime) File(java.io.File)

Example 2 with PMMLRuntime

use of org.kie.pmml.api.runtime.PMMLRuntime in project drools by kiegroup.

the class DMNKiePMMLTrustyInvocationEvaluator method getPMML4Result.

@Override
protected PMML4Result getPMML4Result(DMNRuntimeEventManager eventManager, DMNResult dmnr) {
    PMMLContext pmmlContext = getPMMLPMMLContext(UUID.randomUUID().toString(), model, dmnr);
    PMMLRuntime pmmlRuntime = getPMMLRuntime(eventManager);
    return pmmlRuntime.evaluate(model, pmmlContext);
}
Also used : PMMLRuntime(org.kie.pmml.api.runtime.PMMLRuntime) PMMLContext(org.kie.pmml.api.runtime.PMMLContext)

Example 3 with PMMLRuntime

use of org.kie.pmml.api.runtime.PMMLRuntime in project drools by kiegroup.

the class PMMLRuntimeFactoryInternalTest method getPMMLRuntimeFromFileAndKnowledgeBuilder.

@Test
public void getPMMLRuntimeFromFileAndKnowledgeBuilder() {
    File pmmlFile = getFile("MiningModel_Mixed.pmml");
    KnowledgeBuilderImpl knowledgeBuilder = new KnowledgeBuilderImpl();
    PMMLRuntime retrieved = PMMLRuntimeFactoryInternal.getPMMLRuntime(pmmlFile, knowledgeBuilder);
    commonValidatePMMLRuntime(retrieved);
}
Also used : KnowledgeBuilderImpl(org.drools.compiler.builder.impl.KnowledgeBuilderImpl) PMMLRuntime(org.kie.pmml.api.runtime.PMMLRuntime) File(java.io.File) FileUtils.getFile(org.kie.test.util.filesystem.FileUtils.getFile) Test(org.junit.Test)

Example 4 with PMMLRuntime

use of org.kie.pmml.api.runtime.PMMLRuntime in project drools by kiegroup.

the class PMMLRuntimeFactoryInternalTest method getPMMLRuntimeFromFile.

@Test
public void getPMMLRuntimeFromFile() {
    File pmmlFile = getFile("MissingDataRegression.pmml");
    PMMLRuntime retrieved = PMMLRuntimeFactoryInternal.getPMMLRuntime(pmmlFile);
    commonValidatePMMLRuntime(retrieved);
}
Also used : PMMLRuntime(org.kie.pmml.api.runtime.PMMLRuntime) File(java.io.File) FileUtils.getFile(org.kie.test.util.filesystem.FileUtils.getFile) Test(org.junit.Test)

Example 5 with PMMLRuntime

use of org.kie.pmml.api.runtime.PMMLRuntime in project drools by kiegroup.

the class PMMLRuntimeFactoryInternalTest method testGetPMMLRuntimeFromFileAndReleaseId.

@Test
public void testGetPMMLRuntimeFromFileAndReleaseId() {
    File pmmlFile = getFile("MiningModel_Mixed.pmml");
    ReleaseId releaseId = new ReleaseIdImpl("org.dummy:dummy-artifact:1-0");
    PMMLRuntime retrieved = PMMLRuntimeFactoryInternal.getPMMLRuntime(pmmlFile, releaseId);
    commonValidatePMMLRuntime(retrieved);
}
Also used : ReleaseIdImpl(org.kie.util.maven.support.ReleaseIdImpl) ReleaseId(org.kie.api.builder.ReleaseId) PMMLRuntime(org.kie.pmml.api.runtime.PMMLRuntime) File(java.io.File) FileUtils.getFile(org.kie.test.util.filesystem.FileUtils.getFile) Test(org.junit.Test)

Aggregations

PMMLRuntime (org.kie.pmml.api.runtime.PMMLRuntime)8 File (java.io.File)4 Test (org.junit.Test)4 FileUtils.getFile (org.kie.test.util.filesystem.FileUtils.getFile)3 KieBase (org.kie.api.KieBase)2 KnowledgeBuilderImpl (org.drools.compiler.builder.impl.KnowledgeBuilderImpl)1 KieServices (org.kie.api.KieServices)1 ReleaseId (org.kie.api.builder.ReleaseId)1 PMML4Result (org.kie.api.pmml.PMML4Result)1 PMMLRequestData (org.kie.api.pmml.PMMLRequestData)1 KieContainer (org.kie.api.runtime.KieContainer)1 PMMLContext (org.kie.pmml.api.runtime.PMMLContext)1 KiePMMLPredicate (org.kie.pmml.commons.model.predicates.KiePMMLPredicate)1 PMMLContextTest (org.kie.pmml.commons.testingutility.PMMLContextTest)1 PMMLRuntimeInternal (org.kie.pmml.evaluator.api.executor.PMMLRuntimeInternal)1 ReleaseIdImpl (org.kie.util.maven.support.ReleaseIdImpl)1