UriRefOrVariable p = new UriRefOrVariable(
new UriRef("http://www.w3.org/2001/vcard-rdf/3.0#FN"));
ResourceOrVariable o = new ResourceOrVariable(new Variable("name"));
Set<TriplePattern> constructTriplePatterns = new HashSet<TriplePattern>();
constructTriplePatterns.add(new SimpleTriplePattern(s, p, o));
SimpleConstructQuery constructQuery = new SimpleConstructQuery(constructTriplePatterns);
s = new ResourceOrVariable(new Variable("x"));
p = new UriRefOrVariable(new UriRef("http://xmlns.com/foaf/0.1/name"));
Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
triplePatterns.add(new SimpleTriplePattern(s, p, o));
SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
queryPattern.addGraphPattern(bgp);
constructQuery.setQueryPattern(queryPattern);
Assert.assertTrue(constructQuery.toString()
.replaceAll("( |\n)+", " ").trim().equals(queryString));
}