Hi!
You have to use the definstance command in order to create a (shadow) fact representing your bean. Here is an appropriate Java method that does this job:
/**
* Rete Engine
*/
private Rete rete = new Rete();
...
/**
* definstance of object that supports <i>PropertyChangeListener</i>s
*/
public void definstance(String className, Object bean)
throws JessException
{
Funcall f = new Funcall("definstance", rete);
f.add(new Value(className, RU.ATOM));
f.add(new Value(bean));
f.execute(rete.getGlobalContext());
}
Greetings
Thomas
________________________________
Dipl.-Inform. Thomas Barnekow
Fraunhofer IAO, Competence Center Software Technology
| mail: | Nobelstra�e 12, D-70569 Stuttgart, Germany |
| phone: | +49 (0) 711 / 970 - 2346 |
| fax: | +49 (0) 711 / 970 - 2300 |
| mobile: | +49 (0) 172 / 7126018 |
| email: | [EMAIL PROTECTED] |
| web: | http://www.swt.iao.fhg.de |
| alan littleford <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 16.03.00 20:04
|
To: 'Jess Users' <[EMAIL PROTECTED]> cc: Subject: JESS: A problem with the OBJECT slot (?) |
I'm using 5.0 (_very_ nice job, Ernest) and I seem to be running into a
problem. I have a java bean -- B, and I defclass it:
(defclass C B dynamic). I then have a user function which creates a
fact, sets some slot values and asserts it:
f = new Fact("C", engine)
f.setSlotValue(..)
f.setSlotValue(..)
engine.assert(f)
So fas so good. In a rule set I acquire the fact ID for the asserted
fact. All the slots are there with all the right values except slot
OBJECT, which I thought should be a pointer back to the underlying
instance of B. However, for some reason it is the atom 'nill'
( I'm accesing it using (fact-slot-value (integer ?fid) OBJECT)).
Am I doing something obviously wrong?
Tnx
Alanl
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
