* exception
*/
public void shouldLoad() throws Exception {
// Get hold of an ontology manager
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology pizzaOntology = loadPizza(manager);
// Remove the ontology so that we can load a local copy.
manager.removeOntology(pizzaOntology);
OWLOntology localPizza = loadPizza(manager);
// We can always obtain the location where an ontology was loaded from;
// for this test, though, since the ontology was loaded from a string,
// this does not return a file
IRI documentIRI = manager.getOntologyDocumentIRI(localPizza);
// Remove the ontology again so we can reload it later
manager.removeOntology(pizzaOntology);
// In cases where a local copy of one of more ontologies is used, an
// ontology IRI mapper can be used to provide a redirection mechanism.
// This means that ontologies can be loaded as if they were located on
// the web. In this example, we simply redirect the loading from
// http://owl.cs.manchester.ac.uk/co-ode-files/ontologies/pizza.owl to
// our local copy
// above.
// iri and file here are used as examples
IRI iri = IRI
.create("http://owl.cs.manchester.ac.uk/co-ode-files/ontologies/pizza.owl");
File file = folder.newFile();
manager.getIRIMappers().add(new SimpleIRIMapper(iri, IRI.create(file)));
// Load the ontology as if we were loading it from the web (from its
// ontology IRI)
IRI pizzaOntologyIRI = IRI
.create("http://owl.cs.manchester.ac.uk/co-ode-files/ontologies/pizza.owl");
OWLOntology redirectedPizza = manager.loadOntology(pizzaOntologyIRI);
IRI pizza = manager.getOntologyDocumentIRI(redirectedPizza);
// Note that when imports are loaded an ontology manager will be
// searched for mappings
}