Here is an ugly version that works (I think...):

(deffacts list
  (parent-of bob john)
  (parent-of bob mary)
  (parent-of sue john)
  (parent-of sue mary)
)

(defrule find-siblings
  (parent-of ?x ?a)
  (parent-of ?y&~?x ?a)
=>
  ;; this relies on facts *not* duplicating
  (assert (sibling-of ?x ?y))
)

(defrule print-siblings
  ?f <- (sibling-of ?x ?y)
=>
  (printout t ?x " is a sibling of " ?y crlf)
)

(defrule retract-siblings
  (declare (salience -100))
  ?f <- (sibling-of ?x ?y)
=>
  (retract ?f)
)

(reset)
(run)


alan


-----Original Message-----
From: Archana Raghavendra [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 8:44 PM
To: [EMAIL PROTECTED]
Subject: JESS: Qst abt an application.


Hi all,
        i am new to jess and am having problems with this.I create a .clp
file which is like this.

(deffacts list
(parents-of bob john mary)
(parents-of sue john mary)
(siblings hansel gretel)
)

(defrule  find-siblings
(parents-of ?x ?a ?b)
(parents-of ?y ?a ?b)
=>
(printout t ?x ?y))

(reset)
(run)

when i run this, I get 4 combinations,
bob and bob 
bob and sue
sue and sue
sue and bob

whereas I only want one.
bob and sue OR sue and bob.

Archana

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to