generic query library