<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 31/03/2011 22:25, Michael Anstis wrote:
<blockquote
cite="mid:AANLkTikLLBswkDGbmL1BhcD0MnC6Z2PDvUWqpzXm+KvT@mail.gmail.com"
type="cite">Yeah, I remember the exchanges from a long time ago
about "else" in DRL. IIRC, Mark wasn't keen on the idea.<br>
</blockquote>
I didn't like the way Ilog did "else", where it only works on an
"eval" node and must be the last CE in a rule.<br>
<br>
I do however like the OPSJ way of labelled else, and you can have as
many as you like. I have already done the backend for this, with
"named" consequences, so allow multiple consequences per rule. We
just haven't hooked this up into the parser.<br>
<br>
Although I have revised this concept further, with "steroids", and
instead called it "named branch". It is likely we'll dothis instead
of simple 'else'. Branch and Else are also the foundations for
opportunistic BC.<br>
<br>
<a class="moz-txt-link-freetext" href="http://community.jboss.org/wiki/DroolsLanguageEnhancements#Branch_Labelled_Else">http://community.jboss.org/wiki/DroolsLanguageEnhancements#Branch_Labelled_Else</a><br>
<h2 id="Branch_Labelled_Else">Branch (Labelled Else)</h2>
<p>If the first branch is true it'll continue to propgate to the
next node which is part of the [then] chain, [then] is implicit
for the first branch. If b1 or b2 are true it'll it will activate
the labelled block</p>
<p>branch( Pattern(....),<br>
[b1] Pattern(....),<br>
[b2] Pattern(....) )</p>
<p> If none of the branches match then the [b3] default branch is
activated.</p>
<p>branch( Pattern(....),<br>
[b1] Pattern(....),<br>
[b2] Pattern(....),<br>
[b3] default )</p>
<p> We can have branches activated when the pattern is not matched.</p>
<p>branch( [!b1] Pattern(....),<br>
[!b2] Pattern(....),<br>
[!b3] Pattern(....) )</p>
<p>In the case of b2 and b3 if the pattern is not true, it'll do
nothing, if the pattern is false the b2 will or b3 will activate.
In the case of first pattern, if it's false the b1 block will
activate, if it's true it will continue to propagate to the rest
of the rule. ** is this consistent and intuitive?</p>
<p> ** Each branch does not need to be a Pattern it can have any
drl, be it an 'else', 'not', 'and'. If you want multiple patterns,
make sure to use the 'and' CE. We shouldn't allow 'or' CE's as I
think that would get too messy</p>
<p> ** At the moment we don't ensure any xor type behaviour. For
instance we could have it that so only one branch can activate,
it'll start at the top and try each one in turn, exiting after the
first one is activated.<br>
<br>
</p>
<br>
<blockquote
cite="mid:AANLkTikLLBswkDGbmL1BhcD0MnC6Z2PDvUWqpzXm+KvT@mail.gmail.com"
type="cite"><br>
Anyway, provided my "reversals" make sense it's almost complete in
the guided dtable; it only uses SimpleFieldConstraints so doesn't
have the complexity of compound constraints :)<br>
<br>
<br>
<div class="gmail_quote">On 31 March 2011 22:20, Michael Neale <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
Otherwise has been dragging on since 2006. There are many
skeletons in that cave.
<div><br>
</div>
<div>I will believe it when I see it !
<div>
<div class="h5"><br>
<br>
<div class="gmail_quote">On Fri, Apr 1, 2011 at 7:25 AM,
Michael Anstis <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:michael.anstis@gmail.com"
target="_blank">michael.anstis@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt
0pt 0.8ex; border-left: 1px solid rgb(204, 204,
204); padding-left: 1ex;">I bet Edson can't wait to
refactor the parser for that ;)
<div>
<div><br>
<br>
<div class="gmail_quote">
On 31 March 2011 21:11, Mark Proctor <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:mproctor@codehaus.org"
target="_blank">mproctor@codehaus.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:
0pt 0pt 0pt 0.8ex; border-left: 1px solid
rgb(204, 204, 204); padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff"> on a
related note I do plan to add OTHERWISE
support at a DRL level, just no time to do
it right now. Once it's supported at a DRL
level, you won't need to as much work on
figuring out the inverse options etc.<br>
<br>
Mark
<div>
<div><br>
On <a moz-do-not-send="true"
href="tel:31%2F03%2F2011%2020"
target="_blank">31/03/2011 20</a>:25,
Michael Anstis wrote: </div>
</div>
<blockquote type="cite">
<div>
<div>Hi,<br>
<br>
I'm adding support for "otherwise"
to (for the time being) the guided
decision table in Guvnor.<br>
<br>
The idea being if you set a cell to
represent "otherwise" the generated
rule is the opposite of the
accumulation of the other cells;
perhaps best explained with an
example:-<br>
<br>
<div style="margin-left: 40px;"><span
style="font-family: courier
new,monospace;">Person( name ==
)</span><br style="font-family:
courier new,monospace;">
<span style="font-family: courier
new,monospace;">Mark</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Kris</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Geoffrey</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;"><otherwise></span><br
style="font-family: courier
new,monospace;">
</div>
<br>
This would generate:-<br>
<br>
<span style="font-family: courier
new,monospace;">Person(name not in
("Mark", "Kris", "Geoffrey")</span><br
style="font-family: courier
new,monospace;">
<br>
Equals is the simple example, this
is my thoughts for the other
operators we might like to support:-<br>
<ul>
<li>!= becomes "in (<list of
the other cells' values)"</li>
<li>< becomes ">= the
maximum value of the other
cells' values</li>
</ul>
<br>
<div style="margin-left: 40px;">For
example:-<br>
<br>
<span style="font-family: courier
new,monospace;">Person ( age
< )</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">10</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">20</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">30</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;"><otherwise></span><br
style="font-family: courier
new,monospace;">
<br style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Person ( age
>= 30 )</span></div>
<br>
<ul>
<li><= becomes "> the
maximum value of the other
cells' values</li>
<li>> becomes "<= the
minimum value of the other
cells' values</li>
<li>>= becomes "< the
minimum value of the other
cells' values</li>
<li>"in" becomes "not in (<a
list of all values contained in
all the other cells' lists of
values>)"</li>
</ul>
<div style="margin-left: 40px;">For
example:-<br>
</div>
<br>
<div style="margin-left: 40px;"> <span
style="font-family: courier
new,monospace;">Person ( name in
)</span><br style="font-family:
courier new,monospace;">
<span style="font-family: courier
new,monospace;">Jim, Jack</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Lisa, Jane, Paul</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;"><otherwise></span><br
style="font-family: courier
new,monospace;">
<br style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Person ( name
not in ("Jim", "Jack", "Lisa",
"Jane", "Paul" ) )</span><br>
<br>
</div>
<ul>
<li>I'm not sure there is a simple
solution for "matches" and
"soundslike" but welcome advice,
although a possibility might be
to create a compound field
constraint:-<br>
</li>
</ul>
<div style="margin-left: 40px;"> <span
style="font-family: courier
new,monospace;">Person ( name
soundslike )</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Fred</span><br
style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">Phil</span><br
style="font-family: courier
new,monospace;">
<br style="font-family: courier
new,monospace;">
<span style="font-family: courier
new,monospace;">not Person (
name soundslike "Fred" ||
soundslike "Phil" )</span><br
style="font-family: courier
new,monospace;">
</div>
<br>
<br>
Would this be considered the most
suitable approach?<br>
<br>
Inputs and thoughts welcome.<br>
<br>
Thanks,<br>
<br>
Mike <br>
<br>
</div>
</div>
<pre><fieldset></fieldset>
_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
</blockquote>
<br>
</div>
<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-dev@lists.jboss.org"
target="_blank">rules-dev@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-dev"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-dev@lists.jboss.org"
target="_blank">rules-dev@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-dev"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
</div>
</div>
-- <br>
Michael D Neale<br>
home: <a moz-do-not-send="true"
href="http://www.michaelneale.net" target="_blank">www.michaelneale.net</a><br>
blog: <a moz-do-not-send="true"
href="http://michaelneale.blogspot.com" target="_blank">michaelneale.blogspot.com</a><br>
</div>
</blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>