private static Model convertFromOwl(final InputStream stream) { final Model[] model = new Model[1]; final SimpleIOHandler handler = new SimpleIOHandler(); handler.mergeDuplicates(true); // a workaround (illegal) BioPAX data having duplicated rdf:ID... ClassLoaderHack.runWithHack(new Runnable() { @Override public void run() { // try { model[0] = handler.convertFromOWL(stream); // } catch (Throwable e) { // log.warn("Import failed: " + e); // } } }, com.ctc.wstx.stax.WstxInputFactory.class); return model[0]; }
/** * Constructor */ public Normalizer() { biopaxReader = new SimpleIOHandler(BioPAXLevel.L3); biopaxReader.mergeDuplicates(true); copier = new ShallowCopy(BioPAXLevel.L3); options = new NormalizerOptions(); // with default settings subs = new HashMap<BioPAXElement, BioPAXElement>(); subsModel = biopaxReader.getFactory().createModel(); }
InputStream is = new ByteArrayInputStream(biopaxData.getBytes()); SimpleIOHandler io = new SimpleIOHandler(); io.mergeDuplicates(true); Model model = io.convertFromOWL(is); if (model.getLevel() != BioPAXLevel.L3) {
public void importModel(Validation validation, InputStream inputStream) { // add the parser SimpleIOHandler simpleReader = new SimpleIOHandler(); simpleReader.mergeDuplicates(true); associate(inputStream, validation); associate(simpleReader, validation); /* * build a model and associate it with the validation (for post-validation later on); * during this, many errors/warnings may be caught and reported via AOP ;)) */ Model model = simpleReader.convertFromOWL(inputStream); if(model == null) throw new ValidatorException( "Failed importing a BioPAX model!"); associate(model, validation); }
public void importModel(Validation validation, InputStream inputStream) { // add the parser SimpleIOHandler simpleReader = new SimpleIOHandler(); simpleReader.mergeDuplicates(true); associate(inputStream, validation); associate(simpleReader, validation); /* * build a model and associate it with the validation (for post-validation later on); * during this, many errors/warnings may be caught and reported via AOP ;)) */ Model model = simpleReader.convertFromOWL(inputStream); if(model == null) throw new BiopaxValidatorException( "Failed importing a BioPAX model!"); associate(model, validation); }