@Test public void loadOntology() throws Exception { OwlApiUtils.loadOntology(manager, "src/test/resources/ontologies/pizza.owl"); }
public static OWLOntology loadOntology(OWLOntologyManager manager, String ontology) throws OWLOntologyCreationException { logger.info(String.format("Loading ontology with owlapi: %s", ontology)); String origThreadName = Thread.currentThread().getName(); Thread.currentThread().setName("read - " + ontology); OWLOntology ont; if (validator.isValid(ontology)) { ont = manager.loadOntology(IRI.create(ontology)); } else if (new File(ontology).exists()){ ont = manager.loadOntologyFromOntologyDocument(new File(ontology)); } else { try { ont = manager.loadOntologyFromOntologyDocument(Resources.getResource(ontology).openStream()); } catch (Exception e) { throw new OWLOntologyCreationException("Failed to find ontology: " + ontology); } } logger.info(String.format("Finished loading ontology with owlapi: %s", ontology)); Thread.currentThread().setName(origThreadName); return ont; }
OwlApiUtils { public static OWLOntology loadOntology(OWLOntologyManager manager, String ontology) throws OWLOntologyCreationException { logger.info(String.format("Loading ontology with owlapi: %s", ontology)); String origThreadName = Thread.currentThread().getName(); Thread.currentThread().setName("read - " + ontology); OWLOntology ont; if (validator.isValid(ontology)) { ont = manager.loadOntology(IRI.create(ontology)); } else if (new File(ontology).exists()){ ont = manager.loadOntologyFromOntologyDocument(new File(ontology)); } else { try { ont = manager.loadOntologyFromOntologyDocument(Resources.getResource(ontology).openStream()); } catch (Exception e) { throw new OWLOntologyCreationException("Failed to find ontology: " + ontology); } } logger.info(String.format("Finished loading ontology with owlapi: %s", ontology)); Thread.currentThread().setName(origThreadName); return ont; } }
OwlApiUtils { public static OWLOntology loadOntology(OWLOntologyManager manager, String ontology) throws OWLOntologyCreationException { logger.info(String.format("Loading ontology with owlapi: %s", ontology)); String origThreadName = Thread.currentThread().getName(); Thread.currentThread().setName("read - " + ontology); OWLOntology ont; if (validator.isValid(ontology)) { ont = manager.loadOntology(IRI.create(ontology)); } else if (new File(ontology).exists()){ ont = manager.loadOntologyFromOntologyDocument(new File(ontology)); } else { try { ont = manager.loadOntologyFromOntologyDocument(Resources.getResource(ontology).openStream()); } catch (Exception e) { throw new OWLOntologyCreationException("Failed to find ontology: " + ontology); } } logger.info(String.format("Finished loading ontology with owlapi: %s", ontology)); Thread.currentThread().setName(origThreadName); return ont; }  }
OwlApiUtils { public static OWLOntology loadOntology(OWLOntologyManager manager, String ontology) throws OWLOntologyCreationException { logger.info(String.format("Loading ontology with owlapi: %s", ontology)); String origThreadName = Thread.currentThread().getName(); Thread.currentThread().setName("read - " + ontology); OWLOntology ont; if (validator.isValid(ontology)) { ont = manager.loadOntology(IRI.create(ontology)); } else if (new File(ontology).exists()){ ont = manager.loadOntologyFromOntologyDocument(new File(ontology)); } else { try { ont = manager.loadOntologyFromOntologyDocument(Resources.getResource(ontology).openStream()); } catch (Exception e) { throw new OWLOntologyCreationException("Failed to find ontology: " + ontology); } } logger.info(String.format("Finished loading ontology with owlapi: %s", ontology)); Thread.currentThread().setName(origThreadName); return ont; }  static Optional<Object> getTypedLiteralValue(OWLLiteral literal); static String getIri(OWLDeclarationAxiom expression); static String getIri(OWLClassExpression expression); static String getIri(OWLObjectPropertyExpression property); static String getIri(OWLIndividual individual); static String getIri(OWLAnnotationProperty property); static String getIri(OWLOntology ontology); static OWLOntology loadOntology(OWLOntologyManager manager, String ontology); static synchronized void silenceOboParser(); }
OwlApiUtils { public static OWLOntology loadOntology(OWLOntologyManager manager, String ontology) throws OWLOntologyCreationException { logger.info(String.format("Loading ontology with owlapi: %s", ontology)); String origThreadName = Thread.currentThread().getName(); Thread.currentThread().setName("read - " + ontology); OWLOntology ont; if (validator.isValid(ontology)) { ont = manager.loadOntology(IRI.create(ontology)); } else if (new File(ontology).exists()){ ont = manager.loadOntologyFromOntologyDocument(new File(ontology)); } else { try { ont = manager.loadOntologyFromOntologyDocument(Resources.getResource(ontology).openStream()); } catch (Exception e) { throw new OWLOntologyCreationException("Failed to find ontology: " + ontology); } } logger.info(String.format("Finished loading ontology with owlapi: %s", ontology)); Thread.currentThread().setName(origThreadName); return ont; }  static Optional<Object> getTypedLiteralValue(OWLLiteral literal); static String getIri(OWLDeclarationAxiom expression); static String getIri(OWLClassExpression expression); static String getIri(OWLObjectPropertyExpression property); static String getIri(OWLIndividual individual); static String getIri(OWLAnnotationProperty property); static String getIri(OWLOntology ontology); static OWLOntology loadOntology(OWLOntologyManager manager, String ontology); static synchronized void silenceOboParser();  }