Search in sources :

Example 1 with LoadingFinishedEvent

use of org.semanticweb.owlapi.model.OWLOntologyLoaderListener.LoadingFinishedEvent in project stanbol by apache.

the class AbstractOWLApiReasoningService method createOWLOntologyManager.

/**
 * An OWLOntologyManager to be used to place a target ontology. We don't want to use the manager bound to
 * the input ontologies for that, we don't want to interfere with it.
 *
 * Other {@see OWLApiReasoningService}s may want to change this.
 *
 * @return
 */
protected OWLOntologyManager createOWLOntologyManager() {
    log.info("createOWLOntologyManager()");
    // We want a single instance here
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    log.info("manager: {}", manager);
    // FIXME Which is the other way of doing this?
    // Maybe -> OWLOntologyManagerProperties();
    manager.setSilentMissingImportsHandling(true);
    // Listening for missing imports
    manager.addMissingImportListener(new MissingImportListener() {

        @Override
        public void importMissing(MissingImportEvent arg0) {
            log.warn("Missing import {} ", arg0.getImportedOntologyURI());
        }
    });
    manager.addOntologyLoaderListener(new OWLOntologyLoaderListener() {

        @Override
        public void finishedLoadingOntology(LoadingFinishedEvent arg0) {
            log.info("Finished loading {} (imported: {})", arg0.getOntologyID(), arg0.isImported());
        }

        @Override
        public void startedLoadingOntology(LoadingStartedEvent arg0) {
            log.info("Started loading {} (imported: {}) ...", arg0.getOntologyID(), arg0.isImported());
            log.info(" ... from {}", arg0.getDocumentIRI().toString());
        }
    });
    return manager;
}
Also used : MissingImportListener(org.semanticweb.owlapi.model.MissingImportListener) OWLOntologyLoaderListener(org.semanticweb.owlapi.model.OWLOntologyLoaderListener) MissingImportEvent(org.semanticweb.owlapi.model.MissingImportEvent) LoadingFinishedEvent(org.semanticweb.owlapi.model.OWLOntologyLoaderListener.LoadingFinishedEvent) LoadingStartedEvent(org.semanticweb.owlapi.model.OWLOntologyLoaderListener.LoadingStartedEvent) OWLOntologyManager(org.semanticweb.owlapi.model.OWLOntologyManager)

Aggregations

MissingImportEvent (org.semanticweb.owlapi.model.MissingImportEvent)1 MissingImportListener (org.semanticweb.owlapi.model.MissingImportListener)1 OWLOntologyLoaderListener (org.semanticweb.owlapi.model.OWLOntologyLoaderListener)1 LoadingFinishedEvent (org.semanticweb.owlapi.model.OWLOntologyLoaderListener.LoadingFinishedEvent)1 LoadingStartedEvent (org.semanticweb.owlapi.model.OWLOntologyLoaderListener.LoadingStartedEvent)1 OWLOntologyManager (org.semanticweb.owlapi.model.OWLOntologyManager)1