Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Object > Re: Storing dat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 34 Topic 276 of 365
Post > Topic >>

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

by "Nick Malik [Microsoft]" <nickmalik@[EMAIL PROTECTED] > Apr 18, 2006 at 11:13 PM

"Neo" <neo55592@[EMAIL PROTECTED]
> wrote in message 
news:1145298018.123938.13480@[EMAIL PROTECTED]
>> ... calling one of us an idiot.  Not sure who.  :-)
>
> Well if you don't want the compliment, I'll take it :)

LOL
>
>> Prolog is not an inherently type-safe language ...
>
> This is slightly off-topic, but I am curious about your view:

These are good questions, but I'm not sure if you are asking me about my 
views on relational data management or on logical rules management.  The 
difference is simple.  Relational describes relation****ps like 'is a' and 
'has a' and 'is defined by' while logical rules management simply states 
'the relation****p is what you define it to be'.

It has been well over a decade since I wrote Prolog code, so if someone 
reading this newsgroup knows Prolog and they see this, my sincere
apologies. 
The concept is what I'm trying to convey.

I will answer your questions with statements that are (or resemble)
Prolog.

>
> 1) What is the proper name of the relation****p between person and John,
> person and Mary, fruit and apple, fruit and banana, etc. Ie, fill the
> verb in: person ____  john.

named_instance(john,person).
named_instance(mary,person).
subtype(apple,fruit).
subtype(banana,fruit).


>
> 2) What is the proper name of the reverse relation****p between John and
> person, Mary and person, apple and fruit, banana and fruit, etc. Ie,
> fill the verb in: john ___ person.

? named_instance(john, A )

(to which the system responds)
A = person

(I skipped your question.  The answer to the logic of your question is: I 
would consider john to be a named instance of the noun 'person').

>
> 3) Just as John and Mary "are" persons, and apple and banana "are"
> fruits, what are person and fruit?

person is a noun.  fruit is a noun.  In Prolog, they are atoms.  They have

no 'meaning' except as defined by their relation****p with john and banana.

(You will notice that I use lower case, even for proper names.  In Prolog,

lower case tokens are 'atoms' while a token that begins with a capital 
letter is a variable).

>
> 4) Supposing the answer to question 3 is xyz, what is the proper name
> of the relation****p between xyz and person, xyz and fruit, etc?

not a sensible question in Prolog context.  There is no notion of subtype
or 
supertype.  Only expression.  Imagine that we are talking about Boolean 
logic.  A or B.  Is A a variable?  If we say "A is a B and B is a C, 
therefore A is a C," we have defined the transitive property of 'is a'. 
Before making the statement, the verb 'is a' had no such property.  The 
scope of this property may be quite limited.  Prolog assumes this.  Most 
data management languages have a great many meta-rules.  Prolog does too, 
but they are not based on the data.  They are, instead, based on the
logic.

>
> 5) Supposing the answer to question 3 is xyz, what is the proper name
> of the reverse relation****p between person and xyz, fruit and xyz, etc?
>

See above.


Let's say, in Prolog, you want to express the transitive nature of 
'contains'.  It could look like this:

contains(A, B) :- contains(A, X), contains(X, B).

Now let's establish some facts.

contains(cup, coin).
contains(bucket, cup).
contains(box, bucket).
contains(truck, box).
contains(****p, truck).

We are saying that the coin is in the cup is in the bucket is in the box
is 
in the truck is in the ****p.

Now, ask the question: is the coin in the truck?

? contains(truck, coin)

to which the system responds:
yes.
(or 'true.'  Not sure anymore ;-).

It does it by comparing the predicate contains/2 to each of the rules in
the 
system.  There are six matching rules.  One is an expression.  The rest
are 
facts.  The comparison doesn't match one of the facts, so the expression
is 
invoked.  The expression says: any item is inside another item if you can 
find an intermediary where the item is in the intermediary and the 
intermediary is in the other item... RECURSIVE.  Using a depth-first
search, 
the system quickly finds that the coin is in a cup where a cup is in a 
bucket where a bucket is in a box where a box is in a truck, therefore the

coin is in the truck.

The entire program is in this post.  There is nothing else.

HTH,


-- 
--- Nick Malik [Microsoft]
    MCSD, CFPS, Certified Scrummaster
    http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not 
representative of my employer.
   I do not answer questions on behalf of my employer.  I'm just a 
programmer helping programmers.
--
 




 34 Posts in Topic:
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-12 00:57:05 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-13 16:48:22 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-14 00:56:12 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-16 16:25:50 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-17 07:39:07 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-17 20:07:26 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-18 23:13:34 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-22 10:11:59 
Re: Storing data and code in a Db with LISP-like interface
Pascal Bourguignon <pj  2006-04-23 01:55:15 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-28 09:23:34 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-21 13:05:58 
Re: Storing data and code in a Db with LISP-like interface
Pascal Bourguignon <pj  2006-04-21 16:33:02 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-21 14:49:06 
Re: Storing data and code in a Db with LISP-like interface
Pascal Bourguignon <pj  2006-04-21 17:13:44 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-21 17:13:50 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-21 18:33:19 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-21 20:44:02 
Re: Storing data and code in a Db with LISP-like interface
"David Cressey"  2006-04-22 15:04:03 
Re: Storing data and code in a Db with LISP-like interface
Bill Atkins <NOatkinwS  2006-04-22 12:57:37 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-22 17:29:38 
Re: Storing data and code in a Db with LISP-like interface
A..L. <alewando@[EMAIL  2006-04-22 14:11:05 
Re: Storing data and code in a Db with LISP-like interface
Frank Hamersley <terab  2006-04-23 08:30:45 
Re: Storing data and code in a Db with LISP-like interface
"Dmitry A. Kazakov&q  2006-04-21 22:27:47 
Re: Storing data and code in a Db with LISP-like interface
"Dmitry A. Kazakov&q  2006-04-22 11:12:09 
Re: Storing data and code in a Db with LISP-like interface
Sasa <sasa555@[EMAIL P  2006-04-21 22:38:36 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-21 21:03:30 
Re: Storing data and code in a Db with LISP-like interface
Sasa <sasa555@[EMAIL P  2006-04-22 07:40:29 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-22 10:47:30 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-22 18:46:57 
Re: Storing data and code in a Db with LISP-like interface
Sasa <sasa555@[EMAIL P  2006-04-22 21:58:37 
Re: Storing data and code in a Db with LISP-like interface
Bob Badour <bbadour@[E  2006-04-22 20:10:22 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-22 10:20:37 
Re: Storing data and code in a Db with LISP-like interface
"Nick Malik [Microso  2006-04-22 12:29:41 
Re: Storing data and code in a Db with LISP-like interface
"Nameless" <  2006-04-23 17:28:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 22:30:42 CDT 2008.