refactor query rule methods