Re: deductive databases

From: VC <boston103_at_hotmail.com>
Date: Sun, 15 May 2005 11:42:41 -0400
Message-ID: <U9-dnenzwppx8BrfRVn-iw_at_comcast.com>


See below:

"alex goldman" <hello_at_spamm.er> wrote in message news:1436952.HqgieSMmFo_at_yahoo.com...
> VC wrote:
>
>>
>> "Jan Hidders" <jan.hidders_at_REMOVETHIS.pandora.be> wrote in message
>> news:xVQge.89347$4x.5404810_at_phobos.telenet-ops.be...
>>> alex goldman wrote:
>>>> While people who responded seem to disagree on whether SQL has
>>>> recursion,
>>>
>>> ?? I didn't see any disagreement. What the different answers told you
>>> was
>>> that this differs per SQL standard and per implementation.
>>>
>>>> what about functors?
>>>>
>>>> For example, can you express something like this with SQL?
>>>>
>>>> for_any X Y : car(cons(X, Y), X)
>>>
>>> That depends on what you mean by "can express". Since SQL is a query
>>> language in which you formulate queries over tables it can only
>>> formulate
>>> queries over tables and not over functors. So in that sense the answer
>>> is
>>> "no" but that observation is about as interesting as the fact that SQL
>>> also cannot make coffee. If you reformulate it as a statement about
>>> tables by, for example, modeling car as a binary table and cons as a
>>> ternary table then you *can* express this and for that you don't even
>>> need recursion.
>>>
>>> -- Jan Hidders
>>
>> It actually depends on what <alex goldman> means by
>>
>> a. 'Functor', the word that has different meaning in different
>> PLs/contexts
>>
>> b. car(cons(X,Y), X). If it's Lisp, the expression does not make sense.
>> If it's a Prolog 'functor', it does not make any sense either.
>
> In the future, please add qualifiers like "to me" to silly statements like
> the above. Car of a cons, consisting of X and Y, is X.

Ah, so Prolog it is. In this case, car(cons(X,Y), X) still does not make syntactical sense. This string should be either :

assert( car(cons(X,Y), X)).

or exist as a line, terminated by a dot, in a file loaded by 'consult'.

Now, back to you assertion that the string of characters in question somehow possesses superior expressive power. The string is nothing more but a Prolog way to describe a data structure ('compound term' in the Prolog jargon), roughly equivalent to a database relation. Let's say we have a line like this:

point(X,Y,Z) or junk1(junk2(A, B, C), C).

Then 'point', 'junk1' or 'junk2 would be called 'functors' and X,Y,Z or A, B, C 'arguments'.

Now, you could ask a 'question' like:

junk1(junk2(1,2,3), X) and Prolog, using simple pattern matching would say "X=3".

By the same token, given assert( car(cons(X,Y), X)). and saying something like

car( cons( cons( 1, cons( 2, nil )), cons( 3, cons( 4, nil )) ), X ).

would yield:

"X = cons(1, cons(2, nil))"

Big deal ... In SQL, a 'question' like that could be expressed with a trivial select statement. Received on Sun May 15 2005 - 17:42:41 CEST

Original text of this message