Re: database: prolog and relational

From: Michael David Pedersen <mdp_at_removethisplease.cs.auc.dk>
Date: Sat, 05 Jun 2004 21:45:09 +0200
Message-ID: <40c222c5$0$3047$14726298_at_news.sunsite.dk>


Hi,

-cut-
> The Prolog facts database is not relational for (at least) a couple of
> reasons; mainly that the arguments of a fact are position dependent
> (ie. they aren't referred to by name), and the order of facts in a
> database affects the evaluation of predicates. (I don't have a Prolog
> interpreter in front of me just now; I'm pondering whether I can
> assert duplicate facts. I don't think there's anything to stop me but
> I've never intentionally done such a thing ;) ) There are no "columns"
> or "rows" per se. You can fake a lot of things up, and it's actually
> not too difficult to implement the relational operators in Prolog (I
> did it last year for various mad reasons).
-cut-

I agree that there are many important differences between Prolog and relational databases in the general sense. But I do not consider naming of fact arguments to be a defining part of the relational data model. At least in some literature (e.g. "Foundations of Databases" by Arbiteboul et. al) there is a clear distinction between the named and the unnamed relational algebra perspectives, where the latter uses integer indexes when referring to tuple attributes instead of names. But the two perspectives have equal expressive power and are both "relational".

Whether Prolog can be considered "relational" or not is probably a matter of definition. Prolog can certainly do a lot more than a relational database system, although it also lacks many properties that are readily available in a full-blown database system (such as integrity constraints, transaction management, secondary storage access etc). But unnamed relations can be directly represented as Prolog procedures, i.e. sets of facts with the same name (and arity). And as you mentioned, the relational operators can be implemented very concisely using only a few lines of Prolog code. Therefore I think that it is reasonable to describe Prolog as "relational", to the extent that it is reasonable to describe anything as "relational" without a closer definition of this term.

Best regards,
Michael. Received on Sat Jun 05 2004 - 21:45:09 CEST

Original text of this message