The Complexity of Aggregates over Extractions by Regular Expressions
Regular expressions with capture variables, also known as "regex formulas," extract relations of spans (intervals identified by their start and end indices) from text. Based on these Fagin et al. introduced regular document spanners which are the closure of regex formulas under Relational Algebra. In this work, we study the computational complexity of querying text by aggregate functions, like sum, average or quantiles, on top of regular document spanners. To this end, we formally define aggregate functions over regular document spanners and analyze the computational complexity of exact and approximative computation of the aggregates. To be precise, we show that in a restricted case all aggregates can be computed in polynomial time. In general, however, even though exact computation is intractable, some aggregates can still be approximated with fully polynomial-time randomized approximation schemes (FPRAS).
READ FULL TEXT