Examples of RootOntologySource


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

    }

    // @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

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

                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

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

     *            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

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

        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

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

                } 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

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

            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

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

    @Consumes(value = MediaType.TEXT_PLAIN)
    public Response manageOntology(String iri, @Context HttpHeaders headers) {
        ResponseBuilder rb;
        if (scope == null) rb = Response.status(NOT_FOUND);
        else try {
            OWLOntologyID key = scope.getCustomSpace().addOntology(new RootOntologySource(IRI.create(iri)));
            URI created = getCreatedResource(OntologyUtils.encode(key));
            rb = Response.created(created);
        } catch (UnmodifiableOntologyCollectorException e) {
            throw new WebApplicationException(e, FORBIDDEN);
        } catch (OWLOntologyCreationException e) {
View Full Code Here

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

            }

        // Then ontology sources
        if (coreOntologies != null) for (String ont : coreOntologies)
            if (ont != null && !ont.isEmpty()) try {
                srcs.add(new RootOntologySource(IRI.create(ont)));
            } catch (OWLOntologyCreationException e2) {
                // If this fails too, throw a bad request.
                throw new WebApplicationException(e2, BAD_REQUEST);
            }

        // Now the creation.
        try {
            // Expand core sources
            List<OntologyInputSource<?>> expanded = new ArrayList<OntologyInputSource<?>>();
            for (OntologyInputSource<?> coreSrc : srcs)
                if (coreSrc != null) {
                    if (coreSrc instanceof SetInputSource) {
                        for (Object o : ((SetInputSource<?>) coreSrc).getOntologies()) {
                            OntologyInputSource<?> src = null;
                            if (o instanceof OWLOntology) src = new RootOntologySource((OWLOntology) o);
                            else if (o instanceof TripleCollection) src = new GraphSource(
                                    (TripleCollection) o);
                            if (src != null) expanded.add(src);
                        }
                    } else expanded.add(coreSrc); // Must be denoting a single ontology
View Full Code Here

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

    @POST
    @Consumes(value = MediaType.TEXT_PLAIN)
    public Response manageOntology(String iri, @Context HttpHeaders headers) {
        if (session == null) return Response.status(NOT_FOUND).build();
        try {
            session.addOntology(new RootOntologySource(IRI.create(iri)));
        } catch (UnmodifiableOntologyCollectorException e) {
            throw new WebApplicationException(e, FORBIDDEN);
        } catch (OWLOntologyCreationException e) {
            throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
        }
View Full Code Here

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

                        continue;
                    }
                log.debug("No more formats to try.");
            } else if (location != null) {
                try {
                    src = new RootOntologySource(location);
                } catch (Exception e) {
                    log.error("Failed to load ontology from " + location, e);
                    throw new WebApplicationException(e, BAD_REQUEST);
                }
            } else if (library != null) { // This comes last, since it will most likely have a value.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.