@Test
public void parseSimpleQuery() throws Exception {

    InputStream query = getClass().getResourceAsStream("/example1.rq");
    Sparql11Parser parser = Query.getParser(streamToString(query));
    parser.addErrorListener(new BaseErrorListener() {
        @Override
        public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
            throw new IllegalStateException("failed to parse at line " + line + " due to " + msg, e);
        }
    });
    parser.query();
}