A relational programming language (RPL) is a DeclarativeLanguage
built around the RelationalModel
(SQL) is an example.
A relation can be viewed as a reversible function that can return an arbitrary number of values. For example, the "square root" relation maps the number  to itself, but maps  to [2 -2]. Relations can also be arranged as tables, and can be self-describing. For these reasons, relational programming can be seen as a generalization of functional programming.
The internet archive has a fascinating set of papers from the 1980's by Bruce J MacLennan?
at the Naval Postgraduate school in Monterey:
- Introduction to Relational Programming (Jun 1981) - https://archive.org/details/introductiontore00macl
- Overview of relational programming (Nov 1981) - https://archive.org/details/overviewofrelati00macl
- A Relational Program for a Syntax Directed Editor (Apr 1982) - https://archive.org/details/relationalprogra00macl
- Relational Programming (Sep 1983) - https://archive.org/details/relationalprogra83012macl
- Four Relational Programs (Nov 1986) - https://archive.org/details/fourrelationalpr00macl
's approach combines the relational calculus with ideas from the FP language by JohnBackus
and a syntax inspired by the constructed language Loglan (from which LojbanLanguage
is derived). The resulting notation is somewhat reminiscent of JayLanguage
And here I was thinking about stored procedure / trigger languages that execute "in" a RelationalDatabase:
- TransactSQL - Sybase & SQL Server
- PL/SQL - Oracle
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
- "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."
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).
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