Hi Scott,

On Mar 2, 2007, at 4:20 PM, Krasnigor, Scott L (N-AST) wrote:
In our application, we are dynamically creating and removing rules from the engine. We are sent a set of rules that are associated with a certain module based on parameters passed to us along with the rules. We are notified when a rule is no longer needed and we remove the rule (or rules) from the engine. What we would like to do is when a module no longer contains rules; we want to remove that module from the engine. IÂ’ve searched through the documentation/book/api but did not see a way to remove a module from the engine.
Right now Jess doesn't officially support undefining a module. There's no compelling reason so do so other than aesthetics; an empty module takes little space and no compute time.

I noticed in the mailing list that someone retrieved an iterator of modules and removed a particular one from the iterator using iterator.remove(). Is this the best way of removing modules or is there a more efficient way to accomplish this?
This is not supported, but it does work. If you do this when there are any rules defined in the module, then Bad Things will happen, so do it carefully.
Also, is there a simple way to determine if a module contains any rules? Thanks for any assistance.

The (rules) function takes a module name as an optional argument, and lists the rules in that module; but its actually implemented by calling Rete.listRules() and iterating through all the rules.

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550                 http://www.jessrules.com



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