QueryParserUtil { public static String removeSPARQLQueryProlog(String queryString) { final Token t = QueryPrologLexer.getRestOfQueryToken(queryString); if (t != null) { return t.getStringValue(); } else { return queryString; } }  static QueryParser createParser(QueryLanguage ql); static ParsedOperation parseOperation(QueryLanguage ql, String operation, String baseURI); static ParsedUpdate parseUpdate(QueryLanguage ql, String update, String baseURI); static ParsedQuery parseQuery(QueryLanguage ql, String query, String baseURI); static ParsedTupleQuery parseTupleQuery(QueryLanguage ql, String query, String baseURI); static ParsedGraphQuery parseGraphQuery(QueryLanguage ql, String query, String baseURI); static ParsedBooleanQuery parseBooleanQuery(QueryLanguage ql, String query, String baseURI); static String removeSPARQLQueryProlog(String queryString);  }
@Test public void testGetRestOfQueryString() throws Exception { String queryString = "# this is a comment\n" + "PREFIX : <http: + "# one more comment\r\n" + "SELECT * WHERE { ?s ?p ?o }"; String restQuery = QueryParserUtil.removeSPARQLQueryProlog(queryString); Assert.assertEquals("SELECT * WHERE { ?s ?p ?o }", restQuery); }