Package org.apache.stanbol.ontologymanager.registry.api.model

Examples of org.apache.stanbol.ontologymanager.registry.api.model.Library


        // The ontology that imports the whole network is created in-memory, therefore it has no physical IRI
        // unless it is borrowed from the supplied parent.
        bindPhysicalOrigin(parentSrc != null ? parentSrc.getOrigin() : null);

        Library lib = registryManager.getLibrary(libraryID);
        log.debug("Got library {}, expected {}", lib, libraryID);
        // If the manager is set to
        if (lib != null) {
            Set<OWLOntology> subtrees = lib.getOntologies(OWLOntology.class);
            this.ontologies = subtrees;

            for (OWLOntology o : subtrees)
                log.debug("\tGot ontology {}", o);
View Full Code Here


            if (item instanceof Library && !((Library) item).isLoaded()) {
                // TODO: implement ontology request targets.
                if (CachingPolicy.CENTRALISED.equals(getCachingPolicy()) && this.cache != null) {
                    ((Library) item).loadOntologies(this.cache);
                } else if (CachingPolicy.DISTRIBUTED.equals(getCachingPolicy())) {
                    Library lib = (Library) item;
                    lib.loadOntologies(lib.getCache());
                } else {
                    log.error("Tried to load ontology resource {} using a null cache.", item);
                }
            }
        }
View Full Code Here

        if (CachingPolicy.CENTRALISED.equals(getCachingPolicy()) && this.cache != null) {
            if (requestTarget instanceof Library && !((Library) requestTarget).isLoaded()) ((Library) requestTarget)
                    .loadOntologies(this.cache);
        } else if (CachingPolicy.DISTRIBUTED.equals(getCachingPolicy())) {
            if (requestTarget instanceof Library && !((Library) requestTarget).isLoaded()) {
                Library lib = (Library) requestTarget;
                lib.loadOntologies(lib.getCache());
            }
        } else {
            log.error("Tried to load ontology resource {} using a null cache.", requestTarget);
        }
    }
View Full Code Here

            reg = regman.getRegistries().iterator().next();
        while (!reg.hasChildren());
        assertNotNull(reg);

        // There has to be at least one non-empty lib from the test ontologies.
        Library lib = null;
        RegistryItem[] children = reg.getChildren();
        for (int i = 0; i < children.length && lib == null; i++)
            if (children[i] instanceof Library) lib = (Library) (children[i]);
        assertNotNull(lib);

        // Touch the library. Also test that the listener system works.
        assertFalse(lib.getOntologies(OWLOntology.class).isEmpty());
    }
View Full Code Here

            reg = regman.getRegistries().iterator().next();
        while (!reg.hasChildren());
        assertNotNull(reg);

        // There has to be at least one non-empty library from the test registries...
        Library lib = null;
        RegistryItem[] children = reg.getChildren();
        for (int i = 0; i < children.length && lib == null; i++)
            if (children[i] instanceof Library) lib = (Library) (children[i]);
        assertNotNull(lib);
        // ...and its ontologies must already be loaded without having to request them.
        assertTrue(lib.isLoaded());
    }
View Full Code Here

        // We need a registry with at least 2 libraries to check that only one will be loaded.
        while (it.hasNext() && !reg.hasChildren() || reg.getChildren().length < 2);
        assertNotNull(reg);

        // There has to be at least one library with 2 children or more from the test registries...
        Library lib1 = null, lib2 = null;
        RegistryItem[] children = reg.getChildren();
        assertTrue(children.length >= 2);
        for (int i = 0; i < children.length - 1 && lib1 == null && lib2 == null; i++) {
            if (children[i] instanceof Library) lib1 = (Library) (children[i]);
            if (children[i + 1] instanceof Library) lib2 = (Library) (children[i + 1]);
        }
        assertFalse(lib1 == lib2);
        assertNotNull(lib1);
        // ...but its ontologies must not be loaded yet.
        assertFalse(lib1.isLoaded());
        assertFalse(lib2.isLoaded());

        // Touch the library. Also test that the listener system works.
        assertFalse(lib1.getOntologies(OWLOntology.class).isEmpty());
        assertTrue(lib1.isLoaded());
        assertFalse(lib2.isLoaded());
    }
View Full Code Here

        assertFalse(registries.isEmpty());
        assertEquals(1, registries.size());

        Registry reg = registries.iterator().next();
        assertTrue(reg.hasChildren());
        Library lib = null;
        // Look for test #Library2
        for (RegistryItem item : reg.getChildren()) {
            if (Locations.LIBRARY_TEST2.equals(item.getIRI())) {
                lib = (Library) item;
                break;
View Full Code Here

            reg = regman.getRegistries().iterator().next();
        while (!reg.hasChildren());
        assertNotNull(reg);

        // There has to be at least one non-empty lib from the test ontologies.
        Library lib = null;
        RegistryItem[] children = reg.getChildren();
        for (int i = 0; i < children.length && lib == null; i++)
            if (children[i] instanceof Library) lib = (Library) (children[i]);
        assertNotNull(lib);

        // Touch the library. Also test that the listener system works.
        assertFalse(lib.getOntologies(OWLOntology.class).isEmpty());
    }
View Full Code Here

            reg = regman.getRegistries().iterator().next();
        while (!reg.hasChildren());
        assertNotNull(reg);

        // There has to be at least one non-empty library from the test registries...
        Library lib = null;
        RegistryItem[] children = reg.getChildren();
        for (int i = 0; i < children.length && lib == null; i++)
            if (children[i] instanceof Library) lib = (Library) (children[i]);
        assertNotNull(lib);
        // ...and its ontologies must already be loaded without having to request them.
        assertTrue(lib.isLoaded());
    }
View Full Code Here

        // We need a registry with at least 2 libraries to check that only one will be loaded.
        while (it.hasNext() && !reg.hasChildren() || reg.getChildren().length < 2);
        assertNotNull(reg);

        // There has to be at least one library with 2 children or more from the test registries...
        Library lib1 = null, lib2 = null;
        RegistryItem[] children = reg.getChildren();
        assertTrue(children.length >= 2);
        for (int i = 0; i < children.length - 1 && lib1 == null && lib2 == null; i++) {
            if (children[i] instanceof Library) lib1 = (Library) (children[i]);
            if (children[i + 1] instanceof Library) lib2 = (Library) (children[i + 1]);
        }
        assertFalse(lib1 == lib2);
        assertNotNull(lib1);
        // ...but its ontologies must not be loaded yet.
        assertFalse(lib1.isLoaded());
        assertFalse(lib2.isLoaded());

        // Touch the library. Also test that the listener system works.
        assertFalse(lib1.getOntologies(OWLOntology.class).isEmpty());
        assertTrue(lib1.isLoaded());
        assertFalse(lib2.isLoaded());
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.registry.api.model.Library

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.