Glue: a deductive database programming language
Geoffrey Phipps · 1992
A deductive database uses a relational style database to store base tuples, and a variant of first-order logic as a query language. Deductive databases are declarative systems, meaning that the programmer need not (cannot) specify the actual path of execution states. Unfortunately there are many applications that require a knowledge of state, two examples being input-output and database updates. The programmer must be able to specify the order of such operations. Non-declarative operations can be grafted on to a previously declarative language, but these new operations usually do not blend well with the rest of the language. Glue takes a different approach. If it is necessary to program procedurally, then we should admit it and do a good job of it. Hence Glue is a procedural language for deductive databases. It is designed to complement the purely declarative Nail query language. The two languages combined are sufficient to write a complete application. Glue was designed to be as close to Nail as possible, therefore minimizing the impedance-mismatch problem. Pseudo-higher order programming is available in both languages, using the Nailog term system. Nailog is a restriction of HiLog. Nailog cleanly handles set-valued attributes. An optimizing compiler was written, using Prolog and C++. Optimization strategies include relation cardinality analysis, partial unification at compile time, and variations of data flow analysis. Several test applications were also written, both to test the practical expressiveness of the language, and to provide execution traces for research into optimization. We conclude that medium-scale applications can be written in Glue-Nail, and will run at an acceptable speed.