JESS: Module Question

2005-09-14 Thread Krasnigor, Scott L (N-AST)
Title: Module Question






Hi all,


Quick question. I have a set of rules that I use as a template. I plan on having a user be able to define a region in space. Based on the values entered, the app will modify the set of rules in the template and save it as a new set of rules based on the region defined and then load those rules into a running engine thread. There can be multiple sets of regions defined and associated rules applied. Once a fact is asserted, the rules determine if the data associated with the fact are in a defined region. I need to be able to distinguish between the different rule sets (regions) in an engine. I was thinking of creating modules based on the different regions. Is this the most efficient way to do this? How would I make sure that once a fact is asserted (or modified), it gets evaluated for all the regions (modules) defined? Thanks.

Scott


Scott L. Krasnigor

Principal Engineer/Scientist

Atlantic Science & Technology

Lockheed Martin - MS2

' 856-359-3094

* [EMAIL PROTECTED]

* 770-2






Re: JESS: Module Question

2005-09-14 Thread Alan Moore

Scott,

My advice is to make your Regions explicit instead of using modules for 
this purpose.


You could create a Region class (in Java), create instances of these 
objects and definstance them as needed. Your rules could then pattern 
match against these Region objects.


This is essentially making explicit something that would happen 
implicitly via modules, with the added advantage of being able to 
define/control all the behavior related to the Regions w/o relying on 
Jess' rule firing mechanisms.


I did a similar thing with state machines. Initially, I wanted to use 
modules because they were there but other pieces of Java code needed to 
have access to the current state, etc. and I found having these defined 
as Java objects made that integration easier. Your mileage may vary 
depending on how Java centric your application is.


Of course you could use deftemplates instead of POJOs because the 
explicit vs. implicit design still applies.


Good luck!

alan


Krasnigor, Scott L (N-AST) wrote:

Hi all,

Quick question. I have a set of rules that I use as a template. I plan 
on having a user be able to define a region in space. Based on the 
values entered, the app will modify the set of rules in the template and 
save it as a new set of rules based on the region defined and then load 
those rules into a running engine thread. There can be multiple sets of 
regions defined and associated rules applied. Once a fact is asserted, 
the rules determine if the data associated with the fact are in a 
defined region. I need to be able to distinguish between the different 
rule sets (regions) in an engine. I was thinking of creating modules 
based on the different regions. Is this the most efficient way to do 
this? How would I make sure that once a fact is asserted (or modified), 
it gets evaluated for all the regions (modules) defined? Thanks.


Scott

Scott L. Krasnigor
Principal Engineer/Scientist
Atlantic Science & Technology
Lockheed Martin - MS2
' 856-359-3094
*_ [EMAIL PROTECTED]
* 770-2




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]