Hi!

Aloysius wrote:
> >     The thought is to find a way to keep rules as metadata. Each time an
> > application execute, rules will be loaded on the fly and object instance
> > will be asserted to match pattern. 
Chris wrote:
> I don't understand: "object instance will be asserted to match pattern."

Jess has this defclass/definstance mechanism which lets you define deftemplates from 
JavaBeans (using defclass) and shadow facts backed by JavaBean instances (using 
definstance), where Bean properties correspond to slots. 

> >So instead of having "if" in source code,
> > we will have them loaded each time and match.

Do you really mean to load the rules "each time" you have to process your instances? 
Why would you do that. I understand that there might be some optimization potential in 
not loading rules that can't be applied. But selecting (and compiling) rules to 
frequently, potentially for each run call, can't be very performant.

> I'd appreciate knowledgable jess users checking my possibly wrong
> mental model of jess, and relating it to Aloysius' requirements.
> 
> Pseudo code of jess engine:
> 
> Repeat
>     matching(fixed-ruleset, present-condition-set);
>     resolve-possible-multi-match-conflict;
>     update(present-condition-set, chosen-matched-rule)
> Until GoalState OR noMatch.

This is basically what happens. In the Rete algorithm your first and second step are 
performed when asserting facts. That is, facts are "sent to the Rete network" which 
does pattern matching (fatcs are compared to the LHS patterns) and activates rules, 
yielding a list of activations, which is sorted according to the rules' salience 
definitions. When the engine is run, activated rules are fired, i.e., the RHS is 
executed. On the RHS facts can be asserted or retracted, creating new or removing 
existing activations.

Rete.assert method:

        matching(fixed-ruleset, present-fact-set);
        resolve-possible-multi-match-conflict;

Rete.run method:

        FOR EACH activation IN list-of-activations DO
           activation.fire();   
        END

> I understand that the original post required to know which
> rule had been selected, at each matched cycle. How does this relate to
> Aloysius' problem description above?

That's exactly what I did not understand either.

Thomas

P.S.: Chris wrote:
> {Although I've not yet installed/run jess (nor any java) } ...

You should really try both Jess and Java. It's fun ;-)
---------------------------------------------------------------------
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