Re: JESS: Modify in template

2007-07-18 Thread M Ismail
many thanks for the replay. Bobs list is working fine but i am also 
interested in how defrule my-rule works. how can i use it?


(defrule my-rule
?fact - (objects (o_id 90)))
=
(modify ?fact (o_description NoKnife)))

regards,
M.ismail

From: Ernest Friedman-Hill [EMAIL PROTECTED]
Reply-To: jess-users@sandia.gov
To: jess-users@sandia.gov
Subject: Re: JESS: Modify in template
Date: Tue, 17 Jul 2007 12:34:47 -0400

To add one more option to Bob's list: as Jess is, after all, a rule- based 
language, the intent is that most of the time you'll be doing  this sort of 
thing from a rule.


(defrule my-rule
?fact - (objects (o_id 90)))
=
(modify ?fact (o_description NoKnife)))


On Jul 17, 2007, at 11:14 AM, Robert Kirby wrote:

The modify function expects at least two parameters: the first is  the fact 
to be modified and the rest are slot name and modification  value pairs.  
If your Java code has the fact-id, then it could be  inserted into the 
string passed to executeCommand (which is  deprecated in 7.0 for eval).  
For instance, if the fact-id for  o_id==90 were 20090, then

  r.eval((modify 20090 (o_description NoKnife)));
should work.

A Jess query could look up the fact within a function:
(defquery object-id-query
Look up fact id.
(declare (variables ?id))
?fact - (objects (o_id ?id)))
(deffunction modify-object-description
Modify objects instance description
(?id ?description)
(bind ?results (run-query* object-id-query ?id))
(?results next)  ; Assumes exactly one objects instance with ?id
(modify (?results get fact) (o_description ?description))
(close ?results)
nil)

then run
  r.eval((modify-object-description 90 NoKnife));

Bob Kirby

At 04:19 AM 7/17/2007, M Ismail wrote:

Hi,
i am using a template:

(deftemplate objects
(slot o_id)
(slot o_description)
(slot o_is_visible)
(slot o_makes_sound)
(slot o_sound_volume)
(slot o_framenumber)
)

and i want to modify the o_decription of the object with o_id = 90
how can i do that?  if i use:

r.executeCommand((modify (objects (o_id 90) (o_description  NoKnife;

then i get errors and it doesnt work

best regards,
M. Ismail

_
Het meest spraakmakende nieuws vind je op www.msn.nl http:// www.msn.nl



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 owner-jess- [EMAIL PROTECTED]



-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.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]


_
Wil jij MSN reporter zijn? Deel jouw nieuws en verhalen hier! 
http://reporter.msn.nl/



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]




Re:Re: JESS: How to broadcast modified facts in multi-thread environment

2007-07-18 Thread tanming_tanming
Thank Ernest ,may be just use one object in the server is good for my 
system.But ,I still want to know if Jess has the property that I pointed 
previously: 1)How does other jess objects notes the facts has  been modified 
and to reload it 
2007-07-18,Ernest Friedman-Hill[EMAIL PROTECTED]
Why would you want every user to have their own Jess object if 
they're all going to have the same set of rules and facts? If that's 
the case, why not just use one object in the server?
On Jul 17, 2007, at 5:33 AM, tanming_tanming wrote:
 Hi,

  I want to use Jess in multi-thread environment,So may be every 
 user have it's own Jess Object which has the same JESS facts. At 
 the same time ,each user could modify the facts.

 Now ,my question is, 1)How does other users notes the facts has 
 been modified and to reload it.

 By the way, I use jess command load-facts to load facts from a 
 file and save them with save-facts.I have pasted some fragment of 
 my rules file below.
 In java ,I use RMI as server to run system like this:
  
  Rete m_rete = new Rete();
  m_rete.batch(rule.clp);
  m_rete.run();
  .
 Any comments or examples will be very appreciated.

 Sincerly,
 Henry,Tan


 rule.clp
 (import my.jess.*)
 (deftemplate node  (declare (from-class Node)))
 (defrule initialize-1
(not (start))
=
(load-facts animal3.dat)
  (assert (start)))
 (defrule no-more
?phase - (no-more)
=
(save-facts animal3.dat node next-gensym-idx))
 (defrule replace-answer-node
?phase -(replace-answer-node ?name)
?data - (node (name ?name)
   (type answer)
   (answer ?value))
 ?answer-(answer ?question)
=
   ; Create the new learned nodes
(bind ?newnode1 (gensym*))
(bind ?newnode2 (gensym*))
(modify ?data (type decision)
  (question ?question)
  (yes_node ?newnode1)
  (no_node ?newnode2)
(answer nil))
(assert (node (name ?newnode1)
  (type answer)
  (answer ?new-animal)))
(assert (node (name ?newnode2)
  (type answer)
  (answer ?value

 ---
-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.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]


JESS: Problems using jess in pda

2007-07-18 Thread Sasigain Usoa
Hello:

I am using jess in an agent platform created by JADE. I have no problems
when the agents that use the rules are in a pc, but when I try to do the
same in a pda with a j9 java virtual machine I get the error reported
above at the line code:

Rete rete=new Rete();

The error that I get is the next one:

* Uncaught Exception foe agent asistentePDA 

Java.lang.NoSuchMethodError:
java/lang/Boolean.valueOf(Z)Ljava/lang/Boolean;
at jess.d1.a(Unknown Source)
at jess.d1.init(Unknown Source)
at jess.Rete.init(Unknown Source)
at jess.Rete.init(Unknown Source)
at jess.Rete.init(Unknown Source)
at agentAsistente.AsistenteAgente.init(Unknown Source)

*

I am not really sure if this error is because of Jess or not, but if
anyone can give me some kind of a solution or information it would
really help me.
Just in case, the device's OS is windows mobile 5 and the version of
j9 java virtual machine ibm-weme-wm5-ppro10, I am using Jess70p1.

Thank you very much!!
Usoa.




Re: JESS: Problems using jess in pda

2007-07-18 Thread Ernest Friedman-Hill
J9 is a J2ME JVM; it implements the limited J2ME apis, which are  
incompatible with the standard Java APIs that Jess is written for.  
The standard version of Jess doesn't run on J2ME; you'll find this to  
be the case for most third-party libraries.


You might look at a J2SE JVM for small devices, like MySaifu.


On Jul 18, 2007, at 11:46 AM, Sasigain Usoa wrote:


Hello:

I am using jess in an agent platform created by JADE. I have no  
problems when the agents that use the rules are in a pc, but when I  
try to do the same in a pda with a j9 java virtual machine I get  
the error reported above at the line code:


Rete rete=new Rete();

The error that I get is the next one:

* Uncaught Exception foe agent asistentePDA 

Java.lang.NoSuchMethodError: java/lang/Boolean.valueOf(Z)Ljava/lang/ 
Boolean;

at jess.d1.a(Unknown Source)
at jess.d1.init(Unknown Source)
at jess.Rete.init(Unknown Source)
at jess.Rete.init(Unknown Source)
at jess.Rete.init(Unknown Source)
at agentAsistente.AsistenteAgente.init(Unknown  
Source)
** 
***


I am not really sure if this error is because of Jess or not, but  
if anyone can give me some kind of a solution or information it  
would really help me.


Just in case, the device's OS is windows mobile 5 and the version  
of j9 java virtual machine ibm-weme-wm5-ppro10, I am using Jess70p1.


Thank you very much!!
Usoa.




-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.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]




JESS: modifying facts

2007-07-18 Thread Krasnigor, Scott L (N-AST)
I have track kinematic data in working memory. When a track's kinematics
are updated, I need to modify the associated kinematic data in working
memory. I tried using the add method, however, looking at the watch
statements, new facts were being created instead of modifying the
existing facts. I realized the user is creating new kinematic objects
for each update instead of using existing objects so that I am unable to
use add to update existing kinematic facts in working memory. I am
curious what would be the most efficient way to perform this update.
Thanks for any assistance.

 

Scott