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.
Yes -- I'll clarify.