<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<a class="moz-txt-link-freetext" href="http://blog.athico.com/2010/04/goodbye-conflict-resoltuion-strategy.html">http://blog.athico.com/2010/04/goodbye-conflict-resoltuion-strategy.html</a><br>
------------<br>
<h3 class="post-title"><a
 href="http://blog.athico.com/2010/04/goodbye-conflict-resoltuion-strategy.html">Goodbye

Conflict Resolution Strategy, Hello Rule Dependency Meta Rules</a>
</h3>
<div class="post-body">
<p>I've added a new section to the <a
 href="http://community.jboss.org/wiki/DroolsLanguageEnhancements">Drools

Language Enhancement</a> ideas wiki page discussing meta-rules to help
declaratively control rule ordering. Here is what I have so far,
feedback welcome, you can find the original content <a
 href="http://community.jboss.org/wiki/DroolsLanguageEnhancements#Field_Versioning">here</a>.<br>
</p>
<h2 id="Rule_Dependency_MetaRule_Language">Rule Dependency Meta-Rule
Language</h2>
<p>When a terminal node is matched instead of adding the Activation to
the agenda it inserts it into the WorkingMemory. We have a special
builder that allows easy access to the contents.</p>
<p>All declarations are typed fields for the Activation fact, based on
the "name" field. So the name field is mandatory. All FactHandles are
available via an array accessor, which has type inference for the
element being used. We also all bindings on the Activation fact to work
this way too. Act is used for compactness, we'll allow that to be
optionally user defined:<br>
act1 : Act( someDeclaration == X, fact[0] == Y )<br>
act2 : Act( someDeclaration.value &gt; act1.someDeclaration.value )</p>
<p>Normal facts can also be matched. The RHS of the rule is side effect
free, you cannot modify or insert facts; this allows the RHS to execute
as soon as it's matched. What you can do is setup rule dependencies -
where one rule blocks another:<br>
act1.blockedBy( act2 ).until( Fired )<br>
act1.blockedBy( act2 ).until( IsFalse )</p>
<p>We can even allow facts to block:<br>
act1.blockedBy( someFact )</p>
<p>This means the act1 activation is blocked until a rule executes:<br>
act1.unblockedBy( someFact )</p>
<p>We can probably add an override, something like:<br>
act1.unblockAll()</p>
<p>Only when an Activation is no longer blocked will it be placed on
the Agenda as normal.</p>
<p>If an activation on the agenda has not yet fired and something
attempts to block it, it will be removed from the agenda until it is no
longer blocked.</p>
<p>For this to be effective, especially for large systems, it will need
to be combined with design time authoring help.<br>
</p>
<p style="padding: 0px; min-height: 8pt; height: 8pt;">This work will
be eventually be combined with further enhancements to help with
parallel execution, in resulting conflicts, see the "Parellel Meta-Rule
Language" heading.<br>
</p>
</div>
</body>
</html>