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

Gary Hallmark wrote:
>
> Christian de Sainte Marie 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))
>
> With Oracle/Jess, you get
> rule2 fired, ?x=2
> rule1 fired, ?x=2
> rule1 fired, ?x=1
>
> 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 just checked myself, Jess is indeed different from Drools. Jess 
no-loop is specific to the rule where as Drools is specific to the Rule 
plus the matched row of data. I'm assuming that JRules is specific to 
the rule only too? I checked with Gary and clips does not implement any 
no-loop construct.

I've updated the feature comparison page with the new details on no-loop:
http://www.w3.org/2005/rules/wiki/PR_Feature_comparison

Btw no-loop isn't really related to default conflict resolution 
strategy. What is the plan there? Drools, Jess and Clips have defaulted 
on a Depth first algorithm - although Drools and Clips support multiple 
strategies and are pluggable. Depth is very simple and just prioritises 
the match based on it's propagation age - i.e. the age of the last 
change to cause the match. I believe that this is because its something 
that people can easily understand, MEA and LEX while more powerful is 
hard for many people to grasp. Modules/ruleflow are used these days to 
provide more control of execution control instead of the more complex 
MEA and LEX.

One interesting tit bit I found out while studying miss manners is that 
jess and clips also do an aggregate time stamp comparison, but this is 
undocumented, where they just sum up the time stamp for each fact in the 
match. Without this manners will not work, as it was designed for MEA 
which provided recency comparisons, among other things. We adopted this 
aggregate time stamp too in Drools, as it's more performant than a full 
recency comparison. OPSJ I believe sticks to doing a full recency, I'm 
now of the opinion that this is the better way and we may default to 
that in drools too and take the small hit in perf.

For anyone interested my write up of miss manners, where I discovered 
this aggregate time stamp approach is documented here:
http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html/ch10.html#d0e7985

>>> It's just the default is the opposite way around. didn't JRules have 
>>> a "reset" command to allow a rule to refire after a modify?
>>
>> Right, you can disallow refraction in JRules, so, it is only the 
>> default that is the other way around.
>>
>> So, "no-repeat" cannot be the default in RIF-PRD, since it is not the 
>> default strategy in some of the major engines (it seemed so natural 
>> to me that I assumed it was the default in most, if not all, 
>> engines... Or am I just biased :-).
>>
>> Which probably means that there should be no default, and the 
>> intended conflict resolution strategy must always be explicit (see 
>> also Adrian's argument against a default strategy, in [1]).
> 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).
>>
>> Cheers,
>>
>> Christian
>>
>> [1] http://lists.w3.org/Archives/Public/public-rif-wg/2008Jun/0168.html
>>
>>
>>
>>
>


-- 
JBoss, a Division of Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, 
SI4 1TE, United Kingdom. 
Registered in UK and Wales under Company Registration No. 3798903 
Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons (USA) and Brendan Lane (Ireland)

Received on Tuesday, 29 July 2008 23:02:49 UTC