I think alan littleford wrote:
> 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?
Yes :)
You have to use "definstance," not "assert," to attach a Bean to Jess;
you also have to create the actual Bean yourself. So create the Bean,
set its slots (by calling the Bean's methods) then use definstance to
tell Jess about it; Jess will then in turn create the fact (rather
than the other way round!)
>
> Tnx
> Alanl
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [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 (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]
---------------------------------------------------------------------