util.rewriteIds: runs recursively and converts any nested '@rid' to string.