Path: flpi142.ffdc.sbc.com!flph199.ffdc.sbc.com!prodigy.com!flph200.ffdc.sbc.com!prodigy.net!bigfeed.bellsouth.net!bigfeed2.bellsouth.net!news.bellsouth.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe08.iad.POSTED!7564ea0f!not-for-mail From: Joachim Schimpf User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 Newsgroups: comp.lang.prolog Subject: Re: Converting between relations and properties of objects References: <496f8cfc$0$1601$6e1ede2f@read.cnntp.org> In-Reply-To: <496f8cfc$0$1601$6e1ede2f@read.cnntp.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Organization: Ye 'Ol Disorganized NNTPCache groupie Message-ID: <1232083252.508801@sj-nntpcache-3.cisco.com> Cache-Post-Path: sj-nntpcache-3.cisco.com!unknown@syd-vpn-client-247-166.cisco.com X-Cache: nntpcache 3.0.2 (see http://www.nntpcache.com/) Lines: 30 X-Complaints-To: newsadmin@cisco.com NNTP-Posting-Date: Fri, 16 Jan 2009 05:20:52 UTC Date: Fri, 16 Jan 2009 16:20:51 +1100 Xref: prodigy.net comp.lang.prolog:41797 X-Received-Date: Fri, 16 Jan 2009 00:20:53 EST (flpi142.ffdc.sbc.com) a314658 wrote: > Suppose I have a world and know three "facts" about it: > > smokes(ann). /* ann smokes */ > student(ann). /* ann is a student */ > student(jon). /* jon is a student */ > > If I can ask Prolog, who are the students? it would say: ann and jon. > > What I want to do is to run the query: describe ann. And get the result: > ann student, ann smokes. In other words, I want to switch from > representing information as sets and relations to properties of objects. > How do I do that in Prolog? I'd appreciate any advise on the topic. property(smokes). property(student). describe(Object, Property) :- property(PropName), Property =.. [PropName,Object], Property. ?- describe(ann, Property). Property = smokes(ann) Yes ; Property = student(ann) Yes -- Joachim