interface for query generation