Package org.apache.stanbol.commons.indexedgraph

Examples of org.apache.stanbol.commons.indexedgraph.IndexedMGraph


        validateDereferencedEntities(ci.getMetadata());
    }

    private void validateDereferencedEntities(TripleCollection metadata) {
        Iterator<Triple> referenced = metadata.filter(null, ENHANCER_ENTITY_REFERENCE, null);
        MGraph expected = new IndexedMGraph();
        while(referenced.hasNext()){
            UriRef entity = (UriRef)referenced.next().getObject();
            Iterator<Triple> entityTriples = testData.filter(entity, null, null);
            while(entityTriples.hasNext()){
                expected.add(entityTriples.next());
            }
        }
        MGraph notExpected = new IndexedMGraph(testData);
        notExpected.removeAll(expected);
        Assert.assertTrue(metadata.containsAll(expected));
        Assert.assertTrue(Collections.disjoint(metadata, notExpected));
    }
View Full Code Here


     * @param headers the http headers of the request
     * @return the response
     */
    private Response executeLDPathQuery(Entityhub entityhub,FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
        QueryResultList<Representation> result;
        ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
        EntityhubBackend backend = new EntityhubBackend(entityhub);
        EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
        //copy the selected fields, because we might need to delete some during
        //the preparation phase
        Set<String> selectedFields = new HashSet<String>(query.getSelectedFields());
View Full Code Here

     * @param headers the http headers of the request
     * @return the response
     */
    private Response executeLDPathQuery(FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
        QueryResultList<Representation> result;
        ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
        SiteBackend backend = new SiteBackend(site,vf);
        EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
        //copy the selected fields, because we might need to delete some during
        //the preparation phase
        Set<String> selectedFields = new HashSet<String>(query.getSelectedFields());
View Full Code Here

     * @param headers the http headers of the request
     * @return the response
     */
    private Response executeLDPathQuery(Entityhub entityhub,FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
        QueryResultList<Representation> result;
        ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
        EntityhubBackend backend = new EntityhubBackend(entityhub);
        EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
        //copy the selected fields, because we might need to delete some during
        //the preparation phase
        Set<String> selectedFields = new HashSet<String>(query.getSelectedFields());
View Full Code Here

        String format = SupportedFormat.RDF_XML;
        InputStream in = dereference(uri, format);
        long queryEnd = System.currentTimeMillis();
        log.info("  > DereferenceTime: "+(queryEnd-start));
        if(in != null){
            MGraph rdfData = new IndexedMGraph(parser.parse(in, format,new UriRef(getBaseUri())));
            long parseEnd = System.currentTimeMillis();
            log.info("  > ParseTime: "+(parseEnd-queryEnd));
            return valueFactory.createRdfRepresentation(new UriRef(uri), rdfData);
        } else {
            return null;
View Full Code Here

            TripleCollection rdfData = parser.parse(in, SparqlSearcher.DEFAULT_RDF_CONTENT_TYPE,
                new UriRef(getBaseUri()));
            if(rdfData instanceof MGraph){
                graph = (MGraph) rdfData;
            } else {
                graph = new IndexedMGraph(rdfData);
            }
            long parseEnd = System.currentTimeMillis();
            log.info("  > ParseTime: "+(parseEnd-queryEnd));
            return new RdfQueryResultList(query, graph);
        } else {
View Full Code Here

            TripleCollection rdfData = parser.parse(in, SparqlSearcher.DEFAULT_RDF_CONTENT_TYPE,
                new UriRef(getBaseUri()));
            if(rdfData instanceof MGraph){
                graph = (MGraph) rdfData;
            } else {
                graph = new IndexedMGraph(rdfData);
            }
            long parseEnd = System.currentTimeMillis();
            log.info("  > ParseTime: "+(parseEnd-queryEnd));
            return new RdfQueryResultList(query, graph);
        } else {
View Full Code Here

            TripleCollection rdfData = parser.parse(in, DEFAULT_RDF_CONTENT_TYPE,
                new UriRef(getBaseUri()));
            if(rdfData instanceof MGraph){
                graph = (MGraph) rdfData;
            } else {
                graph = new IndexedMGraph(rdfData);
            }
            long parseEnd = System.currentTimeMillis();
            log.info("  > ParseTime: "+(parseEnd-queryEnd));
            return new RdfQueryResultList(query, graph);
        } else {
View Full Code Here

        String format = SupportedFormat.RDF_XML;
        InputStream in = dereference(uri, format);
        long queryEnd = System.currentTimeMillis();
        log.info("  > DereferenceTime: "+(queryEnd-start));
        if(in != null){
            MGraph rdfData = new IndexedMGraph(parser.parse(in, format,new UriRef(getBaseUri())));
            long parseEnd = System.currentTimeMillis();
            log.info("  > ParseTime: "+(parseEnd-queryEnd));
            return valueFactory.createRdfRepresentation(new UriRef(uri), rdfData);
        } else {
            return null;
View Full Code Here

     * have it as a field
     */
    static final LiteralFactory literalFactory = LiteralFactory.getInstance();

    static MGraph toRDF(Representation representation) {
        MGraph graph = new IndexedMGraph();
        addRDFTo(graph, representation);
        return graph;
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.commons.indexedgraph.IndexedMGraph

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.