StringBuffer aBuffer = new StringBuffer(aQuery);
insertNamespaces(aBuffer);
try {
new SPARQLParserFactory().getParser().parseQuery(aBuffer.toString(), "http://example.org");
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid query: " + aBuffer.toString(), e);
}
catch (MalformedQueryException e) {