how to define Uncle rule

The Boy
  • The Boy

    The Boy - 2009-03-27

    Hello all,
    please I am new in CLIPS and I would like to define the following rule in CLIPS:
    if x has father y and y has brother z then
    x has uncle z.

    I assume that I define a class Person. so x, y and z are instances of Person,

    Thanks in advance for your help.


    • Gary Riley

      Gary Riley - 2009-05-04

      (defrule find-uncle
         (object (is-a PERSON) (name ?person) (father ?father))
         (object (is-a PERSON) (name ?father) (brothers $? ?brother $?))
         (printout t ?brother " is the uncle of " ?person crlf))


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks