Points 25
Deadline Jan. 30

CSC 481 Winter 2002 Assignment 1

Below you find a partial listing for a CLIPS knowledge base on family relationships. Your task is to complete the rules so that the following relationships are covered: In case of doubt, specify the exact relationship as a comment in the rule. You may replace or enhance the facts about the persons (e.g. by using your own or some other family, or the cartoon characters from the CSC 480 homework assignment).

You must submit the following items:

  1. a diagram of the family tree you're using
  2. a file containing the knowledge base (facts and rules) for the family tree
  3. a file with at least one test run for each of the requested relationships
  4. a README file with instructions for using your program

I will use the following grading guidelines:

  1. 5 points for the tree diagram
  2. 13 points in total for the correct formulation of the relationships
  3. 5 points for the test runs
  4. 2 points for the README file and documentation of the source code

;;;======================================================
;;;   	Family Tree
;;;     
;;;		Describes extended family relationships
;;;     (sister, brother, grandparent, grandmother, grandfather, etc.)
;;;     
;;;
;;;     
;;;
;;;     CLIPS Version 6.0 Example
;;;
;;;     To execute: Load, reset and run.
;;;======================================================


;;;*************
;;;* TEMPLATES *
;;;*************

(deftemplate father-of 	(slot father) 	(slot child))
(deftemplate mother-of 	(slot mother) 	(slot child))
(deftemplate parent-of  (slot parent)   (slot child))
(deftemplate sister-of  (slot sister) 	(slot sibling))
(deftemplate brother-of (slot brother) 	(slot sibling))
(deftemplate aunt-of    (slot aunt) 	(slot nephew-or-niece))
(deftemplate uncle-of   (slot uncle) 	(slot nephew-or-niece))
(deftemplate cousin-of  (slot cousin-1) (slot cousin-2))
(deftemplate grandfather-of (slot grandfather) (slot grandchild))
(deftemplate grandmother-of (slot grandmother) (slot grandchild))
(deftemplate grandparent-of (slot grandparent) (slot grandchild))
(deftemplate wife-of 	(slot wife) 	(slot husband))
(deftemplate husband-of (slot husband) 	(slot wife))
(deftemplate ancestor-of (slot ancestor)(slot person))
(deftemplate male 	(slot person))
(deftemplate female 	(slot person))

;;;*****************
;;;* INITIAL STATE *
;;;*****************

(deffacts family
  (father-of (father "Franz Xaver") (child "Franz Anton"))
  (father-of (father "Franz Xaver") (child "Erwin"))
  (mother-of (mother "Josefine") (child "Franz Anton"))
  (mother-of (mother "Josefine") (child "Erwin"))
  (father-of (father "Xaver") (child "Margarethe"))
  (father-of (father "Xaver") (child "Anna"))
  (mother-of (mother "Maria") (child "Margarethe"))
  (mother-of (mother "Maria") (child "Anna"))
  (father-of (father "Franz Anton") (child "Franz Josef"))
  (father-of (father "Franz Anton") (child "Hubert"))
  (father-of (father "Franz Anton") (child "Bernhard"))
  (father-of (father "Franz Anton") (child "Heinrich"))
  (father-of (father "Franz Anton") (child "Irmgard"))
  (mother-of (mother "Margarethe") (child "Franz Josef"))
  (mother-of (mother "Margarethe") (child "Hubert"))
  (mother-of (mother "Margarethe") (child "Bernhard"))
  (mother-of (mother "Margarethe") (child "Heinrich"))
  (mother-of (mother "Margarethe") (child "Irmgard"))
  (wife-of (wife "Margarethe") (husband "Franz Anton"))
  (husband-of (husband "Franz Anton") (wife "Margarethe"))
  (father-of (father "Erwin") (child "Josef"))
  (father-of (father "Erwin") (child "Klaus"))
  (father-of (father "Erwin") (child "Markus"))
  (father-of (father "Erwin") (child "Annemarie"))
  (father-of (father "Erwin") (child "Regina"))
  (father-of (father "Erwin") (child "Roswitha"))
  (mother-of (mother "Anna") (child "Josef"))
  (mother-of (mother "Anna") (child "Klaus"))
  (mother-of (mother "Anna") (child "Markus"))
  (mother-of (mother "Anna") (child "Annemarie"))
  (mother-of (mother "Anna") (child "Regina"))
  (mother-of (mother "Anna") (child "Roswitha"))
  (wife-of (wife "Anna") (husband "Erwin"))
  (husband-of (husband "Erwin") (wife "Anna"))
  (male (person "Franz Anton"))
  (male (person "Erwin"))
  (male (person "Franz Josef"))
  (male (person "Hubert"))
  (male (person "Bernhard"))
  (male (person "Heinrich"))
  (female (person "Margarethe"))
  (female (person "Anna"))
  (female (person "Irmgard")))
   ..

;;;******************
;;;* RULES 			*
;;;******************

(defrule mother-is-parent
	(mother-of (mother ?mom) (child ?child))
	=>
	(assert (parent-of (mother  ?mom) (child ?child)))
	(printout t ?mom " is a parent of " ?child crlf))


Web pages Copyright © 1996-2002, Franz J. Kurfess, Email: fkurfess@csc.calpoly.edu
Last modified: Fri Jan 18 18:46:20 PST 2002