Varqa : a functional query language based on an algebraic approach and conventional mathematical notation
We propose a functional query language for databases where both syntax and semantics are based on conventional mathematics. We argue that database theory should not be separated from other fields of Computer Science, and that database languages should have the same properties as those of other non-procedural languages. The data are represented in our database as a collection of sets, and the relationships between the data are represented by functions mapping these sets to each other. A database is therefore a many-sorted algebra; i.e. a collection of indexed sets and indexed operations. As in abstract data type specification, we specify the consequences of applying operations to the data without reference to any particular internal structure of the data. A query is simply an expression which is built up from symbols in the signature of the algebra and which complies with the formation rules given by the language. The meaning of a query is the value which is assigned to it by the algebra. There are several ways of extending our language. Twos ways are studied here. The first extension is to allow queries in which sets are defined inductively (i.e. recursively). This mechanism is essential for queries dealing with transitive closures over some interrelated objects. Secondly, since incomplete information is common to many databases, we extend our language to handle partially available data. One main principle guides our extensions: ‘whatever information is added to an incomplete database, subsequent answers to queries must not be less informative than previously’. Finally, we show the correspondence between Varqa and methods used in current database software. A subset of Varqa, including all features whose implementation is not obvious, is mapped to relational algebra thus showing that our language, though it has been designed with no reference to internal structure, is not incompatible with present database software.