Resource Query Language or RQL is a query language which provides a nice way of querying a data store, SQL database etc. via a URI. For more details on RQL see this Sitepen blog article by Kris Zyp and the Dojo Foundation’s Persevere RQL repository on Github. The short of it is that you can write queries in URI’s like this:


I have written a Java parser for RQL since I couldn’t find one and published it on the Maven Central Repository. The parser’s logic is based on the Javascript parser from the Persevere project so it should work for most situations.


The parser generates an ASTNode object representing the root node of an Abstract Syntax Tree (AST). Create a class that implements ASTVisitor in order to traverse the tree.

RQLParser parser = new RQLParser();
MyVisitor visitor = new MyVisitor();
ASTNode node = parser.parse("(name=jack|name=jill)&age>30");
Object result = node.accept(visitor);


See the ListFilter class, which is an ASTVisitor which filters a list of bean objects.

Get it from Maven