Pruning Extensional Predicates in Deductive Databases

Tiago Soares, Ricardo Rocha and Michel Ferreira

October 2005


By coupling Logic Programming with Relational Databases, we can combine the higher expressive power of logic with the efficiency and safety of databases in dealing with large amounts of data. An important drawback of such coupled systems is the fact that, usually, the communication architecture between both systems is not tight enough to support a completely transparent use of extensionally (or relationally) defined predicates in the logic program. Such an example is the cut operation. This operation is used quite often in Prolog programs, both for efficiency and semantic preservation. However, its use to prune choice-points related to database predicates is discouraged in existing coupled systems. Typically, SQL queries result sets are kept outside WAM data structures and the cut implementation leaves the database result set pointer (cursor) open and the result set data structure allocated in memory, instead of closing the cursor and deallocating memory. In this work we focus on the transparent use of the cut operation over database predicates, describing the implementation details in the context of the coupling between the YapTab system and the MySQL RDBMS. Our approach can be generalised to handle not only database predicates but also any predicate that requires generic actions upon cuts.


  author =    {T. Soares and R. Rocha and M. Ferreira},
  title =     {{Pruning Extensional Predicates in Deductive Databases}},
  booktitle = {Proceedings of the 5th Colloquium on Implementation of Constraint and LOgic Programming 
               Systems (CICLOPS 2005)},
  pages =     {13--24},
  editor =    {C. Schulte and F. Silva and R. Rocha},
  month =     {October},
  year =      {2005},
  address =   {Sitges, Spain},

Download Paper

PDF file