Package com.hp.hpl.jena.graph

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


    public void testFind()
    {
        Graph g = getGraph();
        graphAdd( g, "S P O" );
        assertDiffer( new HashSet<Triple>(), g.find( Node.ANY, Node.ANY, Node.ANY ).toSet() );
        assertDiffer( new HashSet<Triple>(), g.find( Triple.ANY ).toSet() );
    }

    protected boolean canBeEmpty( Graph g )
    { return g.isEmpty(); }
View Full Code Here


    public void testFind()
    {
        Graph g = getGraph();
        graphAdd( g, "S P O" );
        assertDiffer( new HashSet<Triple>(), g.find( Node.ANY, Node.ANY, Node.ANY ).toSet() );
        assertDiffer( new HashSet<Triple>(), g.find( Triple.ANY ).toSet() );
    }

    protected boolean canBeEmpty( Graph g )
    { return g.isEmpty(); }
View Full Code Here

        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

       
        // An optimization to prevent concatenating the two find() operations together every time through the outer loop
        boolean onFirstIterator = true;

        // It's possible there are triples (old wossname old) that are in triples twice. It doesn't matter.
        ExtendedIterator<Triple> it = rawGraph.find(resAsNode, Node.ANY, Node.ANY) ;
        try
        {
            if ( !it.hasNext() )
            {
                it.close() ;
View Full Code Here

        {
            if ( !it.hasNext() )
            {
                it.close() ;
                onFirstIterator = false ;
                it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
            }
            changeOccured = it.hasNext() ;

            while ( it.hasNext() )
            {
View Full Code Here

                   
                    rawGraph.add(Triple.create(newS, t.getPredicate(), newO));
                }
                triples.clear();

                it = onFirstIterator ? rawGraph.find(resAsNode, Node.ANY, Node.ANY) : rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
                if ( onFirstIterator && !it.hasNext() )
                {
                    it.close() ;
                    onFirstIterator = false ;
                    it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
View Full Code Here

                   
                    rawGraph.add(Triple.create(newS, t.getPredicate(), newO));
                }
                triples.clear();

                it = onFirstIterator ? rawGraph.find(resAsNode, Node.ANY, Node.ANY) : rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
                if ( onFirstIterator && !it.hasNext() )
                {
                    it.close() ;
                    onFirstIterator = false ;
                    it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
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.