Package org.apache.stanbol.ontologymanager.registry.io

Examples of org.apache.stanbol.ontologymanager.registry.io.LibrarySource


        regMgr = new RegistryManagerImpl(offline, new ClerezzaOntologyProvider(tcManager, offline, parser),
                regmanConf);
        assertNotNull(regMgr);

        // Now use this registry manager to instantiate an input source.
        OntologyInputSource<OWLOntology> src = new LibrarySource(Locations.LIBRARY_TEST1, regMgr,
                virginOntologyManager);
        OWLOntology o = src.getRootOntology();
        boolean hasImporting = false, hasImported = false;
        for (OWLImportsDeclaration ax : o.getImportsDeclarations()) {
            // Since we added a local IRI mapping, import statements might be using file: IRIs instead of
            // HTTP, in which case IRI equality would fail. So it is enough here to just check the filename.
            String tmpstr = ax.getIRI().toString();
View Full Code Here


                                                                                  + coreRegistries.size());
        // First thing, check registry sources.
        if (coreRegistries != null) for (String reg : coreRegistries)
            if (reg != null && !reg.isEmpty()) try {
                // Library IDs are sanitized differently
                srcs.add(new LibrarySource(URIUtils.desanitize(IRI.create(reg)), regMgr));
            } catch (Exception e1) {
                throw new WebApplicationException(e1, BAD_REQUEST);
                // Bad or not supplied core registry, try the ontology.
            }
View Full Code Here

                }
            } else if (library != null) { // This comes last, since it will most likely have a value.
                try {
                    long beforeLib = System.currentTimeMillis();
                    log.debug("Creating library source for {}", library);
                    src = new LibrarySource(library, regMgr);
                    log.debug("Library source created in {} ms.", System.currentTimeMillis() - beforeLib);
                } catch (Exception e) {
                    log.error("Failed to load ontology library " + library, e);
                    throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
                }
View Full Code Here

        regMgr = new RegistryManagerImpl(offline, new ClerezzaOntologyProvider(tcManager, offline, parser),
                regmanConf);
        assertNotNull(regMgr);

        // Now use this registry manager to instantiate an input source.
        OntologyInputSource<OWLOntology,?> src = new LibrarySource(Locations.LIBRARY_TEST1, regMgr,
                virginOntologyManager);
        OWLOntology o = src.getRootOntology();
        boolean hasImporting = false, hasImported = false;
        for (OWLImportsDeclaration ax : o.getImportsDeclarations()) {
            // Since we added a local IRI mapping, import statements might be using file: IRIs instead of
            // HTTP, in which case IRI equality would fail. So it is enough here to just check the filename.
            String tmpstr = ax.getIRI().toString();
View Full Code Here

        OntologyScope scope;
        OntologyInputSource<?,?> coreSrc = null, custSrc = null;

        // First thing, check the core source.
        if (coreRegistry != null && !coreRegistry.isEmpty()) try {
            coreSrc = new LibrarySource(IRI.create(coreRegistry.replace("%23", "#")), regMgr);
        } catch (Exception e1) {
            throw new WebApplicationException(e1, BAD_REQUEST);
            // Bad or not supplied core registry, try the ontology.
        }
        else if (coreOntology != null && !coreOntology.isEmpty()) try {
            coreSrc = new RootOntologyIRISource(IRI.create(coreOntology));
        } catch (Exception e2) {
            // If this fails too, throw a bad request.
            throw new WebApplicationException(e2, BAD_REQUEST);
        }

        // Don't bother if no custom was supplied at all...
        if (customRegistry != null && !customRegistry.isEmpty())
        // ...but if it was, be prepared to throw exceptions.
        try {
            coreSrc = new LibrarySource(IRI.create(customRegistry.replace("%23", "#")), regMgr);
        } catch (Exception e1) {
            throw new WebApplicationException(e1, BAD_REQUEST);
            // Bad or not supplied custom registry, try the ontology.
        }
        if (customOntology != null && !customOntology.isEmpty()) try {
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.registry.io.LibrarySource

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.