I¹ve read through the documentation, JESS in Action book, and mailing list
archive, and I can¹t seem to figure out this basic question:

        How do I assert facts from Java into different modules (or
??contexts??)?

To be more specific, the application is a discrete event simulation with
agents interacting with each other and objects in the environment.  Each
agent currently has two separate RETE engines, each with it¹s own CLP file
and only the MAIN module, and I use Œcall-on-engine¹ function calls to
coordinate between them.  While this functions correctly, it¹s cumbersome
and inefficient.  Plus I need to expand the categories of rules by two and
using the current scheme would get too complicated.

Most of the discrete event simulation happens in Java, with facts asserted
to the agents so they can react to the environment and each other.
Currently, this is how I assert facts:

> engine.assertFact(new Fact("found-something-interesting", engine));

I would like to move to an architecture where each agent has only one RETE
engine, one CLP file with multiple modules -- one module for each category
of rules.

But how do I assert the fact in a specific module?  Is it in the string
associated with the fact?

I found classdoc for ³public Fact assertFact(Fact f, Context c) throws
JessException -- Assert a fact, using the given execution context. ...², and
then tried to understand of Œexecution context¹ was the same thing as module
or focus stack or what.  The classdoc for Context was very unhelpful in this
regard.

Also, what¹s the difference between Œset-current-module¹ and Œfocus¹
functions?  When do you use one or the other?  I presume I¹ll be using java
methods Œengine.eval(³(focus BLARG)²);¹ if I need to change the current
module, but then what is Œset-current-module¹ for?

I really wish there was a complete worked example showing how to use a rule
set with multiple modules that are accessed and manipulated through Java.  I
need the ³dots² to be more ³connected².

Struggling,

Russ Thomas

Reply via email to