Augument query language with ranges

Summary:
Fix assertion bug

close #82

Test Plan: make test

Reviewers: cprodescu

Differential Revision: http://phab.code4fun.de/D109