Title: RE: JESS: defrule: checking condition of a slot of type instance

Put a function call on the LHS inside the test (test (eq (slot-get ?x cname) "Mike")) and it will work.

Olga Medvedeva

-----Original Message-----
From: Mike Geide [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 05, 2004 10:31 AM
To: [EMAIL PROTECTED]
Subject: JESS: defrule: checking condition of a slot of type instance


Hi All-

I am using JessTab and am new to JESS, and would greatly appreciate a nudge in
the right direction.  I am trying to do a simple operation, but having no
success.


Given:
Protege class A which contains (among other slots) slot b which is of type
Instance of class C.  Class C contains slot cname.

Problem:
How do you write a JessTab rule to fire when a certain class C instance occurs
in class A's slot b?

I've tried (among other things):

(mapclass :THING)

(defrule AbC
        (object (is-a A)(b ?x))
        ?y <- (slot-get ?x cname)
        (test (eq ?y "Mike"))
=>
(printout t "Mike exists in class A." crlf))

(run)

; Results in 0 (never fired, though the condition is true)


Many thanks,
Mike Geide

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