/** * @param restTemplate REST Template for making HTTP calls */ public PathwayCommons2Client(RestTemplate restTemplate) { this(restTemplate, new SimpleIOHandler()); }
@Override public void run() { model[0] = (new SimpleIOHandler()).convertFromOWL(stream); } });
private static String toOwl(BioPAXElement bpe) { StringWriter writer = new StringWriter(); try { SimpleIOHandler simpleExporter = new SimpleIOHandler(BioPAXLevel.L3); simpleExporter.writeObject(writer, bpe); } catch (Exception e) { log.error("Failed printing '" + bpe.getRDFId() + "' to OWL", e); } return writer.toString(); }
private String convertToOWL(Model model) { ByteArrayOutputStream out = new ByteArrayOutputStream(); (new SimpleIOHandler(model.getLevel())).convertToOWL(model, out); return out.toString(); }
/** * Gets the OWL (RDF/XML) representation * of the BioPAX element. * * @param bpe * @return */ public static String toOwl(final BioPAXElement bpe) { final StringWriter writer = new StringWriter(); final SimpleIOHandler simpleExporter = new SimpleIOHandler(BioPAXLevel.L3); ClassLoaderHack.runWithHack(new Runnable() { @Override public void run() { try { simpleExporter.writeObject(writer, bpe); } catch (Exception e) { log.error("Failed printing '" + bpe.getRDFId() + "' to OWL", e); } } }, com.ctc.wstx.stax.WstxInputFactory.class); return writer.toString(); }
public static void main(String[] args) throws FileNotFoundException { SimpleIOHandler reader = new SimpleIOHandler(); Model model = reader.convertFromOWL(new FileInputStream( "/home/ozgun/Projects/biopax-pattern/All-Data.owl")); new ChemicalNameNormalizer(model); }
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]; }
/** * This is to refresh 'modelSerialized' property: * generates BioPAX OWL from current model. */ public void updateModelSerialized() { Model model = getModel(); if (model != null) { try { // export to OWL ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); (new SimpleIOHandler(model.getLevel())).convertToOWL(model, outputStream); this.modelSerialized = outputStream.toString("UTF-8"); } catch (IOException e) { throw new BiopaxValidatorException( "Failed to export modified model!", e); } } }
/** * 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(); }
int graphPerSeed) throws FileNotFoundException SimpleIOHandler h = new SimpleIOHandler(); Model model = h.convertFromOWL(new FileInputStream(inFile));
prgBar.setIndeterminate(true); prgBar.setStringPainted(false); SimpleIOHandler io = new SimpleIOHandler(); Model model;
public static void main(String[] args) throws IOException { // A blacklist file is available at http://www.pathwaycommons.org/pc2/downloads/blacklist.txt // This is for avoiding ubiquitous small molecules like ATP Blacklist black = new Blacklist("blacklist.txt"); DeltaFeatureExtractor dfe = new DeltaFeatureExtractor(); dfe.setBlacklist(black); SimpleIOHandler io = new SimpleIOHandler(); // The large model file is available at // http://www.pathwaycommons.org/pc2/downloads/Pathway%20Commons.5.Detailed_Process_Data.BIOPAX.owl.gz Model model = io.convertFromOWL(new FileInputStream( "Pathway Commons.5.Detailed_Process_Data.BIOPAX.owl")); dfe.mineAndCollect(model); dfe.writeResults("DeltaFeatures.txt"); }
ByteArrayOutputStream os = new ByteArrayOutputStream(); InputStream is = new ByteArrayInputStream(biopaxData.getBytes()); SimpleIOHandler io = new SimpleIOHandler(); io.mergeDuplicates(true); Model model = io.convertFromOWL(is);
(new SimpleIOHandler()).convertToOWL(model, outputStream);
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); }
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); }
BioPAXIOHandler handler = new SimpleIOHandler(); Model model = handler.convertFromOWL(inputStream);