found way to use queries in prolog script