If the rules always store something, and you're finding nothing stored
on a particular iteration, then the logical conclusion is that the
rules didn't fire on that iteration. I would issue a "(watch all)"
command at the beginning of your program, and then examine the output
to find out what rules are firing, or not. Look at the trace of
shadow-facts being added and removed to see if the preconditions for a
particular rule exist when you think they do. Most likely it's a bug
in one of your rules.


And yes, of course you can call assert() and retract() as needed.

I think Calicrates Policroniades Borraz wrote:
> 
> Hi I'm building an application wich main() is in Java and that loads in
> runtime an script of Jess in a Rete object. Some beans are passed as facts
> to rete in this way:
> 
>             for(int i=0;i<myMemory.size();i++)  {
>                objInMemory = myMemory.recoverObject(i);
>                f = new Funcall("definstance", rete);
>                f.add(new Value("element", RU.ATOM));
>                f.add(new Value(objInMemory));
>                f.execute(rete.getGlobalContext());
>             }
> 
> Immediatly after this the program executes:
> 
>             rete.run();
> 
> Some rules are fired and the results are recovered using store and
> fetch commands. Finally the program clear the facts and storage in this
> way:
> 
>                rete.executeCommand("(undefinstance *)");
>                rete.clearStorage();
> 
> The program executes several times the previous part of code until a
> variable don't be true. The program begins running perfectly but in some
> part, with apparently no reason, the rete object seems to be dead because
> I don't recover nothing in the storage, the rules in the script are simple
> and are fixed to always return something in the storage (indeed with the
> idea of check it I only have 6 simple rules in the script without
> chaining). I am sure that I'm not losing the reference of the rete object.
> Am I doing something bad in the code showed previously? or Do you have any
> idea or suggestion about what is happening?
> 
> On the other hand, Is it valid to use assert and retract commands in the
> script and in the java program? For example, taking as base the previous
> code, after the run method I retract and assert some facts according with
> the results obtained in the storage. I dont think that this have problems
> but I'm not sure...
> 
> Thank you very much...
>  
> Calicrates...
> 
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 



---------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to