(PDB-557) Add support for standard query operators and subqueries

Now environments can be queried via URI or query parameter with the
normal operations (i.e. =, ~, not, and, or etc). Subqueries for
resources and facts are also supported.