public PSIModReader(InputStream inputStream) throws IOException { OBOFormatParser oboReader = new OBOFormatParser(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); try { oboDoc = oboReader.parse(bufferedReader); oboDoc.getInstanceFrames(); } finally { bufferedReader.close(); } }
public PSIModReader(InputStream inputStream) throws IOException { OBOFormatParser oboReader = new OBOFormatParser(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); try { oboDoc = oboReader.parse(bufferedReader); oboDoc.getInstanceFrames(); } finally { bufferedReader.close(); } }
/** * @param reader the reader * @param writer the writer * @throws IOException Signals that an I/O exception has occurred. * @throws OBOFormatParserException the oBO format parser exception */ public void write(Reader reader, Writer writer) throws IOException { OBOFormatParser parser = new OBOFormatParser(); OBODoc doc = parser.parse(reader); write(doc, writer); }
/** * @param reader the reader * @param writer the writer * @throws IOException Signals that an I/O exception has occurred. * @throws OBOFormatParserException the oBO format parser exception */ public void write(Reader reader, Writer writer) throws IOException { OBOFormatParser parser = new OBOFormatParser(); OBODoc doc = parser.parse(reader); write(doc, writer); }
/** * @param reader the reader * @param writer the writer * @throws IOException Signals that an I/O exception has occurred. * @throws OBOFormatParserException the oBO format parser exception */ public void write(Reader reader, Writer writer) throws IOException { OBOFormatParser parser = new OBOFormatParser(); OBODoc doc = parser.parse(reader); write(doc, writer); }
public void write(BufferedReader reader, BufferedWriter writer) throws IOException, OBOFormatParserException { OBOFormatParser parser = new OBOFormatParser(); OBODoc doc = parser.parse(reader); write(doc, writer); }
/** * @param reader the reader * @param writer the writer * @throws IOException Signals that an I/O exception has occurred. * @throws OBOFormatParserException the oBO format parser exception */ public void write(Reader reader, Writer writer) throws IOException { OBOFormatParser parser = new OBOFormatParser(); OBODoc doc = parser.parse(reader); write(doc, writer); }
public static void main(String[] args) throws Exception { OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc1 = p.parse(args[0]); OBODoc obodoc2 = p.parse(args[1]); OBODocDiffer dd = new OBODocDiffer(); List<Diff> diffs = dd.getDiffs(obodoc1, obodoc2); for (Diff d : diffs) { System.out.println(d); } }
private static OBODoc loadObo(OBORunnerConfiguration config, String iri, Logger logger) throws IOException, OBOFormatDanglingReferenceException, OBOFormatParserException { OBOFormatParser p = new OBOFormatParser(); p.setFollowImports(config.followImports.getValue()); OBODoc obodoc = p.parseURL(iri); List<String> errors= p.checkDanglingReferences(obodoc); for(String error: errors){ logger.log(Level.SEVERE, "Dangling Reference Error: " + error); } if(!config.allowDangling.getValue() && !errors.isEmpty()){ throw new OBOFormatDanglingReferenceException("Dangling references are found during conversion"); } String defaultOntology = config.defaultOnt.getValue(); if(defaultOntology == null || defaultOntology.trim().length()==0){ defaultOntology = iri; } if (defaultOntology != null) { obodoc.addDefaultOntologyHeader(defaultOntology); } return obodoc; }
/** * Static convenience method which: (1) creates an Obo2Owl bridge object (2) * parses an obo file from a URL (3) converts that to an OWL ontology (4) * saves the OWL ontology as RDF/XML. * * @param iri the iri * @param outFile the out file * @param manager manager to use * @throws IOException Signals that an I/O exception has occurred. * @throws OWLOntologyCreationException the oWL ontology creation exception * @throws OWLOntologyStorageException the oWL ontology storage exception * @throws OBOFormatParserException the oBO format parser exception */ public static void convertURL(String iri, String outFile, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(manager); OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(new URL(iri)); OWLOntology ontology = bridge.convert(obodoc); IRI outputStream = IRI.create(outFile); OWLDocumentFormat format = new RDFXMLDocumentFormat(); LOG.info("saving to {} fmt={}", outputStream, format); manager.saveOntology(ontology, format, outputStream); }
/** * Creates an OBOFormatParser object to parse a file and then converts it * using the convert method. * * @param oboFile the obo file * @return ontology * @throws OWLOntologyCreationException the oWL ontology creation exception */ public OWLOntology convert(String oboFile) throws OWLOntologyCreationException { try { OBOFormatParser p = new OBOFormatParser(); return convert(p.parse(oboFile)); } catch (IOException ex) { throw new OWLOntologyCreationException( "Error Occured while parsing OBO '" + oboFile + '\'', ex); } catch (OBOFormatParserException ex) { throw new OWLOntologyCreationException( "Syntax error occured while parsing OBO '" + oboFile + '\'', ex); } }
/** * Creates an OBOFormatParser object to parse a file and then converts it * using the convert method. * * @param oboFile the obo file * @return ontology * @throws OWLOntologyCreationException the oWL ontology creation exception */ public OWLOntology convert(String oboFile) throws OWLOntologyCreationException { try { OBOFormatParser p = new OBOFormatParser(); return convert(p.parse(oboFile)); } catch (IOException ex) { throw new OWLOntologyCreationException( "Error Occured while parsing OBO '" + oboFile + '\'', ex); } catch (OBOFormatParserException ex) { throw new OWLOntologyCreationException( "Syntax error occured while parsing OBO '" + oboFile + '\'', ex); } }
/** * Creates an OBOFormatParser object to parse a file and then converts it using * the convert method * * @param oboFile * @return ontology * @throws OWLOntologyCreationException */ public OWLOntology convert(String oboFile) throws OWLOntologyCreationException { try{ OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(oboFile); return convert(obodoc); }catch(IOException ex){ throw new OWLOntologyCreationException("Error Occured while parsing OBO '" + oboFile + "'", ex); } catch (OBOFormatParserException ex) { throw new OWLOntologyCreationException("Syntax error occured while parsing OBO '" + oboFile + "'", ex); } }
/** * Creates an OBOFormatParser object to parse a file and then converts it * using the convert method. * * @param oboFile the obo file * @return ontology * @throws OWLOntologyCreationException the oWL ontology creation exception */ public OWLOntology convert(String oboFile) throws OWLOntologyCreationException { try { OBOFormatParser p = new OBOFormatParser(); return convert(p.parse(oboFile)); } catch (IOException ex) { throw new OWLOntologyCreationException( "Error Occured while parsing OBO '" + oboFile + '\'', ex); } catch (OBOFormatParserException ex) { throw new OWLOntologyCreationException( "Syntax error occured while parsing OBO '" + oboFile + '\'', ex); } }
/** * Creates an OBOFormatParser object to parse a file and then converts it * using the convert method. * * @param oboFile the obo file * @return ontology * @throws OWLOntologyCreationException the oWL ontology creation exception */ public OWLOntology convert(String oboFile) throws OWLOntologyCreationException { try { OBOFormatParser p = new OBOFormatParser(); return convert(p.parse(oboFile)); } catch (IOException ex) { throw new OWLOntologyCreationException( "Error Occured while parsing OBO '" + oboFile + '\'', ex); } catch (OBOFormatParserException ex) { throw new OWLOntologyCreationException( "Syntax error occured while parsing OBO '" + oboFile + '\'', ex); } }
/** * See {@link #convertURL(String iri, String outFile)} * * @param iri * @param outFile * @param defaultOnt -- e.g. "go". If the obo file contains no "ontology:" header tag, this is added * @throws IOException * @throws OWLOntologyCreationException * @throws OWLOntologyStorageException * @throws OBOFormatParserException */ public static void convertURL(String iri, String outFile, String defaultOnt, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException, OBOFormatParserException { Obo2Owl bridge = new Obo2Owl(manager); OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(new URL(iri)); obodoc.addDefaultOntologyHeader(defaultOnt); OWLOntology ontology = bridge.convert(obodoc); IRI outputStream = IRI.create(outFile); OWLOntologyFormat format = new RDFXMLOntologyFormat(); LOG.log(Level.WARNING, "saving to " + outputStream + " fmt=" + format); manager.saveOntology(ontology, format, outputStream); }
@Override public OWLDocumentFormat parse(OWLOntologyDocumentSource source, OWLOntology in, OWLOntologyLoaderConfiguration config) { try { OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(wrapInputAsReader(source, config)); // create a translator object and feed it the OBO Document OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(in.getOWLOntologyManager()); bridge.convert(obodoc, in); return new OBODocumentFormat(); } catch (OBOFormatParserException | IOException | OWLOntologyInputSourceException e) { throw new OWLParserException(e); } }
@Override public OWLDocumentFormat parse(OWLOntologyDocumentSource source, OWLOntology in, OWLOntologyLoaderConfiguration config) { try { OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(wrapInputAsReader(source, config)); // create a translator object and feed it the OBO Document OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(in.getOWLOntologyManager()); bridge.convert(obodoc, in); return new OBODocumentFormat(); } catch (OBOFormatParserException | IOException | OWLOntologyInputSourceException e) { throw new OWLParserException(e); } }
@Override public OWLDocumentFormat parse(OWLOntologyDocumentSource source, OWLOntology in, OWLOntologyLoaderConfiguration config) { try { OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(wrapInputAsReader(source, config)); // create a translator object and feed it the OBO Document OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(in.getOWLOntologyManager()); bridge.convert(obodoc, in); return new OBODocumentFormat(); } catch (OBOFormatParserException | IOException | OWLOntologyInputSourceException e) { throw new OWLParserException(e); } }
@Override public OWLDocumentFormat parse(OWLOntologyDocumentSource source, OWLOntology in, OWLOntologyLoaderConfiguration config) { try { OBOFormatParser p = new OBOFormatParser(); OBODoc obodoc = p.parse(wrapInputAsReader(source, config)); // create a translator object and feed it the OBO Document OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(in.getOWLOntologyManager()); bridge.convert(obodoc, in); return new OBODocumentFormat(); } catch (OBOFormatParserException | IOException | OWLOntologyInputSourceException e) { throw new OWLParserException(e); } }