Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Family Tree Suppose that we want to represent a family tree, so that we can ask questions like is john related to ..., or

The Family Tree

Suppose that we want to represent a family tree, so that we can ask questions like "is john related to ...", or "list all john's sisters" and so on. The basic entities will be people; the properties we will want to look at will be father, mother, brother, sister, aunt, uncle, grandmother, grandfather, mother_in_law, father_in_law, ancestor, descendent. Below you have three basic predicates, male, female and parent, which will describe a family by a series of facts. Take the following family tree as an example:

James I m. Claudia

|

|

+----------------+-----------------+

| |

Charles I m. Fay Elizabeth m. Paul

| |

| |

+----------+------------+ |

| | | |

Catherine Charles II James II Sophia m. Sam

|

|

|

George I

male(james1).

male(charles1).

male(charles2).

male(james2).

male(george1).

male(paul).

male(sam).

female(catherine).

female(elizabeth).

female(sophia).

female(claudia).

female(fay).

/* parent ( parent, child). */

parent(charles1, james1).

parent(elizabeth, james1).

parent(charles2, charles1).

parent(catherine, charles1).

parent(james2, charles1).

parent(sophia, elizabeth).

parent(george1, sophia).

Copy the above facts into notepad. Add rules to determine each of the following relationships:

  1. father
  2. mother
  3. brother
  4. sister
  5. aunt
  6. uncle
  7. grandmother
  8. brother_in_law
  9. mother_in_law
  10. father_in_law
  11. ancestor
  12. descendent

Note: You will NOT get credit for typing in the above relationships as facts.

Helpful hint: Think carefully about what makes someone an aunt.

Be sure to document your program using the standard heading. You do not need to include an input or output description. You DO need to explain what the program does (in your documentation). You do not need a friendly user interface.

Turn in

  1. a print out of your program (showing your documentation, the above facts and your rules).
  2. a screen capture of a run showing a test of each rule.

Please name your text file: family.pro

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago