Examples of GraphContentInputSource


Examples of org.apache.stanbol.ontologymanager.ontonet.api.io.GraphContentInputSource

        OntologyProvider<TcProvider> provider = new ClerezzaOntologyProvider(tcManager,
                new OfflineConfigurationImpl(new Hashtable<String,Object>()), parser);

        InputStream content = TestClerezzaInputSources.class
                .getResourceAsStream("/ontologies/droppedcharacters.owl");
        OntologyInputSource<?,TcProvider> src = new GraphContentInputSource(content, SupportedFormat.RDF_XML,
            new SimpleTcProvider(), parser);
       
        log.info("After input source creation, TcManager has {} graphs. ", tcManager.listTripleCollections()
                .size());
        for (UriRef name : tcManager.listTripleCollections())
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.ontonet.api.io.GraphContentInputSource

                       RDF_JSON})
    public Response manageOntology(InputStream content, @Context HttpHeaders headers) {
        long before = System.currentTimeMillis();
        if (session == null) return Response.status(NOT_FOUND).build();
        try {
            session.addOntology(new GraphContentInputSource(content)
            // new OntologyContentInputSource(content)
            );
        } catch (UnmodifiableOntologyCollectorException e) {
            throw new WebApplicationException(e, FORBIDDEN);
        }
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.ontonet.api.io.GraphContentInputSource

             * For the time being, REST services operate in-memory (i.e. no TcProvider is supplied to the
             * input source). This means that only the final processed graph is stored.
             *
             * TODO : we might find a reason to change that in the future.
             */
            new GraphContentInputSource(content, headers.getMediaType().toString())
            // new OntologyContentInputSource(content)
                    );
        } catch (UnmodifiableOntologyCollectorException e) {
            throw new WebApplicationException(e, FORBIDDEN);
        }
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

    @Test
    public void testCustomAboxCoreTbox() throws Exception {
        String path = "/ontologies/imports-disconnected";

        InputStream content = getClass().getResourceAsStream(path + "/abox.owl");
        OntologyInputSource<?> coreSrc = new GraphContentInputSource(content, SupportedFormat.TURTLE);
        Scope scope = onManager.createOntologyScope("imports-disconnected", coreSrc);
        assertNotNull(scope);

        content = getClass().getResourceAsStream(path + "/tbox.owl");
        OntologyInputSource<?> custSrc = new GraphContentInputSource(content, SupportedFormat.TURTLE);
        scope.getCustomSpace().addOntology(custSrc);

        Graph g = scope.export(Graph.class, true);

        // for (Triple t : g)
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

    }

    @Test
    public void scopePreservesManagedOntologies() throws Exception {
        String id = "preserve";
        Scope scope = onManager.createOntologyScope(id, new GraphContentInputSource(getClass()
                .getResourceAsStream("/ontologies/mockfoaf.rdf")));
        scope.getCustomSpace().addOntology(
            new GraphContentInputSource(getClass().getResourceAsStream(
                "/ontologies/nonexistentcharacters.owl")));
        Collection<OWLOntologyID> cores = scope.getCoreSpace().listManagedOntologies();
        Collection<OWLOntologyID> customs = scope.getCustomSpace().listManagedOntologies();
        // Simulate Stanbol going down.
        log.info("Stanbol going down...");
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

    @Test
    public void sessionPreservesManagedOntologies() throws Exception {
        String id = "12345"; // The kind of thing an idiot would have on his luggage.
        Session session = sessionManager.createSession(id);
        // Anonymous ontologies must preserve their public keys!
        session.addOntology(new GraphContentInputSource(getClass().getResourceAsStream(
            "/ontologies/nameless_ontology.owl")));
        // Same for named ontologies...
        session.addOntology(new GraphContentInputSource(getClass().getResourceAsStream(
            "/ontologies/nonexistentcharacters.owl")));
        // ... and versioned ontologies too.
        session.addOntology(new GraphContentInputSource(getClass().getResourceAsStream(
            "/ontologies/versiontest_v1.owl")));
        session.addOntology(new GraphContentInputSource(getClass().getResourceAsStream(
            "/ontologies/versiontest_v2.owl")));
        Collection<OWLOntologyID> managed = session.listManagedOntologies();
        assertEquals(4, managed.size());

        // Simulate Stanbol going down.
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

        // Ensure the metadata graph is there.
        TripleCollection meta = ontologyProvider.getMetaGraph(TripleCollection.class);
        assertNotNull(meta);

        String scopeId = "updateTest";
        Scope scope = onm.createOntologyScope(scopeId, new GraphContentInputSource(getClass()
                .getResourceAsStream("/ontologies/test1.owl")));

        UriRef collector = new UriRef(_NS_STANBOL_INTERNAL + OntologySpace.shortName + "/"
                                      + scope.getCoreSpace().getID());
        UriRef test1id = new UriRef("http://stanbol.apache.org/ontologies/test1.owl"); // Has no versionIRI
        // Be strict: the whole property pair must be there.
        UriRef predicate = MANAGES_URIREF;
        assertTrue(meta.contains(new TripleImpl(collector, predicate, test1id)));
        predicate = IS_MANAGED_BY_URIREF;
        assertTrue(meta.contains(new TripleImpl(test1id, predicate, collector)));

        scope.tearDown(); // To modify the core space.

        scope.getCoreSpace().addOntology(
            new GraphContentInputSource(getClass().getResourceAsStream("/ontologies/minorcharacters.owl")));
        UriRef minorId = new UriRef("http://stanbol.apache.org/ontologies/pcomics/minorcharacters.owl");
        predicate = MANAGES_URIREF;
        assertTrue(meta.contains(new TripleImpl(collector, predicate, minorId)));
        predicate = IS_MANAGED_BY_URIREF;
        assertTrue(meta.contains(new TripleImpl(minorId, predicate, collector)));

        scope.getCustomSpace().addOntology(
            new GraphContentInputSource(getClass().getResourceAsStream("/ontologies/test1.owl")));

        scope.getCustomSpace().addOntology(
            new GraphContentInputSource(getClass().getResourceAsStream("/ontologies/minorcharacters.owl")));
    }
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

             * For the time being, REST services operate in-memory (i.e. no TcProvider is supplied to the
             * input source). This means that only the final processed graph is stored.
             *
             * TODO : we might find a reason to change that in the future.
             */
            new GraphContentInputSource(content, mt.toString(), ontologyProvider.getStore()));
            if (key == null || key.isAnonymous()) {
                log.error("FAILED parse with media type {}.", mt);
                throw new WebApplicationException(INTERNAL_SERVER_ERROR);
            }
            // FIXME ugly but will have to do for the time being
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

                            }
                            break;
                        } else {
                            content = new FileInputStream(file);
                            log.debug("Recreated input stream for format {}", f);
                            src = new GraphContentInputSource(content, f, ontologyProvider.getStore());
                        }
                    } catch (UnsupportedFormatException e) {
                        log.warn(
                            "POST method failed for media type {}. This should not happen (should fail earlier)",
                            headers.getMediaType());
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.sources.clerezza.GraphContentInputSource

            log.debug("POST content claimed to be of type {}.", mt);
            OntologyInputSource<?> src;
            if (OWL_XML.equals(mt) || FUNCTIONAL_OWL.equals(mt) || MANCHESTER_OWL.equals(mt)) src = new OntologyContentInputSource(
                    content);
            else // content = new BufferedInputStream(content);
            src = new GraphContentInputSource(content, mt, ontologyProvider.getStore());
            log.debug("SUCCESS parse with media type {}.", mt);
            OWLOntologyID key = session.addOntology(src);
            if (key == null || key.isAnonymous()) {
                log.error("FAILED parse with media type {}.", mt);
                throw new WebApplicationException(INTERNAL_SERVER_ERROR);
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.