.append("> WHERE { <").append(subject).append("> <")
.append(predicate).append("> ?").append(variable).append(" . }");
Query q = QueryParser.getInstance().parse(queryStrBuf.toString());
Assert.assertTrue(SelectQuery.class.isAssignableFrom(q.getClass()));
SelectQuery selectQuery = (SelectQuery) q;
Assert.assertTrue(selectQuery.getSelection().get(0)
.equals(new Variable(variable)));
Assert.assertTrue(selectQuery.getDataSet().getDefaultGraphs().toArray()[0]
.equals(new UriRef(defaultGraph)));
GraphPattern gp = (GraphPattern) selectQuery.getQueryPattern()
.getGraphPatterns().toArray()[0];
Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
BasicGraphPattern bgp = (BasicGraphPattern) gp;
Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();