A Jess definstance is a little more like a 'deffacts' than just
asserting a fact, in that (reset) does not make them go away. To
forget one completely, use (undefinstance) or (retract) (which will
both have the same effect - telling Jess to completely forget about
the Bean. )

My first version of Bean matching in Jess let reset clear all
definstances, and this turned out to be very unintuitive, at least for
me, so I changed the behviour.

I think Kathy Lee Simunich wrote:
> 
> I've created a loop in which I read a record from an oracle database,
> create a java bean class, set a variable (which has been defclass'd
> within a jess file).  Then I call reset, Funcall (to call the
> definstance
> function to pass in the object), then call run.
> 
> My question is:  am I using the reset properly?  I thought that by
> calling reset, it would erase the previous definstance, so that the
> engine would run only on the current definstance.  I put in a (watch
> all),
> and it is showing that I'm collecting all the instances, and the engine
> is firing upon them all each time I call run.
> 
> Is there some other way I'm supposed to delete the definstances?
> 
> Thanks for any help,
> 
> KathyLee Simunich
> Decision & Information Sciences Division
> Argonne National Lab
> 
> ----code segment follows-----
> 
>         for (int i= 0; i < numrecs; i++) {
>             ccc = (String)fieldReturns[0].get(i);  // field from oracle
> db
> 
>             // create the bean
>             tRec = new TRecord();
>             tRec.setCCC(ccc);
> 
>             // assert the facts, and execute manually.
>             try {
>                 rete.executeCommand("(reset)");
> 
>                 // Tell Jess about the bean
>                 Funcall f = new Funcall("definstance", rete);
>                 f.add(new Value("tRec", RU.ATOM));
>                 f.add(new Value(tRec, RU.EXTERNAL_ADDRESS));
>                 f.simpleExecute(f, rete.globalContext());
> 
>                 // now run on the new definstance
>                 rete.executeCommand("(run)");
>             } catch (ReteException re) {
>                 re.printStackTrace(nd.stderr());
>             }
>         }
> 
> 
> ---------------------------------------------------------------------
> 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: (510) 294-2154
Sandia National Labs                FAX:   (510) 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