Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
triplePatterns.add(new SimpleTriplePattern(
new UriRef("http://localhost/testitem"), p, x));
SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
queryPattern.addGraphPattern(bgp);
List<Expression> arguments = new ArrayList<Expression>();
arguments.add(x);
arguments.add(new LiteralExpression(LiteralFactory.getInstance().
createTypedLiteral(".*uni.*")));
BuiltInCall constraint = new BuiltInCall("REGEX", arguments);
queryPattern.addConstraint(constraint);
selectQuery.setQueryPattern(queryPattern);
Assert.assertTrue(selectQuery.toString()
.replaceAll("( |\n)+", " ").trim().equals(queryString));
}