Suppose you have a graph-like database, such as a semistructured database, and you have materialized the answer to several queries Qi of the form "find nodes reachable from the root by a path that satisfies regular expression Ri."

Now you have a query Q on the original database and you would like to take advantage of the materialized answers (or views) in answering Q efficiently. This paper gives a simple and elegant automata-theoretic method for rewriting Q in terms of the Ri's whenever it is possible to do so.

This is an extension of the well-studied and widely applicable problem of rewriting queries using views to a new kind of views and queries. By restricting the analysis to regular expressions, as opposed to more general recursive queries, the undecidability cases (e.g. Datalog) are avoided.

The problem of finding the most efficient such rewriting remains open, however. For example, if the two materialized queries are R1 = a*, R2 = (a+aa)*, and the query is Q = a*, the method in the paper will produce the rewriting (R1+R2)*, when R1 would suffice and would (intuitively) be cheaper to evaluate.

a service of  Schloss Dagstuhl - Leibniz Center for Informatics