Search in sources :

Example 1 with CustomSpaceImpl

use of org.apache.stanbol.ontologymanager.multiplexer.clerezza.impl.CustomSpaceImpl in project stanbol by apache.

the class ClerezzaCollectorFactory method createCustomOntologySpace.

@Override
public OntologySpace createCustomOntologySpace(String scopeId, OntologyInputSource<?>... customSources) {
    OntologySpace s = new CustomSpaceImpl(scopeId, namespace, ontologyProvider);
    configureSpace(s, scopeId, customSources);
    return s;
}
Also used : CustomSpaceImpl(org.apache.stanbol.ontologymanager.multiplexer.clerezza.impl.CustomSpaceImpl) OntologySpace(org.apache.stanbol.ontologymanager.servicesapi.scope.OntologySpace)

Example 2 with CustomSpaceImpl

use of org.apache.stanbol.ontologymanager.multiplexer.clerezza.impl.CustomSpaceImpl 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);
}
Also used : InputStream(java.io.InputStream) URL(java.net.URL) CustomSpaceImpl(org.apache.stanbol.ontologymanager.multiplexer.clerezza.impl.CustomSpaceImpl) OWLOntologyLoaderListener(org.semanticweb.owlapi.model.OWLOntologyLoaderListener) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) OntologySpace(org.apache.stanbol.ontologymanager.servicesapi.scope.OntologySpace) PhonyIRIMapper(org.apache.stanbol.commons.owl.PhonyIRIMapper) ParentPathInputSource(org.apache.stanbol.ontologymanager.sources.owlapi.ParentPathInputSource) OWLOntologyManager(org.semanticweb.owlapi.model.OWLOntologyManager) File(java.io.File) Test(org.junit.Test)

Aggregations

CustomSpaceImpl (org.apache.stanbol.ontologymanager.multiplexer.clerezza.impl.CustomSpaceImpl)2 OntologySpace (org.apache.stanbol.ontologymanager.servicesapi.scope.OntologySpace)2 File (java.io.File)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 PhonyIRIMapper (org.apache.stanbol.commons.owl.PhonyIRIMapper)1 ParentPathInputSource (org.apache.stanbol.ontologymanager.sources.owlapi.ParentPathInputSource)1 Test (org.junit.Test)1 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)1 OWLOntologyLoaderListener (org.semanticweb.owlapi.model.OWLOntologyLoaderListener)1 OWLOntologyManager (org.semanticweb.owlapi.model.OWLOntologyManager)1