<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><div>Abhay,<br>&nbsp; You can use the normal Java gets (if your object has them).<br>&nbsp; <br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">when </span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$prod : Product (</span></font>$prod.getMemory().getRam().getType() == "DDR"<font face="Times New Roman" size="3"><span style="font-size: 12pt;">)</span></font></p>...<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<br><font face="Times New Roman" size="3"><span style="font-size: 12pt;"></span></font><p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br></span></font></p><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Abhay B. Chaware &lt;Abhay.Chaware@kpitcummins.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> Rules Users List &lt;rules-users@lists.jboss.org&gt;<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<br></font><br>


 
 

 

<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;}
 
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;}
 _filtered {margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {}
-->
</style>



<div class="Section1">

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">OK. Another one.&nbsp; How do I access and use
a property of a member variable ( object ) of an object, in rules ? &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">e.g.&nbsp; in the same example, I need to check
</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">1) &nbsp;if a product of type ‘laptop’ is
inserted in memory AND</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">2)&nbsp; if the product’s MEMORY property (
object ) has an object of type DDR ram attached.</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">In other words, here is the relationship
of facts -&nbsp; </span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">PRODUCT has member variable MEMORY ( which
is an object ) </span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">MEMORY has member variable RAM ( which is again
an object )</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">RAM has member variable TYPE ( which should
be equal to “DDR” )</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; 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></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<div>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Regards,</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 11pt; font-family: Arial; color: navy;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Abhay Chaware</span></font></p> 

<p class="MsoNormal"><font color="navy" face="Arial" size="1"><span style="font-size: 7.5pt; font-family: Arial; color: navy;"><span>Sr. Designer | KPIT Cummins Infosystems Ltd
| Board: +91 020 6652 5000 | Extn: 2989&nbsp; | abhay.chaware@kpitcummins.com
|<a target="_blank" href="http://www.kpitcummins.com">www.kpitcummins.com</a>&nbsp;</span></span></font><font color="navy"><span style="color: navy;"></span></font></p> 

<p class="MsoNormal" style=""><font color="green" face="Webdings" size="5"><span style="font-size: 18pt; font-family: Webdings; color: green;">P</span></font><font color="black" face="Webdings" size="2"><span style="font-size: 11pt; font-family: Webdings; color: black;"> </span></font><font color="green" face="Tahoma" size="1"><span style="font-size: 7.5pt; font-family: Tahoma; color: green;">Please consider the environment before printing this e-mail</span></font></p> 

</div>

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr tabindex="-1" width="100%" align="center" size="2">

</span></font></div>

<p class="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; 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> Rules
 Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] FW:
Basic rules question</span></font></p> 

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> &nbsp;</span></font></p> 

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Yes :)</span></font></p> 

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">2011/5/9 Abhay B. Chaware &lt;<a rel="nofollow" ymailto="mailto:Abhay.Chaware@kpitcummins.com" target="_blank" href="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>&gt;</span></font></p> 

<div>

<div>

<div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Mike,</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">What I meant was,
There are say 10 objects of RAM in memory whose type is DDR. &nbsp;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.</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">I am reading about
the “collect” which can be used to create collections from fact objects in
memory. &nbsp;&nbsp;Something like.</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">When </span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$prod : Product (type==’laptop’)</span></font></p> 

<p class="MsoNormal" style="text-indent: 0.5in;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">$compatibleRAMs : ArrayList() from collect (RAM (type == ‘DDR’)) </span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Then</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$prod.setCompatibleRAMs($compatibleRAMs);</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Am I on the right
track ?</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">-abhay</span></font></p> 

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<div class="MsoNormal" style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr width="100%" align="center" size="2">

</span></font></div>

<p class="MsoNormal" style=""><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> <a rel="nofollow" ymailto="mailto:rules-users-bounces@lists.jboss.org" target="_blank" href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a rel="nofollow" ymailto="mailto:rules-users-bounces@lists.jboss.org" target="_blank" href="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> Rules
 Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] FW:
Basic rules question</span></font></p> 

</div>

<div>

<div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">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: &quot;Courier New&quot;;">when<br>
&nbsp;&nbsp;&nbsp; $c : Computer( $type : type )<br>
&nbsp;&nbsp;&nbsp; $r : RAM( compatibleWith == $type )<br>
then<br>
&nbsp;&nbsp; $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: &quot;Courier New&quot;;">when<br>
&nbsp;&nbsp;&nbsp; $l : MyList( )<br>
&nbsp;&nbsp;&nbsp; $c : Computer( $type : type )<br>
&nbsp;&nbsp;&nbsp; $r : RAM( compatibleWith == $type ) from $l<br>
then<br>
&nbsp;&nbsp;&nbsp; $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: &quot;Courier New&quot;;">when<br>
&nbsp;&nbsp;&nbsp; $l : MyList( $t : typeRAM )<br>
&nbsp;&nbsp;&nbsp; RAM( $c : $t )<br>
then<br>
&nbsp;&nbsp;&nbsp; $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</p> 

<div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">2011/5/9 Abhay B.
Chaware &lt;<a rel="nofollow" ymailto="mailto:Abhay.Chaware@kpitcummins.com" target="_blank" href="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>&gt;</span></font></p> 

<div>

<div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Wendy, </span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks for helping me out so far. </span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">I have another question. What if I have all my “RAM” objects
inserted into working memory. &nbsp;&nbsp;How should I write my rule’s “when”
portion to get a collection of all the RAM objects matching type “DDR” ?
&nbsp;In other words, can I get collection of facts assigned to a variable and
use it in the “then” part ?</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks</span></font></p> 

<div>

<div>

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Abhay</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">==================================</span></font></p> 

<p class="MsoNormal" style=""><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> <a rel="nofollow" ymailto="mailto:rules-users-bounces@lists.jboss.org" target="_blank" href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a rel="nofollow" ymailto="mailto:rules-users-bounces@lists.jboss.org" target="_blank" href="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> Rules
 Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Basic
rules question</span></font></p> 

<p class="MsoNormal" style=""><font color="black" face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial; color: black;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="black" face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial; color: black;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="black" face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial; color: black;">Q2:<br>
&nbsp; So the rule would be something like:<br>
<br>
rule "RAM type"<br>
&nbsp; when<br>
&nbsp;&nbsp;&nbsp;&nbsp; $product: Product(type == "laptop");<br>
&nbsp;then<br>
&nbsp;&nbsp;&nbsp;&nbsp; //you are looking for the best way to set valid RAM
types in the then part of the rule?<br>
&nbsp;&nbsp;&nbsp; $product.setRamType("DDR");<br>
&nbsp;&nbsp;&nbsp; //or<br>
&nbsp;&nbsp; $product.setValidRamOptions( getValidRamOptions("DDR"));<br>
&nbsp;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.&nbsp; Or if
RamOptions were an object in memory you could have a rule like:<br>
<br>
rule "RAM type"<br>
&nbsp; when<br>
&nbsp;&nbsp;&nbsp;&nbsp; $product: Product(type == "laptop");<br>
&nbsp;&nbsp;&nbsp;&nbsp; $ramOptions: RAMOptions(type == "DDR");<br>
<br>
&nbsp;then<br>
&nbsp;&nbsp; $product.setValidRamOptions( $ramOptions.getList());<br>
&nbsp;end<br>
<br>
<br>
<br>
<br>
Wendy</span></font></p> 

<p class="MsoNormal" style=""><font color="black" face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial; color: black;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">==================================</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p> 

<div>

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Regards,</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 11pt; font-family: Arial; color: navy;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Abhay Chaware</span></font></p> 

<p class="MsoNormal" style=""><font color="navy" face="Arial" size="1"><span style="font-size: 7.5pt; font-family: Arial; color: navy;">Sr. Designer | KPIT Cummins Infosystems Ltd | Board: +91 020 6652
5000 | Extn: 2989&nbsp; | <a rel="nofollow" ymailto="mailto:abhay.chaware@kpitcummins.com" target="_blank" href="mailto:abhay.chaware@kpitcummins.com">abhay.chaware@kpitcummins.com</a> |<a rel="nofollow" target="_blank" href="http://www.kpitcummins.com">www.kpitcummins.com</a>&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font color="green" face="Webdings" size="5"><span style="font-size: 18pt; font-family: Webdings; color: green;">P</span></font><font color="black" face="Webdings" size="2"><span style="font-size: 11pt; font-family: Webdings; color: black;"> </span></font><font color="green" face="Tahoma" size="1"><span style="font-size: 7.5pt; font-family: Tahoma; color: green;">Please consider the environment before printing this e-mail</span></font></p> 

</div>

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr width="100%" align="center" size="2">

</span></font></div>

<p class="MsoNormal" style=""><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> <a rel="nofollow" ymailto="mailto:rules-users-bounces@lists.jboss.org" target="_blank" href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a rel="nofollow" ymailto="mailto:rules-users-bounces@lists.jboss.org" target="_blank" href="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> Rules
 Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Basic
rules question</span></font></p> 

</div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

<div>

<p class="MsoNormal" style=""><font face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial;">Abhay,<br>
&nbsp; Q1:&nbsp; I think that this will depend on how many different products
you have.&nbsp; If there is a small number it is more straight forward to have
a rule for each one (so the 2nd option).&nbsp; This allows all you logic to be in
one place.&nbsp; 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.&nbsp; Is that helpful?<br>
<br>
&nbsp; Q2: I'm not quite sure what you are getting at in Q2.&nbsp; Are you
trying to write validation rules or rules that are modifying the facts?</span></font></p> 

<div>

<p class="MsoNormal" style=""><font face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial;">&nbsp;</span></font></p> 

</div>

<div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial;">Wendy</span></font></p> 

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">

<hr width="100%" align="center" size="1">

</span></font></div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> Abhay B. Chaware &lt;<a rel="nofollow" ymailto="mailto:Abhay.Chaware@kpitcummins.com" target="_blank" href="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>&gt;<br>
<b><span style="font-weight: bold;">To:</span></b> "<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>"
&lt;<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<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></p> 

<div>

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hi </span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; 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></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Q1 - Should
rules be data/model specific or can/should they be generic or both</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">==========================================================</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">e.g.&nbsp; </span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; 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></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">OR</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">If selected product
is “IBM T42”, then category “RAM” should have “512MB DDR” , “1024MB DDR”,
“2048MB DDR”&nbsp; compatible. ( assigning individual items in rules )</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">OR</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Combination
of both</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Q2 – How
should be the data modeled in above case</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">==========================================================</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">e.g.&nbsp; </span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; 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></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">OR</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; 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” &nbsp;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></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Am I making
my point clear ?</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Thanks</span></font></p> 

<p class="MsoNormal" style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Abhay</span></font></p> 

</div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><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. </span></font></p> 

</div>

</div>

</div>

</div>

</div>

</div>

<div>

<div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><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. </span></font></p> 

</div>

</div>

</div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></span></font></p> 

</div>

<p class="MsoNormal" style=""><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p> 

</div>

</div>

</div>

<div>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><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. </span></font></p> 

</div>

</div>

</div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></span></font></p> 

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> &nbsp;</span></font></p> 

</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.
</div></div>
</div></body></html>