Re: Storing data and code in a Db with LISP-like interface
Date: 2 May 2006 14:48:19 -0700
Message-ID: <1146606499.706391.115600_at_v46g2000cwv.googlegroups.com>
> Nick: Assume that you want to represent the following information: > > Tony has a dog [named fido] and a bird [named tweetie]. > Joe has a bird [named polly]. > Mary has a dog [named barky]. > Bird owners enjoy a hot bath. > Dog owners that are not bird owners enjoy taking long walks. > Dog owners prefer cold showers. > On Tuesday, dog owners who are also bird owners buy groceries. > On all other days, bird owners who are not dog owners buy groceries.
Nick as I look at your "challenge" more closely, I am realizing that it combines representation of things with implementation/enforcement of constraints. While dbd can store constraints, it does not currently implement/enforce user-defined constraints.
Did you want me to represent the actual constraint "Bird owners enjoy a hot bath" or the net effect on the data which would be that "Tony and Joe enjoy hot baths". Also I am assuming you are not wanting to represent the relationships between adjectives and nouns such as hot bath and cold shower.
Below dbd's script models the first 3 lines of your information. Let me know your intent on the constraints.
(; Create a person named tony)
(new 'tony' 'person')
(; Create a person named joe)
(new 'joe' 'person')
(; Create a person named mary)
(new 'mary' 'person')
(; Create a dog named fido)
(new 'fido' 'dog')
(; Create a dog named barky)
(new 'barky' 'dog')
(; Create a bird named tweetie)
(new 'tweetie' 'bird')
(; Create a bird named polly)
(new 'polly' 'bird')
(; Create a verb named owns)
(new 'owns' 'verb')
(; Create tony owns fido and tweetie)
(create tony owns fido)
(create tony owns tweetie)
(; Create joe owns polly)
(create joe owns polly)
(; Create mary owns barky)
(create mary owns barky)
Note: (new 'tony' 'person') is equivalent to:
(new)
(create thing instance (it))
(create (it) name (findElseAdd word instance 'person'))
(new)
(create person instance (it))
(create (it) name (findElseAdd word instance 'tony'))
Received on Tue May 02 2006 - 23:48:19 CEST