Hallo!

I think I can help you on that!

JessTab always assigns an OBJECT slot you can use to query the asserted
instance. So the LHS would look like this:

(defrule change_relation
(object (is-a Customer) (hasCurrentState ?state))
(object (is-a Customer-State) (OBJECT ?state) (:NAME "Customer Ready"))
?other_state <- (object (is-a Customer-State) (:NAME "Customer Waiting"))
=>

This rule will fire on every customer that has the customer state "Customer
Ready" and will also give you a handle to the other state. Now use slot-set
to change the value.

Greetings Christoph

-----Original Message-----
From: Shahab1355 [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 24. April 2007 22:03
To: [email protected]
Subject: JESS: Problem in writing a rule


Hi everyone,
I am new to jess and JessTab. I have a problem in writing rule chnaging
relation between instances.
I have mapped class Customer  to in JessTab and it has one instance
"Customer_Inst" :
(MAIN::object (is-a Customer) (is-a-name "Customer") (OBJECT
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>)

(:NAME "Customer_Inst") (hasEntityName "Customer")  (hasCurrentState
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>)
))

in which customer has a multislot "hasCurrentState" refering to an instance
of class Customer_State , Class Custimer_Sate also has mapped in Jesstab and
it has two instances : "Customer_Ready", "Customer_Waiting"

(MAIN::object (is-a Customer_State) (is-a-name "Customer_State")  (:NAME
"Customer_Ready") ))
(MAIN::object (is-a Customer_State) (is-a-name "Customer_State")  (:NAME
"Customer_Waiting") ))

the hasCurrentState slot of "Customer_Inst" has already initilaized with
"Customer_Ready" . Now I want to write a rule in which such that: 
if  (hasCurrentSate Customer_Inst Customer_Ready) then  (hasCurrentSate
Customer_Inst Customer_Waiting)

In otherwords, I just want to break the old relation and  assign new
realtion. I can do this easily if hasCurrentState take "string" type, but I
couldn't write similar rule for Instance type.

I do appreciate your help,

Shahab

-- 
View this message in context:
http://www.nabble.com/Problem-in-writing-a-rule-tf3640907.html#a10168330
Sent from the Jess mailing list archive at Nabble.com.

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