Page 1 of 1

Posted: 26 Oct 2014 15:58
i need to solution for this question:
So we now want to rewrite our database using the following representation scheme:

Code: Select all

``   family([mom,dad],[[child1,female],[child2,male],[child3,male]]).``
Using the proposed scheme to represent the family database, write PROLOG definitions for each of the following predicates.

Code: Select all

``````   parent_of(Parent,Child)
father_of(Father,Child)
mother_of(Mother,Child)
ancestor_of(Ancestor,Descendant)      %% Should be recursive
sibling_of(Sib1,Sib2)
sister_of(Sister, Sibling)
brother_of(Brother,Sibling)
oldest_child (Parent,Oldest)
oldest_son (Parent,OldestSon)
oldest_daughter(Parent,OldestDaughter)
number_of_children(Parent,Num)        %% Should use the 'is' predicate
number_of_sons(Parent,N).
number_of_daughters(Parent,N).``````

i will pay if needed. i am despair.

tzuriely@gmail.com

### You list of list approach is too complicated

Posted: 27 Oct 2014 10:05
Your list of list approach is too complicated, and it does not handle more than 3 siblings.
I do not mention the patchwork families:
http://www.magyarulbabelben.net/works/e ... oc_lang=en Karinthy told to his wife: "My child and your child is beating our child."
The chronicle of my great-grandfather: X married with Y. Both of them had brought 4 children in the marriage and they had 4 common children.
The database should be very simple. It need not contain more than persons and primary relations:

Code: Select all

``````person(name,gender,date_of_birth).
parents(child,mother,father).``````
The siblings, grandsons, uncles, so on families must be results of query procedures based on simple rules:
L is younger brother of F if they have common mother and father and date_of_birth of L is later than that of F.

### Normal forms

Posted: 28 Oct 2014 8:11
Tz,
Have you ever heard of the 5 normal forms of the relational databases?
What is your mother language? Are the words for family relations the same as in English?
If not what are the differences?
Why have I recommended to include the date of birth in the facts?Imagine the following situation:
Hermine sister believes that she is a daughter of a Catholic priest and a nun. When she gets infected with Ebola the hospital makes a DNA test on her and an unknown woman laying in the neighboring bed. The DNA test shows that they are full sisters.
Think How many record should you correct in the family database if it is in your list of list structure and in the simple one i proposed in my previous answer?

Tricky example of dates:
Natasha is a smuggler between Alaska (USA) and Tchukchland (RU). She is crossing the Date Line at least twice on her daily route if the weather is calm. In case of stormy weather her ship is tossing across it much more times.
She is on her cabin cruiser when the Date Line separates 2000 Dec 31 and 2001 Jan 1.
She cannot rule the ship because she labors - twins. The elder twin is born in 2001 Jan 1 on the water territory of Russia, the younger twin is born in 2000 Dec 31 on the water territory of USA.
The real time difference is 15 minutes. The calendar difference is a millenium.