Or slightly better (?) and only prints once:

(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)
=>
  (assert (sibling-of ?x ?y))
)

(defrule print-siblings-only-once
  (declare (salience -100))
  ?f1 <- (sibling-of ?x ?y)
  ?f2 <- (sibling-of ?y ?x)
=>
  (printout t ?x " is a sibling of " ?y crlf)
  (retract ?f1)
  (retract ?f2)
)

(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]
---------------------------------------------------------------------

---------------------------------------------------------------------
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