Please conduct these tests before you turnin your program, to make sure that you have coded correctly. These 2 tests can be conducted once you have run the family.clp file from the Jess shell prompt using the "(batch ./family.clp)" command. Then do "(batch ./test1.clp)" and "(batch ./test2.clp)" to conduct these tests (in proper order - test1 followed by test2).
Test 1 - test1.clp
This test can be conducted by adding an additional relevant fact (Kimberley is the daughter of Leo):
(assert (gender Kimberley female))
(assert (father Leo Kimberley))
and testing new inferences. 15 new facts should be inferred (if you did not use any of your own predicates!). They are:
(MAIN::sister Kimberley Wendy)
(MAIN::sister Wendy Kimberley)
(MAIN::daughter Kimberley Leo)
(MAIN::niece Kimberley Gerald)
(MAIN::grandmother Grace Kimberley)
(MAIN::uncle Gerald Kimberley)
(MAIN::granddaughter Kimberley Grace)
(MAIN::greatuncle Paul Kimberley)
(MAIN::cousin Michelle Kimberley)
(MAIN::cousin Kimberley Michelle)
(MAIN::greataunt Harriet Kimberley)
(MAIN::cousin Marsha Kimberley)
(MAIN::cousin Kimberley Marsha)
(MAIN::greatgrandmother Jenny Kimberley)
(MAIN::greatgranddaughter Kimberley Jenny)
Test2 - test2.clp
This test involved testing with an additional query (who are the nieces?):
% define the query for finding whoever are whoever's niece's
(defquery find-nieces "find nieces" (niece ?X ?Y))
% run the query find-nieces
(bind ?it (run-query find-nieces))
% print out the results by iterating
(printout t "Who are nieces?" crlf)
(while(?it hasNext) (bind ?token (call ?it next))
(bind ?fact (call ?token fact 1))
(bind ?slot (fact-slot-value ?fact __data))
(bind ?datum1 (nth$ 1 ?slot))
(bind ?datum2 (nth$ 2 ?slot))
(printout t ?datum1 " is the niece of " ?datum2 ". " crlf))
(printout t " " crlf)
It should print 5 facts:
Kimberley is the niece of Gerald.
Wendy is the niece of Gerald.
Marsha is the niece of Leo.
Michelle is the niece of Leo.
Megan is the niece of Michelle.