Proposal for Query system

This is a proposal for a query language and implementation plan for it.  @cheddar and @jh-bate -- your comments would be appreciated.
I think it should be

```
authorized(myToken) AND ...
```

?