export query function