Rewrite query parsing using SQ notation