Package com.hp.hpl.jena.sparql.graph

Examples of com.hp.hpl.jena.sparql.graph.GraphUnionRead


     * is the dynamic dataset from the collection of graphs from the dataset
     * that go to make up the default graph (union) and named graphs. 
     */
    public static DatasetGraph dynamicDataset(Collection<Node> defaultGraphs, Collection<Node> namedGraphs, DatasetGraph dsg, boolean defaultUnionGraph)
    {
        Graph dft = new GraphUnionRead(dsg, defaultGraphs) ;
        DatasetGraph dsg2 = new DatasetGraphMap(dft) ;
       
        // The named graphs.
        for ( Node gn : namedGraphs )
        {
            Graph g = GraphOps.getGraph(dsg, gn) ;
            if ( g != null )
                dsg2.addGraph(gn, g) ;
        }
       
        if ( dsg.getContext() != null )
            dsg2.getContext().putAll(dsg.getContext()) ;

        if ( defaultUnionGraph && defaultGraphs.size() == 0 )
        {
            // Create a union graph - there were no defaultGraphs explicitly named.
            Graph unionGraph = new GraphUnionRead(dsg, namedGraphs) ;
            dsg2.setDefaultGraph(unionGraph) ;
        }

        // read-only, <urn:x-arq:DefaultGraph> and <urn:x-arq:UnionGraph> processing.
        dsg2 = new DynamicDatasetGraph(dsg2) ;
View Full Code Here


    private static Node gn9 = SSE.parseNode("<http://example/g9>") ;
   
    @Test public void gr_union_01()
    {
        List<Node> gnodes = list(gn1, gn2) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(3, x) ;
    }
View Full Code Here

    }
   
    @Test public void gr_union_02()
    {
        List<Node> gnodes = list(gn1, gn2) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        Node s = NodeFactory.createURI("http://example/s") ;
        long x = Iter.count(g.find(s, null, null)) ;
        assertEquals(3, x) ;
    }
View Full Code Here

    }

    @Test public void gr_union_03()
    {
        List<Node> gnodes = list(gn1, gn2, gn9) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        Node o = NodeFactory.createLiteral("g2") ;
        long x = Iter.count(g.find(null, null, o)) ;
        assertEquals(1, x) ;
    }
View Full Code Here

    }
   
    @Test public void gr_union_04()
    {
        List<Node> gnodes = list(gn9) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(0, x) ;
    }
View Full Code Here

    }

    @Test public void gr_union_05()
    {
        List<Node> gnodes = list() ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(0, x) ;
    }
View Full Code Here

    }
   
    @Test public void gr_union_06()
    {
        List<Node> gnodes = list(gn1, gn1) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(2, x) ;
    }
View Full Code Here

     * is the dynamic dataset from the collection of graphs from the dataset
     * that go to make up the default graph (union) and named graphs. 
     */
    public static DatasetGraph dynamicDataset(Collection<Node> defaultGraphs, Collection<Node> namedGraphs, DatasetGraph dsg, boolean defaultUnionGraph)
    {
        Graph dft = new GraphUnionRead(dsg, defaultGraphs) ;
        DatasetGraph dsg2 = new DatasetGraphMap(dft) ;
       
        // The named graphs.
        for ( Node gn : namedGraphs )
        {
            Graph g = GraphOps.getGraph(dsg, gn) ;
            if ( g != null )
                dsg2.addGraph(gn, g) ;
        }
       
        if ( dsg.getContext() != null )
            dsg2.getContext().putAll(dsg.getContext()) ;

        if ( defaultUnionGraph && defaultGraphs.size() == 0 )
        {
            // Create a union graph - there were no defaultGraphs explicitly named.
            Graph unionGraph = new GraphUnionRead(dsg, namedGraphs) ;
            dsg2.setDefaultGraph(unionGraph) ;
        }

        // read-only, <urn:x-arq:DefaultGraph> and <urn:x-arq:UnionGraph> processing.
        dsg2 = new DynamicDatasetGraph(dsg2) ;
View Full Code Here

    private static Node gn9 = SSE.parseNode("<http://example/g9>") ;
   
    @Test public void gr_union_01()
    {
        List<Node> gnodes = list(gn1, gn2) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(3, x) ;
    }
View Full Code Here

    }
   
    @Test public void gr_union_02()
    {
        List<Node> gnodes = list(gn1, gn2) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        Node s = NodeFactory.createURI("http://example/s") ;
        long x = Iter.count(g.find(s, null, null)) ;
        assertEquals(3, x) ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.graph.GraphUnionRead

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.