Re: [PRD] Default conflict resolution strategy (ISSUE-64) (Was; Re: [Fwd: Re: PRD Review])

Gary Hallmark wrote:
>>
>> Mark Proctor wrote:
>>>
>>> Refaction in JRules is the same as jess/clips/drools no-loop. 
> 
> I'd be surprised if it is exactly the same.   What do you expect from 
> the following ruleset:
> 
> p(1)
> q(1)
> q(2)
> (* rule1[loop->false] *)
> Do(external(print("rule1 fired, ?x=" ?x))) :- q(?x)
> (* rule2[loop->false] *)
> Do(Retract(p(1)) p(1) external(print("rule2 fired, ?x=" ?x))) :- 
> And(p(1) q(?x))

I guess you mean:
rule1: if q(?x) then print("rule1 fired, ?x=" ?x)
rule2: if p(1) and q(?x) then Retract(p(1)), Assert(p(1)), print ("rule2 
fired, ?x=" ?x)

Hey, Gary, this is not in the spec, you can write them rules in a way 
that makes sense :-)

> With Oracle/Jess, you get
> rule2 fired, ?x=2
> rule1 fired, ?x=2
> rule1 fired, ?x=1

With JRules, you bind only objects, so, the example does not really work.

But if you could bind primitive data types, (I have to check, but I 
think) that you would fire rule2 with ?x=1 as well. And that is 
certainly what you would get with the semantics that was described in PRD.

> The semantics of Oracle/Jess is that a rule's actions cannot re-activate 
> that rule.  Initially, because of the input data, rule1 and rule2 each 
> have 2 activations.  When rule2 fires, the retraction removes the other 
> rule2 activation.  The assert action cannot reactivate rule2 because of 
> the no-loop property.

I do not understand that. I mean, I do not understand the intended 
behaviour: do you mean that p(1) after rule2 has been fired is distinct 
from p(1) before, and that, somehow, the engine recognizes the 
difference? Does this have to do with the assertion being logical (and 
the engine tracing the origin of it)? I mean, as in a TMS: Jess has a 
TMS facility, right? I have to check how we handle refraction (or 
equivalent) wrt logical statements in JRules...

> We need to carefully specify these strategies to be sure we agree what 
> they are, and then we need to see what the intersection is, and if it is 
>  >= 1, give it an explicit name(s) (and probably not in the metadata as 
> my example does).

Absolutely agree.

Christian

Received on Tuesday, 29 July 2008 17:05:41 UTC