queryStrBuf.append("SELECT ?").append(variable)
.append(" FROM <").append(defaultGraph)
.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)));