Package org.openrdf.repository.contextaware

Examples of org.openrdf.repository.contextaware.ContextAwareConnection.prepareTupleQuery()


            Assert.assertTrue(con.hasStatement(subject,predicate1, object11));
            Assert.assertFalse(con.hasStatement(subject, predicate2, object21));

            String queryStr = "SELECT ?X ?Z WHERE { ?X ?Y ?Z }";

            TupleQuery query = con.prepareTupleQuery(QueryLanguage.SPARQL, queryStr);
            List<BindingSet> result = Iterations.asList(query.evaluate());
            Assert.assertEquals(2,result.size());
            con.commit();
        } finally {
            con.close();
View Full Code Here


            Assert.assertTrue(con.hasStatement(subject,predicate1, object11));
            Assert.assertFalse(con.hasStatement(subject, predicate2, object21));

            String queryStr = "SELECT ?X ?Z WHERE { ?X ?P ?Y . ?Y ?P ?Z }";

            TupleQuery query = con.prepareTupleQuery(QueryLanguage.SPARQL, queryStr);
            List<BindingSet> result = Iterations.asList(query.evaluate());
            Assert.assertEquals(1,result.size());
            con.commit();
        } finally {
            con.close();
View Full Code Here

            Assert.assertTrue(con.hasStatement(subject,predicate1, object11));
            Assert.assertFalse(con.hasStatement(subject, predicate2, object21));

            String queryStr1 = "SELECT * WHERE { GRAPH <"+context1.stringValue()+"> { ?X ?P ?Y } }";

            TupleQuery query1 = con.prepareTupleQuery(QueryLanguage.SPARQL, queryStr1);

            // workaround for a bug in sesame
            DatasetImpl ds = new DatasetImpl();
            ds.addDefaultGraph(context1);
            ds.addNamedGraph(context1);
View Full Code Here

            List<BindingSet> result1 = Iterations.asList(query1.evaluate());
            Assert.assertEquals(2, result1.size());

            String queryStr2 = "SELECT * WHERE { GRAPH <"+context2.stringValue()+"> { ?X ?P ?Y  } }";

            TupleQuery query2 = con.prepareTupleQuery(QueryLanguage.SPARQL, queryStr2);
            List<BindingSet> result2 = Iterations.asList(query2.evaluate());
            Assert.assertEquals(0, result2.size());

            con.commit();
        } finally {
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.