Package com.hp.hpl.jena.graph

Examples of com.hp.hpl.jena.graph.Graph.find()


        Graph g = getAndRegister( L );
        if (g.getCapabilities().iteratorRemoveAllowed())
        {
            Triple toRemove = triple( "remove this triple" );
            g.add( toRemove );
            ExtendedIterator<Triple> rtr = g.find( toRemove );
            assertTrue( "ensure a(t least) one triple", rtr.hasNext() );
            rtr.next(); rtr.remove(); rtr.close();
            L.assertHas( new Object[] { "add", g, toRemove, "delete", g, toRemove} );
        }
    }
View Full Code Here


    public void failingTestDoubleRemoveAll() {
        final Graph g = getGraph();
        if (g.getCapabilities().iteratorRemoveAllowed() ) {
            graphAdd(g,"c S d; e:ff GGG hhhh; _i J 27; Ell Em 'en'"  );
            Iterator<Triple> it = new TrackingTripleIterator(g.find(Triple.ANY)){
                @Override
                public void remove() {
                    super.remove(); // removes current
                    g.delete(current); // no-op.
                }
View Full Code Here

                Graph g = graphWith( graph );
                int n = Integer.parseInt( size );
                Node literal = NodeCreateUtils.create( search );
            //
                assertEquals( "graph has wrong size", n, g.size() );
                Set<Node> got = g.find( Node.ANY, Node.ANY, literal ).mapWith( getObject ).toSet();
                assertEquals( nodeSet( results ), got );
                }
            };
        }
   
View Full Code Here

        Node P = NodeCreateUtils.create( "P" );
        g.add( Triple.create( SB, P, ab ) );
        g.add( Triple.create( SS, P, as ) );
        g.add( Triple.create( SI, P, ai ) );
        g.add( Triple.create( SL, P, al ) );
        assertEquals( 4, iteratorToSet( g.find( Node.ANY, P, NodeCreateUtils.create( "42" ) ) ).size() );
        }
    }
View Full Code Here

       
        //Set bindings = new HashSet() ;    // Use a Set if you want unique results.
        List<Binding> bindings = new ArrayList<Binding>() ;   // Use a list if you want counting results.
        Graph graph = execCxt.getActiveGraph() ;
       
        ExtendedIterator<Triple>iter = graph.find(Node.ANY, Node.ANY, Node.ANY) ;
        for ( ; iter.hasNext() ; )
        {
            Triple t = iter.next() ;
            slot(bindings, input, t.getSubject(),   subjVar, nodeLocalname) ;
            slot(bindings, input, t.getPredicate(), subjVar, nodeLocalname) ;
View Full Code Here

    // This test only works if the underlying dataset implements Quad.unionGraph  
    @Test public void graphDSG_view_union_1()
    {
        Graph g = makeNamedGraph(baseDSG, Quad.unionGraph) ;
        Iterator<Triple> iter = g.find(null,null,null) ;
        while(iter.hasNext())
            iter.next() ;
        assertEquals(2, g.size()) ;
    }
View Full Code Here

   
    @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) ;
    }
   
    @Test public void gr_union_02()
    {
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) ;
    }

    @Test public void gr_union_03()
    {
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) ;
    }
   
    @Test public void gr_union_04()
    {
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) ;
    }

    @Test public void gr_union_05()
    {
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.