I must be missing something. If you want to check if all the three strings are present in each array, why are you using OR (||)?<div><br></div><div>If you don&#39;t want to model the array as a class containing the &quot;parent&quot; reference and insert them as facts, you can try this:</div>

<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div><br></div><div>MyContext(classes contains &quot;TestString1&quot; &amp;&amp; contains &quot;TestString2&quot; &amp;&amp; contains &quot;TestString3&quot;)</div>

</span></div><div><br></div><div><br></div><div>Best Regards,<br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>

- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>

<br><br><div class="gmail_quote">On Wed, Sep 29, 2010 at 12:17 PM, Swindells, Thomas <span dir="ltr">&lt;<a href="mailto:TSwindells@nds.com" target="_blank">TSwindells@nds.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>&gt; Thomas, Thanks for the suggestions.<br>
&gt;<br>
&gt; Swindells, Thomas wrote:<br>
&gt; &gt;<br>
&gt; &gt; Also have you tried just using ==, eg exists( String(this ==<br>
&gt; &gt; &quot;TestString1&quot;) ||  String(this == &quot;TestString2&quot;) || String(this ==<br>
&gt; &gt; &quot;TestString3&quot;) from DclassesList)<br>
&gt; &gt;<br>
&gt;<br>
&gt; This did reduce the time by about 50 ms.<br>
</div>That&#39;s a step in the right direction at least.<br>
<div><br>
&gt; Swindells, Thomas wrote:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; You may also want to consider whether it would be beneficial to<br>
&gt; &gt; restructure your fact class to get rid of the from, and match against<br>
&gt; &gt; ClassName facts instead - this may give you a big performance gain as it<br>
&gt; &gt; means each rule wouldn&#39;t have to iterate over the list, if you are<br>
&gt; &gt; updating MyContext then this gain is likely to be even bigger.<br>
&gt; &gt;<br>
&gt;<br>
&gt; Not quite sure about what you mean by &quot;match against ClassName facts instead<br>
&gt; &quot;.  My fact class will have a bunch of instance variables one of which is<br>
&gt; the array of strings.<br>
&gt; Would be great if you could elaborate that a bit.<br>
<br>
</div>Have two fact classes,<br>
One is your current fact class (MyContext), the other is to represent each of your classes entry.<br>
Eg:<br>
Class ClassName {<br>
MyContext parent;<br>
String name;<br>
...<br>
}<br>
<br>
When inserting you MyContext into the working memory you would also add a ClassName fact for each entry of the classes list (you could either do this in code or have a rule which does it for you).<br>
<br>
Your main rules would then look something like the following:<br>
<br>
<br>
Rule XYZ<br>
$parent : MyContext<br>
exists ( ClassName(parent == $parant, name == &quot;TestString1&quot;) or ClassName(parent == $parant, name == &quot;TestString2&quot;) or ClassName(parent == $parant, name == &quot;TestString3&quot;))<br>
then<br>
...<br>
<br>
If you only ever have one MyContext in working memory you can skip the parent check.<br>
<br>
<br>
You may also be able to use in to simplify things<br>
exists ( ClassName(parent == $parant, name in {&quot;TestString1&quot;, &quot;TestString2&quot;, &quot;TestString3&quot;))<br>
<br>
<br>
Hope that makes sense,<br>
<font color="#888888"><br>
Thomas<br>
</font><div><br>
<br>
<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 href="mailto:postmaster@nds.com" target="_blank">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>
<br>
</div><div><div></div><div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
</div></div></blockquote></div><br>
</div>