Relational Programming Language

A relational programming language (RPL) is a DeclarativeLanguage built around the RelationalModel of data. StructuredQueryLanguage (SQL) is an example.


And here I was thinking about stored procedure / trigger languages that execute "in" a RelationalDatabase: To me, these seem more like imperative languages that happen to allow SQL and DDL statements -- what would PL/SQL look like, for instance, if it was "truly relational" (whatever that means)?


See also Jay Earley's VERS 2, a ProceduralProgrammingLanguage? built around the RelationalModel of data. For example, this paper:

Jay Earley
"Relational Level Data Structures for Programming Languages". Acta Informatica 2: 293-309 (1973)


Also LIBRA - A general-purpose programming language based on the algebra of binary relations

http://www.cs.adelaide.edu.au/~dwyer/TR95-10_TOC.html
"Ordinary programming languages calculate functions. Sometimes a function is inappropriate. For example, 4 has two square roots, +2 and -2, but an ordinary programming language provides a sqrt function that returns only one of the roots."

The PrologLanguage could be considered a relational programming language.

Not really. PrologLanguage has no inherent support for labeled tuples. All it has is untyped lists of "atoms". In this respect it is quite similar to LispLanguage. I suppose you could add support for labeled (typed) tuples, though. OTOH one of the fundaments of PrologLanguage is an in-memory database of "facts" (forgot the actual term - clauses maybe? - but "facts" describes them better than original).

PrologLanguage has tuples, but you examine them using pattern matching instead of using labels. Prolog is based on predicate logic rather than relational calculus. Relational calculus is I think a restricted form of predicate logic.

The truth statements of prologs are similar to the rows of a relational table. (are there your tuples above?)

 employee ('Joe Doe', 1979, 'Department of Defense').
 employee_managed_by ('Joe Doe', 'Mister X').

The thing that RelationalCalculus is missing are the rules of Prolog. It is straightforward to have a "directReports" relationship in a relational table--associating each employee with his/her boss--but deriving the "indirectReports" relationship (the transitive closure of the directReports relationship) is trickier. You can do it with RelationalJoin?s, but that's ugly. A rule in PrologLanguage expresses this relationship much more succinctly.

This can be made into a PrologForMassiveData.


Also see TutorialDee, RelationalLanguage, PrologForMassiveData

EditText of this page (last edited October 24, 2004) or FindPage with title or text search