use of org.semanticweb.owlapi.model.OWLOntologyLoaderListener in project stanbol by apache.
the class TestOntologyCollectors method spacePreservesImports.
@Test
public void spacePreservesImports() throws Exception {
InputStream content = getClass().getResourceAsStream("/ontologies/characters_all.owl");
URL url = getClass().getResource("/ontologies/characters_all.owl");
OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
mgr.addOntologyLoaderListener(new OWLOntologyLoaderListener() {
@Override
public void startedLoadingOntology(LoadingStartedEvent arg0) {
}
@Override
public void finishedLoadingOntology(LoadingFinishedEvent arg0) {
log.info((arg0.isSuccessful() ? "Loaded" : "Failed") + (arg0.isImported() ? " imported " : " ") + "ontology " + arg0.getDocumentIRI());
}
});
mgr.addIRIMapper(new PhonyIRIMapper(null));
File f = new File(url.toURI());
OntologyInputSource<OWLOntology> src = new ParentPathInputSource(f, mgr);
// OntologyInputSource<OWLOntology> src = new RootOntologyIRISource(IRI.create(f), mgr);
// OntologyInputSource<OWLOntology> src = new OntologyContentInputSource(content,mgr);
OWLOntology original = src.getRootOntology();
Assert.assertNotNull(original);
OntologySpace spc = new CustomSpaceImpl("Test", scopeNs, ontologyProvider);
spc.addOntology(src);
}
Aggregations