Hello,

First I'm a new french user of Jess, so I don't speak english very, sorry
for the inconvenience.
I would like to fire rules with Java objects based facts.

Please let's considere the following object :
*       class A {
*               int num;
*               A (int newNum) { setNum (newNum); }
*               int getNum () { return num; }
*               void setNum (int newNum) { num = newNum; }
*       }
To put instances of it into facts, I made :
*       jess.Rete rete = jess.Rete();
*       A a1 = new Achat(1);
*       rete.executeCommand("(defclass a A)");
*       rete.store("A1", a1);
*       rete.executeCommand("(bind ?a (fetch A1))");
*       rete.executeCommand("(definstance a ?a static)");
So I have the following fact:
*       (a (class <External-Address:java.lang.Class>) (num 1) (OBJECT
<External-Address:A>))

Now I would like to create a rule which, for all "a" facts, do an action.
This is done by (for example) :
*       rete.executeCommand("(defrule write-a " +
*       "(a (num ?n)) => " +
*       "(printout t ?n crlf))");
Into the action, I can use "num" thanks to "?n".

BUT I do not know how to use the objet itself ! I would like to do something
"like" :
*       rete.executeCommand("(defrule write-a " +
*       "(?object = a) => " +
*       "(call ?object setNum 2))");

Do you know how to do ???

Thanks a lot

Jerome Poirier
[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