Hi,
I am new to JESS and want to use JESS for a requirement by enbedding into a
java application.
My requirement in brief is like following (Below, be application I mean the
core application I have already in place wherein I want to embed JESS):
1. Let the application users define the rules and conditions and user's list
as a result for each rule. And the conditions are built from the data
existing or created in the java application for eg. users, properties etc.
2. Create JESS laguage file from these conditions coming from application
UI(Alternatively use java to create or execute rules from this data whenever
I want to evaluate the rules).
3. Use the data created in application to match the conditions in the rules,
return a list of users for each rule fired.

Now following are some questions I have:
1. Since the rules defined are being applied to any data, I want the rules
to be created once and shared by different sessions for different data. For
eg there can be a rule which says if total > 100 then return list of users
u1, u2 and u3. Now for different organizations total can be different and
each organization can run rules engine with its own data but the rules
themselves are same so I want to share them across different organizations.
Each organization will have its own session and data and the same rules in
the memory are executed with this data.
What I found in Jess docs was, you need to initialize the rule engine by
using new Rete(); and add the rule language file (*.clp) and the data to the
working memory. But like in above example, if I want to add the data for
some other organization but for the same rules then I need to create another
instance of Rete and provide the rule language file to it in which case I
end up having one file in working memory for each organization. Is there any
way to avoid this and share the file for different data or for different
sessions?
2. As per my understanding, the only way to control the flow of rules
execution is by creating different modules. If I have a condition like if
Module_1 fires (i.e at least one rule from module is fired) the focus
module_2 else focus module_3. This conditions can get even more complex. And
also note that all rules from module_1 should get fired so I can't have
focus statement in action part of any rule of module_1 since it will
immediately focus to new module and other rules from module_1 would be
skipped. Currenly I am planning to do it by having a global variable for
each such condition. For eg if any rule from module_1 is fired then make
this variable true and use it for further control. But as the conditions
become more and more complex and provided that I want to create the language
through some apis against using an existing one; I am not sure how much
feasible this would be. Any suggestions on this?
3. I want to have some modules (which would be set of rules) which are
exclusive i.e. only one of them should fire even if others also match. I can
do this with auto-focus for the first rule in each module but how to avoid
others from firing. I tried halt but didn't work. Retracting the facts as
soon as they fire is not a feasible option since the same fact might be used
in some other rule in the same module which I still want to fire.

Any help in above ragards would be really appreciable.
Thanks in advance,
- Deepak

Reply via email to