<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 12/08/2011 15:45, Swindells, Thomas wrote:
<blockquote
cite="mid:DAC86F5F3B84F14088F0DB16092558CA1339577F5F@UKMA1.UK.NDS.COM"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:191849096;
        mso-list-type:hybrid;
        mso-list-template-ids:1204297420 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’m
slightly confused as to the lifetime of a flake.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Reading
below what I think you are saying is the following:<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">1.<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span dir="LTR"></span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Flake
is inserted<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">2.<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span dir="LTR"></span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Activations
are created<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">3.<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span dir="LTR"></span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Flake
is kind-of retracted<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">4.<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span dir="LTR"></span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Activations
triggered by flake are then fired<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">5.<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span dir="LTR"></span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Activations
carry on usual.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Consider
the rules:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Rule
1
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
Flake()<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Not
Foo()<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Then<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
Insert(new Foo());<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">End<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Rule
2
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
Flake()<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Foo()<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Then<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
Print(“Flake for foo”);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family:
"Calibri","sans-serif"; color: rgb(31,
73, 125);">end</span></p>
</div>
</blockquote>
Rule2 would never fire.<br>
<br>
"flakes" as a single network propagation. It propagates through the
network as a single pass, the resulting conflict set is produced.
The fact is then retracted, although the Activations are not removed
and will continue to reference facts so they can fire. "flakes"
wouldn't support incremental matching in the engine.<br>
<br>
When you think about this more there are a number of retraction
strategies that could be useful, and worth exploring, atleast on
paper to flesh out the ideas.<br>
1) single pass (flake)<br>
2) retract when there are no activations<br>
3) retract when there are no matches (joins)<br>
<br>
And probably others I haven't thought about.<br>
<br>
Mark<br>
<blockquote
cite="mid:DAC86F5F3B84F14088F0DB16092558CA1339577F5F@UKMA1.UK.NDS.COM"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If
my understanding is correct (doubtful) then only rule 1
would trigger – by rule 2 the flake has already gone? Or
have I got this totally wrong?<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
think my gut expectation was that they would stay until
fireAllRules had completed.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thomas<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm
0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev-bounces@lists.jboss.org">rules-dev-bounces@lists.jboss.org</a>
[<a class="moz-txt-link-freetext" href="mailto:rules-dev-bounces@lists.jboss.org">mailto:rules-dev-bounces@lists.jboss.org</a>]
<b>On Behalf Of </b>Mark Proctor<br>
<b>Sent:</b> 12 August 2011 14:40<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<b>Subject:</b> Re: [rules-dev] [rules-users] What
would you call a Fact that is only evaluated once?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On 12/08/2011 12:10, Wolfgang Laun wrote:
<o:p></o:p></p>
<p class="MsoNormal">It's also a little dangerous.<br>
<br>
Consider that two or more rules should be firing with a
flake. If it's already out of WM at the time the first one
fires, you can't do a modify, e.g., for controlling the
firing of the other rules, or simply for passing them some
data via the flake.
<o:p></o:p></p>
<p class="MsoNormal">Flake's cannot be modified as they will
not exist in the WM by the time by the time the rule fires.
Flakes must be considered "final" and immutable such that
the rule can still fire on them though.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><br>
Also, a query run from the RHS of any rule with a flake
would not show the flake, which is surprising.<o:p></o:p></p>
<p class="MsoNormal">A flake would never show up in a query
no.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><br>
Event handling would need to be adapted - certainly the
melting of a flake would have to be reported to a listener,
probably with an appropriate indication.<o:p></o:p></p>
<p class="MsoNormal">We can probably add a new enum for this
special retraction.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><br>
What happens if one inserts two or more flakes in a row?<br>
<br>
Can you collect or accumulate flakes?<o:p></o:p></p>
<p class="MsoNormal">You can, but it would result in no
change. The object is inserted and then retracted straight
away, resulting in no change on the accumulate. The only
difference is we leave the resulting conflict available to
fire.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><br>
A logical insert of a fact in a RHS of a rule firing with a
flake is pointless.<o:p></o:p></p>
<p class="MsoNormal">the flake would never be able to falsify
the logical insertion, although other facts in the match can
still do so. But users would definitely neeed to be aware of
that.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><br>
Well, could be that "djinn" would be even better: it comes,
creates mischief and disappears again...<o:p></o:p></p>
<p class="MsoNormal">:)<br>
<br>
What we are trying to achieve is the abilty for users to
insert objects into WM and not have to worry about
retracting them. While this is similar to events, it's not
quite the same, as the retraction of events is not enforced
if it's matched against.<br>
<br>
Definitely room some more thought on this one, I think it
would be a nice use case, if we can make sure we get it
right.<br>
<br>
Mark<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
-W<br>
<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal">On 12 August 2011 12:45, Mark Proctor
<<a moz-do-not-send="true"
href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">On 12/08/2011 11:22, Wolfgang Laun
wrote: <o:p></o:p></p>
<p class="MsoNormal">One term (probably too long) would
be "interjection".<br>
<br>
A more pictorial word is "flake", which (thinking of
snowflake) provides an inkling for the fast fade away.<o:p></o:p></p>
</div>
<p class="MsoNormal">The context here is I'm working on an
adventure game. You insert commands, the engine
evaluates what to do with them, then you retract it
again. Once the initial conflict set is evaluated there
is no more use for the fact, and you end with redundant
rules. I'd rather declare @liftetime(flake)
@liftetime(durable) and have the engine handle that, or
something along those lines/terms. Grindwork also adds
something slightly different called "consume" for
handling similar situations:<br>
<a moz-do-not-send="true"
href="http://www.grindwork.com/site/node/6"
target="_blank">http://www.grindwork.com/site/node/6</a><br>
"This rule fires when those conditions in the 'when'
clause become true. When they become true, the "consume"
causes the removal of the client message and the old
alias (if one was set). The "rising" actions add (+
means add to the knowledge base) facts. One fact is the
new alias, and the other is that an alias has changed.
The alias changed fact allows others rules to notify
people in the channel that the alias changed."<br>
<br>
<br>
Currently how Commands are handled:<br>
rule invalidMove no-loop when<br>
$c : MoveCommand($d : direction)<br>
$h : Here( $l : location)<br>
not ?connect( $d, $l; ) <br>
then<br>
System.out.println( <a moz-do-not-send="true"
href="http://rule.name" target="_blank">rule.name</a>
+ ':' + $c );<br>
end<br>
<br>
rule validMove no-loop when<br>
$c : MoveCommand($d : direction)<br>
$h : Here( $l : location)<br>
exists ?connect( $d, $l; ) <br>
then<br>
System.out.println( <a moz-do-not-send="true"
href="http://rule.name" target="_blank">rule.name</a>
+ ':' + $c );<br>
insert( new ExitEvent( $l ) );<br>
insert( new EnterEvent( $d ) );<br>
System.out.println( $d );<br>
modify( $h ) { location = $d };<br>
end<br>
<br>
rule retractCommand salience -100 when<br>
$c : Command()<br>
then<br>
retract( $c );<br>
end <o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
-W<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal">On 12 August 2011 12:00, Mark
Proctor <<a moz-do-not-send="true"
href="mailto:mproctor@codehaus.org"
target="_blank">mproctor@codehaus.org</a>>
wrote:<o:p></o:p></p>
<p class="MsoNormal">What would you call a fact that
is inserted once and the conflict set<br>
computed (the rules that can fire). The fact is then
retracted so no<br>
more matches can take place, but the conflict set
itself is allowed to<br>
fire (assuming their other facts remain true).<br>
<br>
I think this is quite a common use case and most
users will handle this<br>
via a lower salience and retracting the fact
manually, but I think it's<br>
useful enough to build in as a keyword on type
declaration. We just need<br>
a name for it :)<br>
<br>
Mark<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org"
target="_blank">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>rules-dev mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><o:p></o:p></pre>
<pre><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><o:p></o:p></pre>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
rules-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-dev@lists.jboss.org">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><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>rules-dev mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><o:p></o:p></pre>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<br>
<hr>
<font color="Gray" face="Arial" size="1"><br>
**************************************************************************************<br>
This message is confidential and intended only for the
addressee. If you have received this message in error, please
immediately notify the <a class="moz-txt-link-abbreviated" href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from
your system as well as any copies. The content of e-mails as
well as traffic data may be monitored by NDS for employment and
security purposes. To protect the environment please do not
print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines,
Middlesex, TW18 4EX, United Kingdom. A company registered in
England and Wales. Registered no. 3080780. VAT no. GB 603 8808
40-00<br>
**************************************************************************************<br>
</font>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
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>