🤖 AI Summary
This work addresses the open problem of automated verification of cross-paradigm query equivalence between graph databases (Cypher) and relational databases (SQL). We propose the first formal-semantics-based unified verification framework. Our core method introduces a database transformer that directionally embeds a syntactically restricted subset of Cypher into SQL, thereby reducing cross-model equivalence checking to standard SQL query equivalence verification—without requiring joint semantic modeling of both data models. Technically, we integrate formal semantic definitions, syntax-driven translation, SMT solving, and automated theorem proving. We implement our approach in Graphiti, an open-source tool that successfully detects subtle semantic inconsistencies in the official Cypher tutorial and multiple research papers. Graphiti supports efficient equivalence checking and counterexample generation, delivering the first rigorous, formally verifiable, and practically applicable solution for automated cross-paradigm query equivalence verification.
📝 Abstract
This paper presents an automated reasoning technique for checking equivalence between graph database queries written in Cypher and relational queries in SQL. To formalize a suitable notion of equivalence in this setting, we introduce the concept of database transformers, which transform database instances between graph and relational models. We then propose a novel verification methodology that checks equivalence modulo a given transformer by reducing the original problem to verifying equivalence between a pair of SQL queries. This reduction is achieved by embedding a subset of Cypher into SQL through syntax-directed translation, allowing us to leverage existing research on automated reasoning for SQL while obviating the need for reasoning simultaneously over two different data models. We have implemented our approach in a tool called Graphiti and used it to check equivalence between graph and relational queries. Our experiments demonstrate that Graphiti is useful both for verification and refutation and that it can uncover subtle bugs, including those found in Cypher tutorials and academic papers.