Abstract

Several methods to compile recursive function free Horn clause programs, called D ATALOG, have been proposed in the literature. Most of them perform a rewriting of the rules using M AGIC or P ROBLEM predicates in order to push selections before recursion. Rewritten rule systems are generally complex and difficult to translate in optimized relational algebra programs. Moreover, they generally generate too many results; thus, the query must be applied to the generated results to eliminate nonrelevant answers. After a survey of the existing compilation techniques which point out their limitations, we develop the magic function method. It is based on an interpretation of the query as a function which maps one column of a relation to another column. The rules are first translated into a connection graph and then, by a traversal of the associated graph, rewritten into a fixpoint functional equation. The resolution of this fixpoint equation using Tarski's theorem leads to efficient computations of the query answer. In particular, the derived algorithms push selections through recursion, because selections appear as function arguments. They generate only relevant answers to a given query. The purpose of this paper is mainly the introduction of a generalized method to obtain the fixpoint functional equation. The method is general enough to handle all binary rules, cyclic rules and function symbols. The main advantages of the method are: (1) It generates directly an optimized relational algebra program. (2) It performs a symbolic pre-computation which permits rule redundancy elimination. (3) It fully supports function symbols and range queries. Finally, an efficient execution algorithm working both on symbolic magic functions and data is proposed to evaluate recursive queries.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call