On the implementation of a simple class of logic queries for databases

1. Introduction We assume the reader familiar with the basic concepts of refational databases (Ul] and with the logical query language for databases; using PROLOG's notation, described in [U2]. A database logic query is expressed as a triple <G ,LP ,D >, where G is a goal to be solved using the rules of the logic program LP and the facts of the relational database D. In thii paper, we study the problem of efficient implementations of queries on recur-sive rules without function symbols. We focus on an important subclass, called canonical strongly linear queries (CSL queries), and study the binding-passing property, which entails the propagation of the initial bindings (established by constants in the query goal) during the top-down (as in backward chaining) execution phase. The paper is organized as follows. In Section 2, we define CSL queries and study the binding propagation problem. In Section 3, we focus on l-bound CSL queries, where the binding propagates to a single (but not always the same)'argument of the recursive predicate. In Section 4, we study the problem of implementing these queries. We use a unifying framework to provide a simple description of the following four methods: the counting method (informally described in p+]), the eager method (similar to that in [HN]), the magic set method (presented in [B+]), and a new method here introduced, called magic counting, which combines the advantages of the first and the third. Extensions to and proofs of these results are given in [SZ].