I think Govoni, Darren wrote:
[Charset windows-1252 unsupported, filtering to ASCII...]
> Hi, 

>     Newbie question here. How can I execute rete from Java and get
> just the list of facts that where triggered from rules? I was
> expecting to see a run() method with an Iterator return value or
> something similar. Is there an easy way to do this? Sorry if I
> missed something obvious in the docs.

Rete.listFacts() is such a method; it returns all the facts in working
memory. Since rules can remove, modify, or add to working memory
during a run, a method which just specifically returns "new" facts
wouldn't be generally useful.

If working memory is too large for you to iterate through the whole
thing, then there are many other options. You can use a query to
collect them, of course, or you can be proactive about it and have the
rules do something besides just assert the facts. For example, a rule
might call a Java method of your own devising named "addResultFact()"
or something to register an asserted fact (or other object) as being
of interest to your application.

>     Also, I would like to retract a set of existing facts easily in
> Jess. Is performing a query and binding each fact to a variable
> ?fact and then calling retract the best approach? Thanks!

You could use query, a rule which would fire once for each fact to be
removed, or again, the listFacts() method.


---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

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