Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Classic Family Relationships

0 views
Skip to first unread message

Jeff Gaines

unread,
Nov 17, 2009, 7:42:52 AM11/17/09
to

Now I am up and running with Amzi I want to start with a family
relationships program, it has the advantage that the results will be easy
to check and it may throw up a few surprises :-)

I can't decide whether to put the basic data in the format:

parents(nameKey, fatherNameKey, motherNameKey).

or to split it:
father(nameKey, fatherNameKey).
mother(nameKey, motherNameKey).

Since many of the predicates will need both mother and father it seems I
might as well keep them together and grab them at the same time.

Any thoughts on this, in particular if I use the first form am I going to
find problems down the line?

Many thanks.

--
Jeff Gaines Dorset UK
You can't tell which way the train went by looking at the tracks

YauHsienHuang

unread,
Nov 17, 2009, 8:15:57 AM11/17/09
to
On Nov 17, 8:42 pm, "Jeff Gaines" <jgaines_new...@yahoo.co.uk> wrote:
> I can't decide whether to put the basic data in the format:
> parents(nameKey, fatherNameKey, motherNameKey).
> or to split it:
> father(nameKey, fatherNameKey).
> mother(nameKey, motherNameKey).
> Since many of the predicates will need both mother and father it seems I
> might as well keep them together and grab them at the same time.

There're many way to describe the world. Do not worry about what the
only correct story you can tell.

Parent is a general form of father or mother relationship.

parent(One, Elder) :- father(One, Elder).
parent(One, Elder) :- mother(One, Elder).

One of one's parents is either one's father or mother. And parents can
be defined as:

parents(One, Elder_1, Elder_2) :- father(One, Elder), mother(One,
Elder).

Parents Elder_1 and Elder_2 are one's father and mother,
correspondingly.

On syntax, when you write a literal with the first letter lower-case,
it means an object/instance. For example, the nameKey written means
some thing named "nameKey." It seems you treat nameKey, fatherNameKey,
and motherNameKey as variables, which can be replaced by some things,
thus you ought to write NameKey, FaterNameKey, and MotherNameKey.

Jeff Gaines

unread,
Nov 17, 2009, 10:57:00 AM11/17/09
to
On 17/11/2009 in message
<a0ee55c5-4151-4546...@w19g2000pre.googlegroups.com>
YauHsienHuang wrote:

>There're many way to describe the world. Do not worry about what the
>only correct story you can tell.

OK, thank you :-)

>On syntax, when you write a literal with the first letter lower-case,
>it means an object/instance. For example, the nameKey written means
>some thing named "nameKey." It seems you treat nameKey, fatherNameKey,
>and motherNameKey as variables, which can be replaced by some things,
>thus you ought to write NameKey, FaterNameKey, and MotherNameKey.

In this case it is a list of facts and the various keys are what I use to
identify different people - usually surname+initials+Year of Birth which
so far has given me unique identifiers.

--
Jeff Gaines Dorset UK

There are 3 types of people in this world. Those who can count, and those
who can't.

0 new messages