use of org.drools.beliefs.bayes.assembler.BayesNetworkAssemblerError in project drools by kiegroup.
the class XmlBifParser method loadBif.
public static Bif loadBif(Resource resource, KnowledgeBuilderErrors errors) {
InputStream is = null;
try {
is = resource.getInputStream();
} catch (IOException e) {
errors.add(new ParserError(resource, "Exception opening Stream:\n" + e.toString(), 0, 0));
return null;
}
try {
String encoding = resource instanceof InternalResource ? ((InternalResource) resource).getEncoding() : null;
XStream xstream = encoding != null ? createTrustingXStream(new DomDriver(encoding)) : createTrustingXStream();
initXStream(xstream);
Bif bif = (Bif) xstream.fromXML(is);
return bif;
} catch (Exception e) {
errors.add(new BayesNetworkAssemblerError(resource, "Unable to parse opening Stream:\n" + e.toString()));
return null;
}
}
Aggregations