<br> Arjun,<br><br> I guess your questions are about 2 different subjects.<br><br>1. The non-existence of an object is handled by the NOT CE. So, if you want to say: there is no Bus asserted into working memory, you simply say:
<br><br>not Bus()<br><br>If you want to say: there is no red bus asserted into working memory, you simply say:<br><br>not Bus( color == "red" )<br><br>In the above case, even if there is a blue bus asserted, but not a red one, the CE will evaluate to true.
<br>If you want to say: there is a MyComposedObject whose active attribute is false or none MyComposedObject at all, you could say something like:<br><br>when<br> MyComposedObject(active == false) or<br> not MyComposedObject()
<br>Then<br> //Action<br>End<br><br><a href="http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/ch06s05.html#d0e3622">http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/ch06s05.html#d0e3622
</a><br><br>2. The use of contains and memberOf constraints. They both work on collections and arrays. The "in" operator only works on explicit lists of values:<br><br>Composer( this contains "abc" ) // valid
<br>Composer( this contains $anotherObject ) // valid<br>Component( this memberOf $composer.components ) // valid <br>Cheese( type in ( "stilton", $muzzarela, Cheese.PROVOLONE ) ) // valid<br><br> The negation of all of these operators works the same.
<br><br><a href="http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/ch06s05.html#d0e2992">http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/ch06s05.html#d0e2992
</a><br><br><div><span class="gmail_quote"> Please, read the docs and suggest improvements for everything that is not clear there.<br><br> Thanks,<br> Edson<br> <br><br>2007/8/2, Arjun Dhar <<a href="mailto:dhar_ar@yahoo.com">
dhar_ar@yahoo.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <mark.mcnally <at> <a href="http://comcast.net">comcast.net
</a>> writes:<br><br>><br>> My rule now appears to be working after switching from the "excludes"<br>operator to the newer "not contains".<br>><br>> This works:<br>> $ca:CandidateAssociation(
nurseDetails.stateLicensures not contains<br>patientDetails.state )<br>><br>> This does not:<br>> $ca:CandidateAssociation(nurseDetails.stateLicensures excludes<br>patientDetails.state )<br>><br>> Mark
<br><br><br>I was just about to post a question and I think this may be the answer to my<br>problem as well. So let me confirm.<br><br>Question) I hvae a rule<br><br>When<br> obj: MyComposedObject(active == false)<br>Then
<br> //Action<br>End<br><br>.. the problem is, if the above object was never asserted; I still want it to<br>execute. Luckily MyComposedObject is composend inside another object, so can i<br>use the technique above as>
<br><br>When<br> obj: Composer( this not contains MyComposedObject)<br>End<br><br>or even obj: Composer( this not in MyComposedObject)<br><br><br>... My Composer simply composes the object and does not contain it in a list.
<br><br>Q1) So would either or both "not contains" or "not in" work?<br>Q2) Or is "not contains" only for List or Collection type? what about HashMaps<br>then?<br>Q3) Stretching my actual use case to its limits; if I want to write conditions
<br>over objects that were never asserted into the working memory (need to OR them<br>with existing) ones, how do I do that? I understand technically it does not<br>make sense to want conditions over objects one never asserted; ... but please
<br>think a moment. A person asserts Objects and due to some external factor some<br>objects do not get asserted. Since he is aware of it, can he trap that<br>conidtion in the rule itself?<br>Example: Assertions --> (Object Type) A1, A2, A4
<br><br>RULES: I never got Object type A3 so Do Notify Admin <-- How to write such a<br>rule?<br><br>I hope I'm able to express my use case.<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div>
<br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>