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

From: Nick Malik [Microsoft] <nickmalik_at_hotmail.nospam.com>
Date: Fri, 28 Apr 2006 10:30:03 -0700
Message-ID: <ZPmdnVdq-vWQzc_ZnZ2dnUVZ_sGdnZ2d_at_comcast.com>


"Neo" <neo55592_at_hotmail.com> wrote in message news:1146238552.854074.157840_at_u72g2000cwu.googlegroups.com...

> Let me see if I can engage you (or another ProLoger/LISPster) in a much
> simpler example. The goal: Find the thing with whom john's relationship
> is opposite that of with mary. Below is dbd's abbridged script:
>
> (create person instance john)
> (create person instance mary)
> (create person instance bob)
> (create verb instance like)
> (create verb instance hate)
> (create like opposite hate)
> (create john like mary)
> (create john hate bob)
>
> // This query finds, it is bob.
> (select john
> (select (& (select verb instance *) (select john * mary))
> opposite
> *)
> *)
>
> Note: I deduct points for methodologies that are not systematic :)
>

I'm tired of this game.

I'm going to reply with the simplest solution I can think of. It will surely not match requirements that are not in evidence right now.

opposite(like,hate).
relationship(john,like,mary).
relationship(john,hate,bob).

// let's pose the question:
// for whatever relationship john has with mary, find another person with whom john has the opposite relationship

? relationship(john, R1, mary), opposite(R1, R2), relationship(john, R2, Other)

Prolog replies

   R1 = like
   R2 = hate
   Other = bob

OK. I've done my part. Now it's your turn. Please start here:
http://www.aaai.org/AITopics/html/struc.html

-- 
--- 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.
-- 
Received on Fri Apr 28 2006 - 19:30:03 CEST

Original text of this message