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

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


            }

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

    @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

                        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

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.