Package org.apache.stanbol.ontologymanager.servicesapi.scope

Examples of org.apache.stanbol.ontologymanager.servicesapi.scope.OntologySpace


    public static OWLOntology buildImportTree(OntologyInputSource<OWLOntology> rootSrc,
                                              Set<OWLOntology> subtrees,
                                              OWLOntologyManager mgr) {

        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


        if (!(arg0 instanceof OntologySpace)) return false;
        if (this == arg0) return true;
        log.warn(
            "{} only implements weak equality, i.e. managed ontologies are only checked by public key, not by content.",
            getClass());
        OntologySpace sp = (OntologySpace) arg0;
        if (!super.equals(arg0)) return false;
        if (!this.getConnectivityPolicy().equals(sp.getConnectivityPolicy())) return false;
        return true;
    }
View Full Code Here

        // s.setUp();
    }

    @Override
    public OntologySpace createCoreOntologySpace(String scopeId, OntologyInputSource<?>... coreSources) {
        OntologySpace s = new CoreSpaceImpl(scopeId, namespace, ontologyProvider);
        configureSpace(s, scopeId, coreSources);
        return s;
    }
View Full Code Here

        return s;
    }

    @Override
    public OntologySpace createCustomOntologySpace(String scopeId, OntologyInputSource<?>... customSources) {
        OntologySpace s = new CustomSpaceImpl(scopeId, namespace, ontologyProvider);
        configureSpace(s, scopeId, customSources);
        return s;
    }
View Full Code Here

        reset();
    }

    @Test
    public void testAddOntology() throws Exception {
        OntologySpace space = null;

        OWLOntologyID logicalId = OWLUtils.extractOntologyID(nonexSrc.getRootOntology());
        assertNotNull(logicalId);

        space = factory.createCustomOntologySpace(scopeId, dropSrc, minorSrc);
        space.addOntology(minorSrc);
        space.addOntology(nonexSrc);
        assertTrue(space.hasOntology(logicalId));

        logicalId = OWLUtils.extractOntologyID(dropSrc.getRootOntology());
        assertNotNull(logicalId);
        assertTrue(space.hasOntology(logicalId));
    }
View Full Code Here

        assertTrue(space.hasOntology(logicalId));
    }

    @Test
    public void testCoreLock() throws Exception {
        OntologySpace space = factory.createCoreOntologySpace(scopeId, inMemorySrc);
        space.setUp();
        try {
            space.addOntology(minorSrc);
            fail("Modification was permitted on locked ontology space.");
        } catch (UnmodifiableOntologyCollectorException e) {
            assertSame(space, e.getOntologyCollector());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testCreateSpace() throws Exception {
        OntologySpace space = factory.createCustomOntologySpace(scopeId, dropSrc);
        OWLOntologyID logicalId = null;
        Object o = dropSrc.getRootOntology();
        if (o instanceof TripleCollection) logicalId = OWLUtils.extractOntologyID((TripleCollection) o);
        else if (o instanceof OWLOntology) logicalId = OWLUtils.extractOntologyID((OWLOntology) o);
        assertNotNull(logicalId);
        assertTrue(space.hasOntology(logicalId));
    }
View Full Code Here

        assertTrue(space.hasOntology(logicalId));
    }

    @Test
    public void testCustomLock() throws Exception {
        OntologySpace space = factory.createCustomOntologySpace(scopeId, inMemorySrc);
        space.setUp();
        try {
            space.addOntology(minorSrc);
            fail("Modification was permitted on locked ontology space.");
        } catch (UnmodifiableOntologyCollectorException e) {
            assertSame(space, e.getOntologyCollector());
        }
    }
View Full Code Here

     * @throws Exception
     *             if an unexpected error occurs.
     */
    @Test
    public void testIdentifiers() throws Exception {
        OntologySpace shouldBeNull = null, shouldBeNotNull = null;

        /* First test space identifiers. */

        // Null identifier (invalid).
        try {
View Full Code Here

        assertNotNull(shouldBeNotNull);
    }

    @Test
    public void testRemoveCustomOntology() throws Exception {
        OntologySpace space = null;
        space = factory.createCustomOntologySpace(scopeId, dropSrc);
        OWLOntologyID dropId = OWLUtils.extractOntologyID(dropSrc.getRootOntology());
        OWLOntologyID nonexId = OWLUtils.extractOntologyID(nonexSrc.getRootOntology());

        space.addOntology(inMemorySrc);
        space.addOntology(nonexSrc);
        // The other remote ontologies may change base IRI...
        // baseIri is maincharacters
        assertTrue(space.hasOntology(baseIri));
        assertTrue(space.hasOntology(dropId));
        assertTrue(space.hasOntology(nonexId));
        space.removeOntology(dropId);
        assertFalse(space.hasOntology(dropId));
        space.removeOntology(nonexId);
        assertFalse(space.hasOntology(nonexId));
        // OntologyUtils.printOntology(space.getTopOntology(), System.err);

    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.servicesapi.scope.OntologySpace

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.