basic_valid = all(re.search(pattern, query) for pattern in [ r'CREATE (', r'{.*?}', r')-[:.*?]->' ]) if not basic_valid: return False