nine/query: implement queries