/** * 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); } }
/** * 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); } }
/** * 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); }
/** * 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); }
/** * 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); } }
/** * See. * * @param iri the iri * @param outFile the out file * @param defaultOnt -- e.g. "go". If the obo file contains no "ontology:" header tag, this is * added * @param manager the manager to be used * @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 {@link #convertURL(String * iri, String outFile, OWLOntologyManager manager)} */ public static void convertURL(String iri, String outFile, String defaultOnt, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(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); OWLDocumentFormat format = new RDFXMLDocumentFormat(); LOG.info("saving to {} fmt={}", outputStream, format); manager.saveOntology(ontology, format, outputStream); }
/** * See. * * @param iri the iri * @param outFile the out file * @param defaultOnt -- e.g. "go". If the obo file contains no "ontology:" header tag, this is * added * @param manager the manager to be used * @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 {@link #convertURL(String * iri, String outFile, OWLOntologyManager manager)} */ public static void convertURL(String iri, String outFile, String defaultOnt, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(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); OWLDocumentFormat format = new RDFXMLDocumentFormat(); LOG.info("saving to {} fmt={}", outputStream, format); manager.saveOntology(ontology, format, outputStream); }
/** * See. * * @param iri the iri * @param outFile the out file * @param defaultOnt -- e.g. "go". If the obo file contains no "ontology:" header tag, this is * added * @param manager the manager to be used * @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 {@link #convertURL(String * iri, String outFile, OWLOntologyManager manager)} */ public static void convertURL(String iri, String outFile, String defaultOnt, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(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); OWLDocumentFormat format = new RDFXMLDocumentFormat(); LOG.info("saving to {} fmt={}", outputStream, format); manager.saveOntology(ontology, format, outputStream); }
/** * See. * * @param iri the iri * @param outFile the out file * @param defaultOnt -- e.g. "go". If the obo file contains no "ontology:" header tag, this is * added * @param manager the manager to be used * @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 {@link #convertURL(String * iri, String outFile, OWLOntologyManager manager)} */ public static void convertURL(String iri, String outFile, String defaultOnt, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(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); OWLDocumentFormat format = new RDFXMLDocumentFormat(); LOG.info("saving to {} fmt={}", outputStream, 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); } }