2011/8/1 Matthew Erler <wires8(a)yahoo.com>
The first thing that the service method needs to do is clear out all
the
facts inserted during the last service method invocation. I use
StatefulKnowledgeSession.insert(Object fact) to add facts and
StatefulKnowledgeSession.getAgenda().clear() to clear out all facts.
The Agenda is where all *rule activations* live. Facts are reachable via the
kSession object, e.g., kSession.getFactHandles(), and you could use
retract() on them. But note well that retracting facts is not a free lunch:
each one updates the Rete network.
Calling kSession.dispose() and kBase.newStatefuleKnowledgeSession() is a
perfectly reasonable way to clear the ring for the next round.
-W