use of org.kie.pmml.commons.model.KiePMMLModel in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromCommonDataAndTransformationDictionaryAndModelWithSourcesWithProvider.
@Test
public void getFromCommonDataAndTransformationDictionaryAndModelWithSourcesWithProvider() {
pmml = getPMMLWithRandomTestModel();
final CommonCompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, pmml.getModels().get(0), new HasClassLoaderMock());
final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModelWithSources(compilationDTO);
assertNotNull(retrieved);
}
use of org.kie.pmml.commons.model.KiePMMLModel in project drools by kiegroup.
the class PMMLRuntimeFactoryInternal method getNestedKiePackages.
protected static List<KiePackage> getNestedKiePackages(final InternalKnowledgePackage kiePackage, final KieBase kieBase) {
PMMLPackage pmmlPackage = (PMMLPackage) kiePackage.getResourceTypePackages().get(ResourceType.PMML);
final Map<String, KiePMMLModel> kiePmmlModels = pmmlPackage.getAllModels();
final List<KiePackage> toReturn = new ArrayList<>();
populateNestedKiePackageList(kiePmmlModels.values(), toReturn, kieBase);
return toReturn;
}
use of org.kie.pmml.commons.model.KiePMMLModel in project drools by kiegroup.
the class PMMLAssemblerService method addResourceAfterRules.
@Override
public void addResourceAfterRules(Object kbuilder, Resource resource, ResourceType type, ResourceConfiguration configuration) {
logger.warn("invoked legacy addResourceAfterRules (no control on the order of the assembler compilation): {}", resource.getSourcePath());
KnowledgeBuilderImpl kbuilderImpl = (KnowledgeBuilderImpl) kbuilder;
if (isjPMMLAvailableToClassLoader(kbuilderImpl.getRootClassLoader())) {
return;
}
if (isBuildFromMaven()) {
addModels(kbuilderImpl, getKiePMMLModelsFromResourceWithSources(kbuilderImpl, resource));
} else {
List<KiePMMLModel> toAdd = getKiePMMLModelsLoadedFromResource(kbuilderImpl, resource);
if (toAdd.isEmpty()) {
toAdd = getKiePMMLModelsCompiledFromResource(kbuilderImpl, resource);
}
addModels(kbuilderImpl, toAdd);
}
}
use of org.kie.pmml.commons.model.KiePMMLModel in project drools by kiegroup.
the class PMMLAssemblerService method addResourcesAfterRules.
@Override
public void addResourcesAfterRules(Object kbuilder, Collection<ResourceWithConfiguration> resources, ResourceType type) {
KnowledgeBuilderImpl kbuilderImpl = (KnowledgeBuilderImpl) kbuilder;
if (isjPMMLAvailableToClassLoader(kbuilderImpl.getRootClassLoader())) {
return;
}
if (isBuildFromMaven()) {
addModels(kbuilderImpl, getKiePMMLModelsFromResourcesWithConfigurationsWithSources(kbuilderImpl, resources));
} else {
List<KiePMMLModel> toAdd = getKiePMMLModelsLoadedFromResourcesWithConfigurations(kbuilderImpl, resources);
if (toAdd.isEmpty()) {
toAdd = getKiePMMLModelsCompiledFromResourcesWithConfigurations(kbuilderImpl, resources);
}
addModels(kbuilderImpl, toAdd);
}
}
use of org.kie.pmml.commons.model.KiePMMLModel in project drools by kiegroup.
the class PMMLCompilerServiceTest method addPMMLRuleMapperHasSourcesMap.
@Test
public void addPMMLRuleMapperHasSourcesMap() {
KiePMMLTestingModelWithSources kiePmmlModel = new KiePMMLTestingModelWithSources("TEST", "kmodulePackageName", Collections.emptyMap());
assertTrue(kiePmmlModel.getSourcesMap().isEmpty());
final List<String> generatedRuleMappers = IntStream.range(0, 3).mapToObj(i -> "apackage.Rule_" + i).collect(Collectors.toList());
PMMLCompilerService.addPMMLRuleMapper(kiePmmlModel, generatedRuleMappers, "source_path");
assertTrue(kiePmmlModel.getSourcesMap().isEmpty());
}
Aggregations