🤖 AI Summary
This work addresses the limited expressiveness of existing graph query languages—such as GQL and SQL/PGQ—which lack full compositionality and cannot capture complex path queries within the NLOGSPACE complexity class. To overcome this limitation, the paper introduces a novel query language that unifies graph pattern matching with relational querying through two key innovations: regular path queries enriched with variables and data-value comparisons, and a #Datalog-based graph transformation mechanism capable of constructing nodes, edges, and paths. This combination enables, for the first time, a systematically compositional approach to graph querying that precisely captures the full expressive power of NLOGSPACE. The proposed language not only resolves fundamental expressiveness gaps in current standards but also offers a practical and theoretically grounded extension pathway for both GQL and SQL/PGQ.
📝 Abstract
A major shortcoming of the recently standardized graph query languages GQL and SQL/PGQ is their lack of compositionality. Given the importance of these languages in querying knowledge graphs, we address this shortcoming and propose both theoretical solutions and a path to adding them to the new standards. The highlight of the non-compositionality problem is that while both GQL and SQL/PGQ can express graph reachability and all first-order queries, they fall short of the problems in NLOGSPACE. In view of the completeness of reachability for NLOGSPACE under first-order reductions, this is extremely counterintuitive. The issue is well recognized by the standards committee that has been searching for language extensions to fill the gaps at the level of some specific inexpressible queries.
We address the issue in a systematic way and propose a language that fills expressivity gaps by allowing full compositionality between graph patterns and relational queries. It does so by using two key components: a cleaned up definition of regular path queries with variables and data value comparisons, and a fully compositional graph-to-graph language #Datalog with complete support for constructing new graph elements from nodes, edges, lists of nodes and edges, and even entire paths. We show that the resulting language addresses the issues facing the standards committee, and propose a concrete addition to GQL and SQL/PGQ that incorporates its main features.