use of org.kie.api.io.ResourceType in project drools by kiegroup.
the class WeaverTest method testBayesPackageWeaving.
@Test
public void testBayesPackageWeaving() throws Exception {
KnowledgeBuilderImpl kbuilder = new KnowledgeBuilderImpl();
kbuilder.add(ResourceFactory.newClassPathResource("Garden.xmlbif", AssemblerTest.class), ResourceType.BAYES);
InternalKnowledgeBase kbase = getKnowledgeBase();
kbase.addPackages(kbuilder.getKnowledgePackages());
InternalKnowledgePackage kpkg = (InternalKnowledgePackage) kbase.getKiePackage("org.drools.beliefs.bayes.integration");
Map<ResourceType, ResourceTypePackage> map = kpkg.getResourceTypePackages();
BayesPackage existing = (BayesPackage) map.get(ResourceType.BAYES);
JunctionTree jtree = existing.getJunctionTree("Garden");
assertNotNull(jtree);
}
use of org.kie.api.io.ResourceType in project drools by kiegroup.
the class DMNRuntimeImpl method getModel.
@Override
public DMNModel getModel(String namespace, String modelName) {
InternalKnowledgePackage kpkg = (InternalKnowledgePackage) runtime.getKieBase().getKiePackage(namespace);
if (kpkg == null) {
return null;
}
Map<ResourceType, ResourceTypePackage> map = kpkg.getResourceTypePackages();
DMNPackage dmnpkg = (DMNPackage) map.get(ResourceType.DMN);
return dmnpkg != null ? dmnpkg.getModel(modelName) : null;
}
Aggregations