;;;====================================================== ;;; Relative Identification Expert System ;;; ;;; A simple expert system which attempts to identify ;;; relatives of people based on their relationships. ;;; ;;; CLIPS Version 6.0 Example ;;; ;;; To execute, merely load, reset, and run. ;;;====================================================== (defrule spouserule ; reflexivity of spouses (spouse ?sp1 ?sp2) => (assert (spouse ?sp2 ?sp1)) ) (defrule parent1 ; at least step-parent if your spouse is a parent of them (spouse ?sp1 ?sp2) (parent ?sp2 ?child) => (assert (parent ?sp1 ?child)) ) ;;; MAR - added 6/23/05 (defrule parent2 ;; at least a step parent if you child is a sibling of them (parent ?par ?child1) (sibling ?child1 ?child2) => (assert (parent ?par ?child2) ) ) (defrule sibling " reflexivity of sibling" (sibling ?per1 ?per2) => (assert (sibling ?per2 ?per1)) ) (defrule sibling2 " at least a half sibling if share a parent " (parent ?par ?child1) (parent ?par ?child2&~?child1) ;; this makes sure it isn't the same child ;; without it, happily infers that child is sibling to themself => (assert (sibling ?child1 ?child2) (sibling ?child2 ?child1) ) ) (defrule uncle1 " uncle if male and your sibling is a parent of the child " (male ?per) (sibling ?per ?par) (parent ?par ?child) => (assert (uncle ?per ?child) )) (defrule uncle2 " uncle if male and your spouses sibling is a parent of the child " (male ?per) (spouse ?per ?sp) (sibling ?sp ?par) (parent ?par ?child) => (assert (uncle ?per ?child) )) (defrule aunt1 " aunt if female and your sibling is a parent of the child " (female ?per) (sibling ?per ?par) (parent ?par ?child) => (assert (aunt ?per ?child) )) (defrule aunt2 " aunt if female and your spouses sibling is a parent of the child " (female ?per) (spouse ?per ?sp) (sibling ?sp ?par) (parent ?par ?child) => (assert (aunt ?per ?child) )) (defrule nephew1 " nephew if male and your parent is sibling of the person " (male ?child) (sibling ?per ?par) (parent ?par ?child) => (assert (nephew ?child ?per) )) (defrule nephew2 " nephew if male and your parent is a sibling of the person's spouse " (male ?child) (spouse ?per ?sp) (sibling ?sp ?par) (parent ?par ?child) => (assert (nephew ?child ?per) )) (defrule neice1 " neice if female and your parent is sibling of the person " (female ?child) (sibling ?per ?par) (parent ?par ?child) => (assert (neice ?child ?per) )) (defrule neice2 " neice if female and your parent is a sibling of the person's spouse " (female ?child) (spouse ?per ?sp) (sibling ?sp ?par) (parent ?par ?child) => (assert (neice ?child ?per) )) ;;; grandparent ;;; cousin