queries: group predicates for same query name