<br>   Greg is right if you want to keep it just using expert features. <br>   Now if you model your Singleton as an event, you could use the timestamp instead of create a specific attribute for that:<br><br>               oldSingleton : Singleton( $id : id )<br>

                newSingleton : Singleton( id == $id, this after oldSingleton )<br> 
 <br>   Or, if you have just a few rules that use your Singleton and you activate the STREAM mode, you could simply use a sliding window:<br><br>rule &quot;my rule that uses the singleton&quot;<br>when<br>    $singleton : Singleton( ... ) over window:length(1)<br>
    // more patterns...<br>then<br>    // do something<br>end<br><br>    []s<br>    Edson<br><br><br><div class="gmail_quote">2009/8/18 Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You need some comparable property in the singleton object that&#39;s monotonically increasing.  Then you can have a rule like the following that must be of higher salience than the rules you want to protect from duplicate singletons.  i.e.:<br>

<br>
rule &quot;EnforceOneSingleton&quot;<br>
        when<br>
                oldSingleton : Singleton( $id : id, $version : version )<br>
                newSingleton : Singleton( id == $id, version &gt; $version)<br>
        then<br>
                System.out.println( &quot;Retracting old Singleton &quot; + oldSingleton.getId() + &quot; version &quot; + oldSingleton.getVersion());<br>
                retract( oldSingleton );<br>
end<br>
<br>
--- On Mon, 8/17/09, Justin King &lt;<a href="mailto:justin.matthew.king@gmail.com">justin.matthew.king@gmail.com</a>&gt; wrote:<br>
<br>
&gt; From: Justin King &lt;<a href="mailto:justin.matthew.king@gmail.com">justin.matthew.king@gmail.com</a>&gt;<br>
&gt; Subject: [rules-users] Unique events / facts in working memory<br>
&gt; To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
&gt; Date: Monday, August 17, 2009, 6:20 PM<br>
<div><div></div><div class="h5">&gt; I&#39;m building an application that will<br>
&gt; over time record changes in a certain component (not at any<br>
&gt; set interval, could occur any time). The component can<br>
&gt; possibly be uniquely identified via some kind of id. Is<br>
&gt; there a way that when I insert an event / fact recording a<br>
&gt; change of state in this component I can remove the previous<br>
&gt; one, so as there is only ever one fact / event recording the<br>
&gt; current state of the component. If the previous one existed<br>
&gt; it may cause rules to fire which should not.<br>
&gt;<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; Justin<br>
&gt;<br>
&gt;<br>
</div></div>&gt; -----Inline Attachment Follows-----<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>