Regular path queries (RPQs) are an essential component of graph query languages. Such queries consider a regular expression r and a directed edge-labeled graph G and search for paths in G for which the sequence of labels is in the language of r. In order to avoid having to consider infinitely many paths, some database engines restrict such paths to be trails, that is, they only consider paths without repeated edges. In this paper we consider the evaluation problem for RPQs under trail semantics, in the case where the expression is fixed. We show that, in this setting, there exists a trichotomy. More precisely, the complexity of RPQ evaluation divides the regular languages into the finite languages, the class Ttract (for which the problem is tractable), and the rest. Interestingly, the tractable class in the trichotomy is larger than for the trichotomy for simple paths, discovered by Bagan, Bonifati, and Groz [JCSS 2020]. In addition to this trichotomy result, we also study characterizations of the tractable class, its expressivity, the recognition problem, closure properties, and show how the decision problem can be extended to the enumeration problem, which is relevant to practice.
翻译:正则路径查询(RPQ)是图查询语言的重要组成部分。这些查询将一个正则表达式 r 和一个有向边标记的图 G 作为输入,并搜索 G 中的路径,使其标记序列在 r 的语言中。为了避免考虑无限多的路径,一些数据库引擎将这种路径限制为轨迹 (trail),即只考虑没有重复边的路径。在本文中,我们研究了在固定表达式下,RPQ 在轨迹语义下的求解问题。我们证明,在这种情况下,存在一种三分法。更准确地说,RPQ 求解的复杂度将正则语言分为有限语言,Ttract 类(其中问题是可处理的)和其余语言。有趣的是,在此三分法中,可处理类比 Bagan、Bonifati 和 Groz 在简单路径上发现的三分法的可处理类更大[JCSS 2020]。除了这个三分法结果,我们还研究了可处理类的特征、表现力、识别问题、封闭性质,并展示了决策问题如何扩展到枚举问题,这对实践是有意义的。