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();
}
}