<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</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]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>Sorry if this is a very basic
question but does that mean that I have to set the dialect for the whole rule
to MVEL. I ask because using the code below with the dialect left as default
fails with an error about the square brackets. However my consequence code doesn&#8217;t
work with the dialect set as MVEL. All this means for me is that I will probably
have to stick with my eval version of key checking but I just wanted to be
sure.<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal>import my.package.MyFact<o:p></o:p></p>

<p class=MsoNormal>import java.util.Map.Entry<o:p></o:p></p>

<p class=MsoNormal>rule &#8220;Find with map&#8221;<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
when<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$fact : MyFact($paramMap : paramMap)<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$myValue : String() from $paramMap[&#8216;mykey1&#8217;]<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
then<o:p></o:p></p>

<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>// Sudo code&#8230;<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;use $myValue &gt;<o:p></o:p></p>

<p class=MsoNormal>end<o:p></o:p></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Thank you Mark for the quick
reply,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<p class=MsoNormal><span style='color:#1F497D'>-- Paul Ryan<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<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'> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b>On Behalf Of </b>Mark Proctor<br>
<b>Sent:</b> Wednesday, July 16, 2008 4:29 PM<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] Map using from constraint<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Paul Ryan wrote: <o:p></o:p></p>

<p class=MsoNormal>Hi all,<o:p></o:p></p>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

<p class=MsoNormal>Is there a way using the &#8216;from&#8217; constraint to
get the values of a map(the implementations of java.lang.Map eg HashMap,
TreeMap, etc) into a constraint parameter, and if so can someone please give an
example. Below is the way I&#8217;ve been trying, without success, to get a
value based on a key.<o:p></o:p></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>$m
: Map()<br>
MyObject(.....) from $m['key']<br>
<br>
We support MVEL notation for the 'from' keyword.<br>
<br>
<o:p></o:p></span></p>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

<p class=MsoNormal>import my.package.MyFact<o:p></o:p></p>

<p class=MsoNormal>import java.util.Map.Entry<o:p></o:p></p>

<p class=MsoNormal>rule &#8220;Find with map&#8221;<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
when<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$fact : MyFact($paramMap : paramMap)<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$myValue : Entry(key == &#8220;mykey1&#8221;) from $paramMap<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Then<o:p></o:p></p>

<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>// Sudo code&#8230;<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;use $myValue.getValue()&gt;<o:p></o:p></p>

<p class=MsoNormal>end<o:p></o:p></p>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Paul
Ryan</span></b><o:p></o:p></p>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Software
Architect<br>
Product Engineering</span></b><b><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'><br>
</span></b><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>InfoTrust
Group, Inc.</span></b><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><img
width=173 height=46 id="Picture_x0020_1"
src="cid:image001.jpg@01C8E764.9D131B00" alt="Logo FINAL 1-30-08_scaled"></span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>500
Discovery Parkway, Suite 200<br>
Superior, CO 80027<br>
<b>Office</b> (303) 627-6528</span><o:p></o:p></p>

<p class=MsoNormal><b><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>Fax</span></b><span
style='font-size:8.0pt;font-family:"Arial","sans-serif"'> (303) 666-6711</span><span
style='font-size:8.0pt;font-family:"Arial","sans-serif";color:navy'><br>
</span><b><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>Email</span></b><span
style='font-size:8.0pt;font-family:"Arial","sans-serif";color:navy'> </span><span
style='font-size:8.0pt;font-family:"Arial","sans-serif";color:blue'><a
href="mailto:pryan@infotrustgroup.com">pryan@infotrustgroup.com</a></span><span
style='font-size:8.0pt;font-family:"Arial","sans-serif";color:navy'><br>
</span><b><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>WEB</span></b><span
style='font-size:8.0pt;font-family:"Arial","sans-serif";color:navy'> </span><span
style='font-size:8.0pt;font-family:"Arial","sans-serif";color:blue'><a
href="http://www.infotrustgroup.com/">www.infotrustgroup.com</a></span><o:p></o:p></p>

<p class=MsoNormal><i><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>&nbsp;</span></i><o:p></o:p></p>

<p class=MsoNormal><i><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>This
e-mail and all information included herein do not constitute a legal agreement
accorded by INFOTRUST GROUP and its affiliates and subsidiaries.&nbsp; All
legal agreements must be formulated in writing by a legal representative of
INFOTRUST GROUP.&nbsp;This email and any files transmitted with it are
confidential and intended solely for the use of the individual or entity to
whom they are addressed.&nbsp; If you have received this e-mail by mistake,
please inform us and destroy this e-mail and any documents it might
contain.&nbsp; Please note that any views or opinions presented in this email
are solely those of the author and do not necessarily represent those of the
company. Finally, the recipient should check this email and any attachments for
the presence of viruses. The company accepts no liability for any damage caused
by any virus transmitted by this email.&nbsp; Thank you for your cooperation.</span></i><o:p></o:p></p>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

<pre><o:p>&nbsp;</o:p></pre><pre style='text-align:center'>

<hr size=4 width="90%" align=center>

</pre><pre><o:p>&nbsp;</o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>rules-users mailing list<o:p></o:p></pre><pre><a
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><o:p></o:p></pre><pre><a
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></pre><pre>&nbsp; <o:p></o:p></pre>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p>&nbsp;</o:p></span></p>

</div>

</body>

</html>