Implement the %R query pattern