Nested regular path queries are used for querying graph databases and RDF triple stores. We propose a new algorithm for evaluating nested regular path queries on a graph from a set of start nodes in combined linear time. We show that this complexity upper bound can be reduced by making it dependent on the size of the query's top-down needed subgraph, a notion that we introduce. For many queries in practice, the top-down needed subgraph is way smaller than the whole graph. Our algorithm is based on a novel compilation schema from nested regular path queries to monadic datalog queries. Its complexity upper bound follows from known properties of top-down datalog evaluation. As an application, we show that our algorithm permits to reformulate in simple terms a variant of a very efficient automata-based algorithm proposed by Maneth and Nguyen that evaluates navigational path queries in datatrees based on indexes and jumping. Moreover, it overcomes some limitations of Maneth and Nguyen's: it is not bound to trees and applies to graphs; it is not limited to forward navigational XPath but can treat any nested regular path query and it can be implemented efficiently without any dedicated techniques, by using any efficient datalog evaluator such as LogicBlox.
翻译:用于查询图表数据库和 RDF 三角仓库的常规路径查询 。 我们提出一种新的算法, 用于在一组起始节点的图表中以合并线性时间来评估嵌入常规路径查询。 我们显示, 复杂的上层界限可以通过使其取决于查询的自上而下所需的子图大小来减少。 对于许多查询来说, 上下所需的子图比整个图表要小得多。 我们的算法基于从嵌入的常规路径查询到monadicalog查询的新编译的系统。 其复杂性上限由自上而下的数据评估的已知特性来决定。 作为应用程序, 我们显示, 我们的算法允许以简单条件重新配置一个由 Maneth 和 Nguyen 所推荐的非常高效的基于自上至下所需的子图的自动算法变量, 这个变量可以评估基于索引和跳跃的数据塔的导航路径查询。 此外, 它克服了Maneth 和 Nguyes 的某些限制: 它不局限于树, 也适用于图形; 它不局限于前向前向 XPath, 也可以处理任何嵌套式的常规路径评估工具,, 可以通过任何专门的系统来高效的系统来实施任何有效的逻辑评估技术。