Points 50
Deadline Feb. 5

CSC 481 Winter 2001 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).

You must submit the following items:

  1. a file containing the knowledge base (facts and rules) for the family tree
  2. a file with test runs for each of the requested relationships
  3. a README file with instructions for using your program

I will use the following grading guidelines:

  1. 30 points in total for the correct formulation of the relationships (i.e. about 4 points per relationship)
  2. 15 points for the test runs (about 2 points per relationship)
  3. 5 points for the README file and documentation of the source code
;;;======================================================
;;;   	Family Tree
;;;     
;;;		Describes extended family relationships
;;;     (sister, brother, grandparent, grandmother, grandfather,
;;;		uncle, aunt, cousin, ancestor, in-law)
;;;     
;;;
;;;     
;;;
;;;     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 wife-of 	(slot wife) 	(slot husband))
(deftemplate husband-of (slot husband) 	(slot wife))
(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 "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"))
  (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 "Irmgard")))


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

(defrule sister		"same father, mother; female"
	(father-of (father ?fa) (child ?name1))
	(father-of (father ?fa) (child ?name2&~?name1))
	(mother-of (mother ?mom) (child ?name1))
	(mother-of (mother ?mom) (child ?name2&~?name1))
	(female (person ?name2))
	=>
	(printout t ?name2 " is the sister of " ?name1 crlf))



Web pages Copyright © 1996-2001, Franz J. Kurfess, Email: fkurfess@csc.calpoly.edu
Last modified: Thu Jan 18 15:47:41 PST 2001