<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:st1="urn:schemas-microsoft-com:office:smarttags" 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 11 (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]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
_filtered {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
_filtered {font-family:Webdings;panose-1:5 3 1 2 1 5 9 6 7 3;}
_filtered {margin:1.0in 1.25in 1.0in 1.25in;}
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Webdings;
        panose-1:5 3 1 2 1 5 9 6 7 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.emailstyle17
        {font-family:Arial;
        color:navy;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>I’ve written this rule to be
fired for Configuration object whose category is selected and subcategories are
yet not selected. <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>rule</span></font><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'> "select sub
categories"<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> salience
50<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> no-loop<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> when<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> $conf
: Configuration($categoryId : $conf.getCategory().getCategoryId() != null,
subCategories == null )<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> $subcats
: ArrayList() from collect (Category ( parent1 == $categoryId ) )<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> then
<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> $conf.setSubCategories($subcats);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>end</span></font><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>but it gives me following error.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>[34,56]: [ERR 101] Line 34:56 no
viable alternative at input ')' in rule "select sub categories" in
pattern Configuration<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>[34,57]: [ERR 102] Line 34:57
mismatched input '.' expecting ')' in rule "select sub categories" in
pattern Configuration<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>[34,74]: [ERR 102] Line 34:74
mismatched input '!=' expecting 'then' in rule "select sub
categories" in pattern Configuration<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Do I need to use “eval” around the “$conf.getCategory().getCategoryId()”
part ? Also in that case how do I get access to the property value ? It
doesn’t support something like this :<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>$conf :
Configuration($categoryId : eval( $conf.getCategory().getCategoryId() != null ),
subCategories == null )<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Regards,<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Abhay<o:p></o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Wendy Mungovan<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, May 10, 2011 3:31
PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
Users List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] FW:
Basic rules question</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<div>
<p class=MsoNormal><font size=3 face=Arial><span style='font-size:12.0pt;
font-family:Arial'>Abhay,<br>
You can use the normal Java gets (if your object has them).<br>
<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>when <o:p></o:p></span></font></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>
$prod : Product ($prod.getMemory().getRam().getType() == "DDR")<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face=Arial><span style='font-size:12.0pt;
font-family:Arial'>...<br>
<br>
instead of $prod.getMemory()... you I think should also be able to use
'this.getMemory()....'<br>
<br>
(I have not tried these out to make sure)<br>
<br>
Wendy<o:p></o:p></span></font></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
<hr size=1 width="100%" align=center>
</span></font></div>
<p class=MsoNormal style='margin-bottom:12.0pt'><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Abhay B.
Chaware <Abhay.Chaware@kpitcummins.com><br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
Users List</st1:PersonName> <rules-users@lists.jboss.org><br>
<b><span style='font-weight:bold'>Sent:</span></b> Mon, May 9, 2011 11:56:42 PM<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] FW:
Basic rules question</span></font><o:p></o:p></p>
<div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>OK. Another one. How do I access and
use a property of a member variable ( object ) of an object, in rules ? </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>e.g. in the same example, I need to
check </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>1) if a product of type
‘laptop’ is inserted in memory AND</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>2) if the product’s MEMORY
property ( object ) has an object of type DDR ram attached.</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>In other words, here is the relationship
of facts - </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>PRODUCT has member variable MEMORY ( which
is an object ) </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>MEMORY has member variable RAM ( which is
again an object )</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>RAM has member variable TYPE ( which
should be equal to “DDR” )</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>From within rules ‘when’ part,
how do I check if there is a PRODUCT inserted in memory whose MEMORY has a RAM
of type DDR assigned ?</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Regards,</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
11.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Abhay Chaware</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=1 color=navy face=Arial><span style='font-size:
7.5pt;font-family:Arial;color:navy'>Sr. Designer | KPIT Cummins Infosystems Ltd
| Board: +91 020 6652 5000 | Extn: 2989 | abhay.chaware@kpitcummins.com |<a
href="http://www.kpitcummins.com" target="_blank">www.kpitcummins.com</a> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=5 color=green face=Webdings><span
style='font-size:18.0pt;font-family:Webdings;color:green'>P</span></font><font
size=2 color=black face=Webdings><span style='font-size:11.0pt;font-family:
Webdings;color:black'> </span></font><font size=1 color=green face=Tahoma><span
style='font-size:7.5pt;font-family:Tahoma;color:green'>Please consider the
environment before printing this e-mail</span></font><o:p></o:p></p>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Michael Anstis<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, May 09, 2011 4:27 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
Users List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] FW: Basic
rules question</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Yes :)<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2011/5/9 Abhay B. Chaware <<a
href="mailto:Abhay.Chaware@kpitcummins.com" target="_blank"
ymailto="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>><o:p></o:p></span></font></p>
<div>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Mike,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>What I meant was, There are say 10 objects of RAM in memory whose type
is DDR. Now my “Product” object has a member variable named
“compatibleRAMs”, and I would like to set an arraylist containing
these 10 objects to the “compatibleRAMs” variable of
“Product” object in memory.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>I am reading about the “collect” which can be used to
create collections from fact objects in memory. Something like.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>When <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>
$prod : Product (type==’laptop’)<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>$compatibleRAMs : ArrayList() from collect (RAM (type
== ‘DDR’)) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Then<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>
$prod.setCompatibleRAMs($compatibleRAMs);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Am I on the right track ?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>-abhay<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Michael Anstis<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, May 09, 2011 3:52 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
Users List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] FW:
Basic rules question</span></font><o:p></o:p></p>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Abhay,<br>
<br>
Do you need a list?<br>
<br>
You can assign RAM to COMPUTERS with this:-<br>
<br>
</span></font><font face="Courier New"><span style='font-family:"Courier New"'>when<br>
$c : Computer( $type : type )<br>
$r : RAM( compatibleWith == $type )<br>
then<br>
$c.addRAM( $r );<br>
end<br>
</span></font><br>
This would add all RAM (in Working Memory) compatible with COMPUTER to
computer.<br>
<br>
You could use a list of RAM as a Fact in WM and change your rule to use that:-<br>
<br>
<font face="Courier New"><span style='font-family:"Courier New"'>when<br>
$l : MyList( )<br>
$c : Computer( $type : type )<br>
$r : RAM( compatibleWith == $type ) from $l<br>
then<br>
$c.addRAM( $r );<br>
end<br>
</span></font><br>
Or you can define a rule to construct the list too:-<br>
<br>
<font face="Courier New"><span style='font-family:"Courier New"'>when<br>
$l : MyList( $t : typeRAM )<br>
RAM( $c : $t )<br>
then<br>
$l.add( $r )<br>
end</span></font><br>
<br>
I assume you'd need to differentiate different lists for different types; so I
have shown use of "MyList" which could subclass ArrayList and have a
"Type of RAM" attribute. Drools doesn't "do" generics.<br>
<br>
With kind regards,<br>
<br>
Mike<o:p></o:p></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2011/5/9 Abhay B. Chaware <<a
href="mailto:Abhay.Chaware@kpitcummins.com" target="_blank"
ymailto="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>><o:p></o:p></span></font></p>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Wendy, </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for helping me out so far. </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I have another question. What if I have
all my “RAM” objects inserted into working memory. How
should I write my rule’s “when” portion to get a collection
of all the RAM objects matching type “DDR” ? In other words,
can I get collection of facts assigned to a variable and use it in the
“then” part ?</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks</span></font><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Abhay</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>==================================</span></font><o:p></o:p></p>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Wendy Mungovan<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, May 06, 2011 5:47 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
Users List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] Basic
rules question</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 color=black face=Arial><span style='font-size:
12.0pt;font-family:Arial;color:black'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 color=black face=Arial><span style='font-size:
12.0pt;font-family:Arial;color:black'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 color=black face=Arial><span style='font-size:
12.0pt;font-family:Arial;color:black'>Q2:<br>
So the rule would be something like:<br>
<br>
rule "RAM type"<br>
when<br>
$product: Product(type == "laptop");<br>
then<br>
//you are looking for the best way to set valid RAM
types in the then part of the rule?<br>
$product.setRamType("DDR");<br>
//or<br>
$product.setValidRamOptions( getValidRamOptions("DDR"));<br>
end<br>
<br>
where getValidRamOptions would be a custom function included through 'import
function' so you can then load the choices from some where else. Or if
RamOptions were an object in memory you could have a rule like:<br>
<br>
rule "RAM type"<br>
when<br>
$product: Product(type == "laptop");<br>
$ramOptions: RAMOptions(type == "DDR");<br>
<br>
then<br>
$product.setValidRamOptions( $ramOptions.getList());<br>
end<br>
<br>
<br>
<br>
<br>
Wendy</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 color=black face=Arial><span style='font-size:
12.0pt;font-family:Arial;color:black'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>==================================</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Regards,</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
11.0pt;font-family:Arial;color:navy'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Abhay Chaware</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=1 color=navy face=Arial><span style='font-size:
7.5pt;font-family:Arial;color:navy'>Sr. Designer | KPIT Cummins Infosystems Ltd
| Board: +91 020 6652 5000 | Extn: 2989 | <a
href="mailto:abhay.chaware@kpitcummins.com" target="_blank"
ymailto="mailto:abhay.chaware@kpitcummins.com">abhay.chaware@kpitcummins.com</a>
|<a href="http://www.kpitcummins.com" target="_blank">www.kpitcummins.com</a> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=5 color=green face=Webdings><span
style='font-size:18.0pt;font-family:Webdings;color:green'>P</span></font><font
size=2 color=black face=Webdings><span style='font-size:11.0pt;font-family:
Webdings;color:black'> </span></font><font size=1 color=green face=Tahoma><span
style='font-size:7.5pt;font-family:Tahoma;color:green'>Please consider the
environment before printing this e-mail</span></font><o:p></o:p></p>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Wendy Mungovan<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, May 06, 2011 5:47 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
Users List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] Basic
rules question</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face=Arial><span style='font-size:12.0pt;
font-family:Arial'>Abhay,<br>
Q1: I think that this will depend on how many different products
you have. If there is a small number it is more straight forward to have
a rule for each one (so the 2nd option). This allows all you logic to be in
one place. If there are a large number of products and writing a rule for
each one is intractable you probably would want to look into some
generalizations of the rules. Is that helpful?<br>
<br>
Q2: I'm not quite sure what you are getting at in Q2. Are you
trying to write validation rules or rules that are modifying the facts?</span></font><o:p></o:p></p>
<div>
<p class=MsoNormal><font size=3 face=Arial><span style='font-size:12.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 face=Arial><span
style='font-size:12.0pt;font-family:Arial'>Wendy</span></font><o:p></o:p></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
<hr size=1 width="100%" align=center>
</span></font></div>
<p class=MsoNormal style='margin-bottom:12.0pt'><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Abhay B.
Chaware <<a href="mailto:Abhay.Chaware@kpitcummins.com" target="_blank"
ymailto="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>><br>
<b><span style='font-weight:bold'>To:</span></b> "<a
href="mailto:rules-users@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>"
<<a href="mailto:rules-users@lists.jboss.org" target="_blank"
ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
<b><span style='font-weight:bold'>Sent:</span></b> Fri, May 6, 2011 4:59:46 AM<br>
<b><span style='font-weight:bold'>Subject:</span></b> [rules-users] Basic rules
question</span></font><o:p></o:p></p>
<div>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hi </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am a newbie to rule based applications and trying to get
the concept of rules. I have couple of questions about rules to start with, not
specifically about Drools though.</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Q1 - Should rules be data/model specific or can/should they
be generic or both</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>==========================================================</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>e.g. </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>If selected product “TYPE” is
“laptop”, then category “RAM” should have all
“DDR” type items compatible ( selecting items matching certain
property )</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>OR</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>If selected product is “IBM T42”, then category
“RAM” should have “512MB DDR” , “1024MB
DDR”, “2048MB DDR” compatible. ( assigning individual
items in rules )</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>OR</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Combination of both</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Q2 – How should be the data modeled in above case</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>==========================================================</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>e.g. </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>in product master, each item ( e.g. T40, T42 ) should have a
“TYPE” ( e.g. desktop or laptop ) , all items in category
“RAM” should have a “TYPE” ( e.g. DDR ) and then
control the assignment of RAM options to the PRODUCT through Rule using
“DDR” type ?</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>OR</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>in product master, each item ( e.g. T40, T42 ) should have a
“TYPE” ( e.g. desktop or laptop ) , all items in category
“RAM” should have a “compatibleProduct” column (
e.g. desktop or laptop ) and control the assignment of RAM to PRODUCT through
“dynamic” rules by selecting all the RAMs by passing the
“TYPE” of the product to the database handler.</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Am I making my point clear ?</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Abhay</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br clear=all>
This message contains information that may be privileged or confidential and is
the property of the KPIT Cummins Infosystems Ltd. It is intended only for the
person to whom it is addressed. If you are not the intended recipient, you are
not authorized to read, print, retain copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error, please
notify the sender immediately and delete all copies of this message. KPIT
Cummins Infosystems Ltd. does not accept any liability for virus infected
mails. <o:p></o:p></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br clear=all>
This message contains information that may be privileged or confidential and is
the property of the KPIT Cummins Infosystems Ltd. It is intended only for the
person to whom it is addressed. If you are not the intended recipient, you are
not authorized to read, print, retain copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error, please
notify the sender immediately and delete all copies of this message. KPIT
Cummins Infosystems Ltd. does not accept any liability for virus infected
mails. <o:p></o:p></span></font></p>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank"
ymailto="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><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
</div>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br clear=all>
This message contains information that may be privileged or confidential and is
the property of the KPIT Cummins Infosystems Ltd. It is intended only for the
person to whom it is addressed. If you are not the intended recipient, you are
not authorized to read, print, retain copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error, please
notify the sender immediately and delete all copies of this message. KPIT
Cummins Infosystems Ltd. does not accept any liability for virus infected
mails. <o:p></o:p></span></font></p>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank"
ymailto="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><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br clear=all>
This message contains information that may be privileged or confidential and is
the property of the KPIT Cummins Infosystems Ltd. It is intended only for the
person to whom it is addressed. If you are not the intended recipient, you are
not authorized to read, print, retain copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error, please
notify the sender immediately and delete all copies of this message. KPIT
Cummins Infosystems Ltd. does not accept any liability for virus infected
mails. <o:p></o:p></span></font></p>
</div>
</div>
</div>
</div>
<br clear=all> This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.
</body>
</html>