Add selector-based query manipulation helpers and create initial query engine implementation