Package com.hp.hpl.jena.graph.query

Examples of com.hp.hpl.jena.graph.query.Query


    public TestQuery( String name )
        { super( name ); }

    public void testEmptyQueryPattern()
        {
        assertEquals( new ArrayList<Triple>(), new Query().getPattern() );
        }
View Full Code Here


        assertEquals( new ArrayList<Triple>(), new Query().getPattern() );
        }
   
    public void testIOneTriple()
        {
        Query q = new Query();
        Triple spo = triple( "S P O" );
        q.addMatch( spo );
        assertEquals( listOfOne( spo ), q.getPattern() );
        }
View Full Code Here

   
    public void testSeveralTriples()
        {
        Triple [] triples = tripleArray( "a P b; c Q ?d; ?e R '17'" );
        List<Triple> expected = new ArrayList<Triple>();
        Query q = new Query();
        for (int i = 0; i < triples.length; i += 1)
            {
            expected.add( triples[i] );
            q.addMatch( triples[i] );
            assertEquals( expected, q.getPattern() );           
            }
        }
View Full Code Here

        { return graphAdd( getGraph(), triples ); }
   
    public void testS()
        { 
        Graph g = geGraphSPO();
        Query q = new Query().addMatch( Query.X, RDF.Nodes.subject, Query.S );
        ExtendedIterator<Node> it = q.executeBindings( g, new Node[] {Query.X, Query.S} ).mapWith( select(1) );
        assertEquals( nodeSet( "S" ), it.toSet() );
        }
View Full Code Here

        assertEquals( nodeSet( "S" ), it.toSet() );
        }
    public void testP()
        { 
        Graph g = geGraphSPO();
        Query q = new Query().addMatch( Query.X, RDF.Nodes.predicate, Query.P );
        ExtendedIterator<Node> it = q.executeBindings( g, new Node[] {Query.X, Query.P} ).mapWith( select(1) );
        assertEquals( nodeSet( "P" ), it.toSet() );
        }
View Full Code Here

        }
   
    public void testO()
        { 
        Graph g = geGraphSPO();
        Query q = new Query().addMatch( Query.X, RDF.Nodes.object, Query.O );
        ExtendedIterator<Node> it = q.executeBindings( g, new Node[] {Query.X, Query.O} ).mapWith( select(1) );
        assertEquals( nodeSet( "O" ), it.toSet() );
        }
View Full Code Here

        a.addProperty(p, l1);
        assertTrue(model.getGraph().find(null, p.asNode(), l1.asNode()).hasNext());
        assertTrue(model.getGraph().find(null, p.asNode(), l2.asNode()).hasNext());
        assertTrue(model.getGraph().find(a.asNode(), p.asNode(), l2.asNode()).hasNext());
        assertTrue( model.getGraph().contains( a.asNode(), p.asNode(), l2.asNode() ) );
        Query q = new Query();
        q.addMatch(a.asNode(), p.asNode(), l2.asNode());
        Iterator<Domain> qi = model.getGraph().queryHandler().prepareBindings(q, new Node[] {}).executeBindings();
        assertTrue(qi.hasNext());
        // Similar tests at Model API level
        // Selector s1 = new SimpleSelector(a, p, l2);
        assertTrue(model.listStatements( a, p, l2 ).hasNext());
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.graph.query.Query

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.