<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 14 (filtered medium)"><base href="x-msg://468/"><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:Monaco;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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;}
span.E-MailFormatvorlage17
        {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:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></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 lang=DE-CH link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Great!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>As my fact object (Dokument) encapsulates a whole text analytics process and should be able to return any key-value pairs (where &#8220;reviewed&#8221; is a key) there are many other (not predictable) keys which are probably used within a rule to evaluate the content of a document.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So in that sense, the solution you suggest would not work.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>In another way, if a set of common and known keys exists to all users, your approach would be even more robust an less fragile to spelling an mistyping issues ;-)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you very much.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hans<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] <b>Im Auftrag von </b>Stephen Masters<br><b>Gesendet:</b> Montag, 10. Juni 2013 17:24<br><b>An:</b> Rules Users List<br><b>Betreff:</b> Re: [rules-users] choose method from fact object in guided editor<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>I think I have a better idea of what you're trying to do now. Below is the content of a message I sent to this list the other day. I think you might find the technique relevant to what you are doing. i.e. Create a DSL which refers to an enumeration which you define. That way, you get drop-down menus in the DSL sentences. That makes life easy for your users. From there you are able to take the value from the enum and use it in the generated code. Note that in the code below, it is taking the value of &quot;unit&quot; from the enumeration and using that as the field being matched in the code.<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>The rest is from my previous email...<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><div><p class=MsoNormal>I just couldn't find any examples of the DRL syntax for 'creating' a value like that in the LHS. A quick test with a contrived little example shows me that the following works:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>rule &quot;Warn when my meal is too large&quot;<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>when<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp;&nbsp;$meal: Meal($calories: calories &gt; 1000)<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp;&nbsp;$unit: String() from &quot;calories&quot;<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>then<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp;&nbsp;insert(new MealTooBigWarning(&quot;That meal is bigger than your 1000 &quot; + $unit + &quot; limit.&quot;));<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>end<o:p></o:p></span></p></div></div></blockquote><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>So, based on that I'm able to write a DSL like this:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>[when][]I am given a meal of more than &quot;{sizeLimit}&quot; &quot;{unit}&quot; = $meal: Meal($size: {unit} &gt; {sizeLimit}); $sizeLimit: Integer() from {sizeLimit}; $unit: String() from &quot;{unit}&quot;<o:p></o:p></span></p></div></div></div></div><div><div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>[then][]Warn that the meal is too big = insertLogical(new MealTooBigWarning(&quot;That meal is bigger than your &quot; + $sizeLimit + &quot; &quot; + $unit + &quot; meal limit.&quot;));<o:p></o:p></span></p></div></div></div></div></blockquote><div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Which means that I can write DSLR like this:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>rule &quot;Warn when my meal has too many calories&quot;<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>when<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp; I am given a meal of more than &quot;1000&quot; &quot;calories&quot;<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>then<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp; Warn that the meal is too big<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>end<o:p></o:p></span></p></div></div></blockquote><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal>&#8230; which gives me:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>That meal is bigger than your 1000 calories meal limit.<o:p></o:p></span></p></div></div></blockquote><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal>Or this:<o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'><o:p>&nbsp;</o:p></span></p></div></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>rule &quot;Warn when my meal has too many diet club points&quot;<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>when<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp; I am given a meal of more than &quot;11&quot; &quot;dietClubPoints&quot;<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>then<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>&nbsp; &nbsp; Warn that the meal is too big<o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>end<o:p></o:p></span></p></div></div></blockquote><div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>&#8230; which gives me:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>That meal is bigger than your 11 dietClubPoints meal limit.<o:p></o:p></span></p></div></blockquote><div><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'><o:p>&nbsp;</o:p></span></p></div></div><div><div><p class=MsoNormal>So I can define an enumeration:<o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'><o:p>&nbsp;</o:p></span></p></div></div></div><blockquote style='margin-left:30.0pt;margin-right:0cm'><div><div><p class=MsoNormal><span style='font-size:8.5pt;font-family:"Monaco","serif"'>'MealSize.units': ['calories=calories', 'dietClubPoints=diet club points']<o:p></o:p></span></p></div></div></blockquote><div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>So that in Guvnor, I have a single sentence with a drop-down menu containing the options &quot;calories&quot; and &quot;diet club points&quot;. That keeps things nice and clean for the users.<o:p></o:p></p></div></div></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></body></html>