Re: Storing data and code in a Db with LISP-like interface

From: Neo <neo55592_at_hotmail.com>
Date: 27 Apr 2006 21:35:32 -0700
Message-ID: <1146198932.067812.184870_at_j33g2000cwa.googlegroups.com>


> That's what the designer (former COBOL programmer) said when I commented on his specs - containing phrases like "The file should be opened", "The corresponding items have to be moved" - you might even agree with him. Implementation strategies we are comfortable with tend to bias the way we state problems.

Ok, now I see why representing "john likes tomato1" could be considering "re-engineering" similar to that required to implement a spec stating "The file should be opened" and "The corresponding items have to be moved".

> > // Create john likes tomato1.
> > (create john like tomato1)
>
> Except for the 'create' part it is ok with me, that is, indepedendent enough for me for now. It 'll do. Going off into babble such as this doesn't help:

Ok, I didn't expect someone familiar with RM/RMDBs/SQL to have such difficulties with 'create'.

> Establish the fact that a person by the name of john likes tomato1. What does he like? Is it a type of tomato or are we talking about this one? Does he like it as food? Does he like the colour? Ad infinitum. That's why IRL I prefer real lists of, with real explanations by, the people who know what they are keeping track of, and know why they must. "john likes tomato1" looks like something an amateur cook would like to know when he invites some friends over for dinner. I can make some sense out of it, so it'll do.

Now I see why you had to re-engineer when you saw "create john likes tomato1".

> Not sure. While I collected the prolog clauses it really felt like re-engineering.

Ok, re-engineering it is then.

> >>>[ person (john) ] how does one determine the name of the relationship via code?
> >
> >>There is no [way], because I did not provide a name for this relationship.
> >
> > It seems there maybe yet another reason. Prolog may not provide a
> > method to determine the function given one set of parameter already
> > specified. Can some experiences Prologer correct me on this?
>
> Can you make your statement in a way which is more test-friendly?

Enter the following relationships in prolog:

class (john, person).         meaning one of john's class is person
instance (person, john).     meaning one of person's instance is john

Then ask prolog, what is the relationship between john and person; and vice versa, what is the relationship between person and john. You can replace john, person, class, instance with other things that make more sense to you, for instance:

parent (johnny, john). meaning johnny's parent is john child (john, johnny). meaning john's child is johnny

Then when prolog is asked, what is the relationship between john and johnny, it should respond similar to "john's son johnny" and vice versa. Here is how to do it in dbd:

(create johnny parent john)
(create john child johnny)

// Following displays parent.
(msgbox (& (select verb instance *) (select johnny * john)) )

// Following displays child.
(msgbox (& (select verb instance *) (select john * johnny)) )

In dbd, one can also represent the relationship between verbs, ie parent and child as

(create parent reciprocal child)
(create child reciprocal parent)

Dbd's Food Judge Example C, relates like and likedBy similar to above, thus when using the createWRR (create with reciprocal relationship also), and user enters "(createWRR john like tomato1)", db automatically creates the reciprocal relationship "(create tomato1 likedBy john)". There is a query later that uses likedBy to find out all the people who like tomato1 via the following query: "(select tomato1 likedBy *)". Note the Food Judge Example C is posted in response to master Prologer Alvin.

> Do we have the same concept of "thing"?

Unlikely, my concept of thing is the most general possible.

> I have a hard time seeing a category as a thing.

Your concept of thing is more limited than mine.

> >A relationship is just another thing that is represented in the dbd. The following displays "class": (msgbox (and (select verb instance *) (select john * person))). And the following display "instance": (msgbox (and (select verb instance *) (select person * john))). How would one do this in Prolog?
>
>Why?

So that one can determine the relationship between any two things.

> > So that the Prolog solution could answer the questions: what is the
> > relationship between john and person; and what is the relationship
> > between person and john.
>
> I'll re-ask: for what purpose do you need to know it?
> Which information need are you satisfying/preempting whith it?
> This would shed some light on what to record.

Imagine an andriod is introduced to a group of humans. The droid is told john's girlfriend is sally, sally mom is martha, martha's sister is ellen, etc. Later when the droid happens to meet john and sally together, it can query the relationship between the two, tailor the conversation for them or make better sense of things in context of the fact they are related as girlfriend/boyfriend :) Received on Fri Apr 28 2006 - 06:35:32 CEST

Original text of this message