@Nullable protected IRI getIRIByIdentifier(String id) { OWLAPIObo2Owl b = new OWLAPIObo2Owl(manager); b.setObodoc(new OBODoc()); return b.oboIdToIRI(id); }
@Nullable protected IRI getIRIByIdentifier(String id) { OWLAPIObo2Owl b = new OWLAPIObo2Owl(manager); b.setObodoc(new OBODoc()); return b.oboIdToIRI(id); }
@Nullable protected IRI getIRIByIdentifier(String id) { OWLAPIObo2Owl b = new OWLAPIObo2Owl(manager); b.setObodoc(new OBODoc()); return b.oboIdToIRI(id); }
@Nullable protected IRI getIRIByIdentifier(String id) { OWLAPIObo2Owl b = new OWLAPIObo2Owl(manager); b.setObodoc(new OBODoc()); return b.oboIdToIRI(id); }
/** * 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); }
/** * 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); }
/** * 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 @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@Override @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@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 @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@Override @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@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); } }