Package org.apache.stanbol.ontologymanager.sources.owlapi

Examples of org.apache.stanbol.ontologymanager.sources.owlapi.RootOntologySource


        if (rootSrc instanceof OntologySpaceSource) {
            OntologySpace spc = ((OntologySpaceSource) rootSrc).asOntologySpace();
            for (OWLOntology o : subtrees)
                try {
                    spc.addOntology(new RootOntologySource(o));
                } catch (UnmodifiableOntologyCollectorException e) {
                    logger.error("Cannot add ontology {} to unmodifiable space {}", o, spc);
                    continue;
                }
        }
View Full Code Here


    public static OWLOntology buildImportTree(Set<OWLOntology> subtrees) throws OWLOntologyCreationException {
        return buildImportTree(subtrees, OWLManager.createOWLOntologyManager());
    }

    public static OWLOntology buildImportTree(Set<OWLOntology> subtrees, OWLOntologyManager mgr) throws OWLOntologyCreationException {
        return buildImportTree(new RootOntologySource(mgr.createOntology()), subtrees, mgr);
    }
View Full Code Here

     * deletion of that ontology in general.
     */
    @Test
    public void storedOntologyOutlivesScope() throws Exception {
        String ephemeralScopeId = "CaducousScope";
        OntologyInputSource<OWLOntology> ois = new RootOntologySource(IRI.create(getClass().getResource(
            "/ontologies/nonexistentcharacters.owl")));
        OWLOntologyID ontologyId = ois.getRootOntology().getOntologyID();
        Scope scope = onManager.createOntologyScope(ephemeralScopeId);
        // Initially, the ontology is not there
        assertFalse(ontologyProvider.hasOntology(ontologyId));
        // Once added, the ontology is there
        scope.getCustomSpace().addOntology(ois);
View Full Code Here

    private static OntologyInputSource<?> src1 = null, src2 = null;

    @BeforeClass
    public static void setup() throws Exception {
        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(null);
        src1 = new RootOntologySource(mgr.createOntology(baseIri));
        src2 = new RootOntologySource(mgr.createOntology(baseIri2));
        reset();
    }
View Full Code Here

    }

    // @Test
    public void zombieSessionClearsContents() throws Exception {
        Session ses = sessionManager.createSession();
        ses.addOntology(new RootOntologySource((IRI
                .create(getClass().getResource("/ontologies/mockfoaf.rdf")))));
        OWLOntologyID expectedKey = new OWLOntologyID(IRI.create("http://xmlns.com/foaf/0.1/"));
        assertTrue(ontologyProvider.hasOntology(expectedKey));
        sessionManager.destroySession(ses.getID());
    }
View Full Code Here

                if (cores.length > 0) {
                    OntologySpace corespc = sc.getCoreSpace();
                    corespc.tearDown();
                    for (int i = 0; i < cores.length; i++)
                        try {
                            corespc.addOntology(new RootOntologySource(IRI.create(cores[i])));
                        } catch (Exception ex) {
                            log.warn("Failed to import ontology " + cores[i], ex);
                            continue;
                        }
                }

                sc.setUp();
                registerScope(sc);
                sc.getCustomSpace().tearDown();
                for (String locationIri : customs) {
                    try {
                        OntologyInputSource<?> src = new RootOntologySource(IRI.create(locationIri));
                        sc.getCustomSpace().addOntology(src);
                        log.debug("Added ontology from location {}", locationIri);
                    } catch (UnmodifiableOntologyCollectorException e) {
                        log.error("An error occurred while trying to add the ontology from location: "
                                  + locationIri, e);
View Full Code Here

     *            used.
     * @throws OWLOntologyCreationException
     */
    public LibrarySource(IRI libraryID, RegistryManager registryManager, OWLOntologyManager ontologyManager) throws RegistryContentException,
                                                                                                            OWLOntologyCreationException {
        this(libraryID, registryManager, ontologyManager, new RootOntologySource(OWLManager
                .createOWLOntologyManager().createOntology(libraryID
                /* IRI.create(libraryID.toString().replace("#", "%23")) */)));
    }
View Full Code Here

        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(onManager
                .getOfflineConfiguration().getOntologySourceLocations().toArray(new IRI[0]));
        OWLDataFactory df = mgr.getOWLDataFactory();

        ont = mgr.createOntology(baseIri);
        inMemorySrc = new RootOntologySource(ont);
        // Let's state that Linus is a human being
        OWLClass cHuman = df.getOWLClass(IRI.create(baseIri + "/" + Constants.humanBeing));
        OWLIndividual iLinus = df.getOWLNamedIndividual(IRI.create(baseIri + "/" + Constants.linus));
        linusIsHuman = df.getOWLClassAssertionAxiom(cHuman, iLinus);
        mgr.applyChange(new AddAxiom(ont, linusIsHuman));

        ont2 = mgr.createOntology(baseIri2);
        minorSrc = new RootOntologySource(ont2);

        dropSrc = getLocalSource("/ontologies/droppedcharacters.owl", mgr);
        nonexSrc = getLocalSource("/ontologies/nonexistentcharacters.owl", mgr);
        minorSrc = new RootOntologySource(ont2);

    }
View Full Code Here

                } catch (Exception e) {
                    failed.add(url);
                }
                try {
                    // TODO replace with a Clerezza equivalent
                    ontologySpace.addOntology(new RootOntologySource(physicalIRI, sharedManager));
                    success.add(url);
                } catch (OWLOntologyCreationException e) {
                    log.error("Failed to load ontology from physical location " + physicalIRI
                              + " Continuing with next...", e);
                    failed.add(url);
View Full Code Here

            Origin<?> origin = ontologySource.getOrigin();
            Object ref = origin.getReference();
            log.debug("Origin wraps a {}", ref.getClass().getCanonicalName());
            if (ref instanceof IRI) try {
                log.debug("Deferring addition to physical IRI {} (if available).", ref);
                key = addOntology(new RootOntologySource((IRI) ref));
            } catch (OWLOntologyCreationException e) {
                throw new RuntimeException(e);
            }
            else if (ref instanceof UriRef) {
                log.debug("Deferring addition to stored Clerezza graph {} (if available).", ref);
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.sources.owlapi.RootOntologySource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.