String queryString = "SELECT ?o WHERE { ?s ?p ?o}";
public void testGraphQuery()
throws Exception
{
RepositoryConnection stub = new RepositoryConnectionStub() {
@Override
public GraphQuery prepareGraphQuery(QueryLanguage ql, String query, String baseURI)
throws MalformedQueryException, StoreException
{
assertEquals(SPARQL, ql);
assertEquals(queryString, query);
return new GraphQueryStub() {
@Override
public void setDataset(Dataset dataset) {
Set<URI> contexts = Collections.singleton(context);
assertEquals(contexts, dataset.getDefaultGraphs());
super.setDataset(dataset);
}
};
}
};
Repository repo = stub.getRepository();
ContextAwareConnection con = new ContextAwareConnection(repo, stub);
con.setReadContexts(context);
con.setQueryLanguage(SERQL);
con.prepareGraphQuery(SPARQL, queryString, null);
}