The simplest thing you could do is store all your definstanced objects
in a lookup table of some kind: a Java Hashtable, or the Jess (bag)
function. Use either the 'name' or the object itself as the key -
whatever you'll use to look them up. Then just retrieve them from the
table and set the properties at will. You could write 'warapper'
functiosn for definstance and undefinstance ("my-definstance") which
automatically stuck each definstanced object into the table.


I think S.S. OZSARIYILDIZ wrote:
> 
> Hi,
> 
> I want to change my objects attribute values in deffunction. For
> instance in the pump example it is written as a rule but what I want is
> to have a deffunction to modify that object's attributes a simple
> example is given. I wonder how i should modify it to get it work.
> 
> thanks.
> 
> (deffunction _modify (?oblect ?name ?slot ?value)
>   (if (eq ?object "pump") then
>     (pump (name ?name) (OBJECT ?pump))   ;;find the pump fact with the
> required pump name
>     (set ?pump ?slot ?value)                             ;;and set the
> slot with required value
> ))
> 
> somewhere in a rule
> 
> (_modify "pump" "pump1" flow 5)
> 
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to