We investigate the complexity of evaluating queries in Relational Algebra (RA) over the relations extracted by regex formulas (i.e., regular expressions with capture variables) over text documents. Such queries, also known as the regular document spanners, were shown to have an evaluation with polynomial delay for every positive RA expression (i.e., consisting of only natural joins, projections and unions); here, the RA expression is fixed and the input consists of both the regex formulas and the document. In this work, we explore the implication of two fundamental generalizations. The first is adopting the "schemaless" semantics for spanners, as proposed and studied by Maturana et al. The second is going beyond the positive RA to allowing the difference operator. We show that each of the two generalizations introduces computational hardness: it is intractable to compute the natural join of two regex formulas under the schemaless semantics, and the difference between two regex formulas under both the ordinary and schemaless semantics. Nevertheless, we propose and analyze syntactic constraints, on the RA expression and the regex formulas at hand, such that the expressive power is fully preserved and, yet, evaluation can be done with polynomial delay. Unlike the previous work on RA over regex formulas, our technique is not (and provably cannot be) based on the static compilation of regex formulas, but rather on an ad-hoc compilation into an automaton that incorporates both the query and the document. This approach also allows us to include black-box extractors in the RA expression.
带有捕获变量的正则表达式,也称为“regex公式”,从文本中提取跨度(间隔位置)的关系。这些关系可以通过关系代数进一步操纵,如在文档speeding的上下文中所研究的,Fagin et al.的信息抽取的形式框架。我们调查的复杂性查询文本的合取词(CQ)和联盟的CQ(UCQ)的顶部正则表达式公式。我们证明了关系世界的下界(NP-完全性和W[1]-硬度)在我们的设置中也成立;特别是,硬度已经达到了单字符文本!然而,关系世界的上限并没有延续。与关系世界不同,非循环CQ,甚至是伽马非循环CQ都很难计算。困难的根源在于,实例化由正则表达式公式定义的关系可能很难,仅仅因为它具有指数数量的元组。然而,我们能够建立一般的上限。特别是,UCQ可以用多项式延迟来计算,只要每个CQ都有有限数量的原子(而联合和投影可以是任意的)。此外,当参数为UCQ的大小时,UCQ评估可通过FPT(Fixed-Parameter Tractable)延迟来求解。