<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2>Hi Richard,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2>The "when" section matches fact (object) patterns, so your 
requirement could be written as:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>when there is a Test Fact 'A' and another Test Fact 'B' 
where "the 'x' property of&nbsp;'A'" equals "the 'y' property of&nbsp;fact 'B' 
plus 1"&nbsp;then.....</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2>This would become:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>rule "Rule 1"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>when</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;Test(&nbsp;$y : y 
)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;Test(&nbsp;x == ($y + 1) 
)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>then</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff 
size=2>System.out.println("Rule 1 matches");</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face="Courier New" 
color=#0000ff size=2>end</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=557095308-02052008><FONT face=Arial 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=557095308-02052008></SPAN><FONT face=Arial><FONT 
color=#0000ff><FONT 
size=2>By&nbsp;default&nbsp;both&nbsp;patterns&nbsp;can&nbsp;match&nbsp;the&nbsp;same&nbsp;object,&nbsp;so&nbsp;test&nbsp;data:-</FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT 
size=2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=557095308-02052008>A : x = 1, y = 1</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=557095308-02052008>B : x = 2, y = 1</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008>Will cause the rule to activate 
twice:-</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=557095308-02052008>A and B</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face="Courier New" color=#0000ff size=2><SPAN 
class=557095308-02052008>B and B</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008>With kind regards,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=557095308-02052008>Mike</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><BR></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
  [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Richard 
  Bremner<BR><B>Sent:</B> 02 May 2008 08:53<BR><B>To:</B> 
  rules-users@lists.jboss.org<BR><B>Subject:</B> [rules-users] newbie question 
  on "when" condition syntax<BR></FONT><BR></DIV>
  <DIV></DIV>Hi, <BR><BR>say I have a class with two fields, x and y: 
  <BR><BR>public class Test { <BR>&nbsp; &nbsp; int x = 1; <BR>&nbsp; &nbsp; int 
  y = 2; <BR><BR>&nbsp; &nbsp; getters/setters... <BR>} <BR><BR><BR>I would like 
  a rule which fires when y = x + 1 <BR><BR>my initial thought would be 
  something like: <BR><BR>rule "Rule 1" <BR>&nbsp; &nbsp; &nbsp; &nbsp; 
  <BR>&nbsp; &nbsp; &nbsp; &nbsp; when <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
  &nbsp; &nbsp; &nbsp; test : Test (y == x + 1) <BR>&nbsp; &nbsp; &nbsp; &nbsp; 
  then <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
  System.out.println("Rule 1 matches."); <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
  &nbsp; &nbsp; &nbsp; <BR>end <BR><BR><BR>but this is invalid syntax and I can 
  not find any examples of such a rule. I'm doing my best but reading the manual 
  etc. I'm struggling with the syntax here and can't figure it out.<BR><BR>any 
  help really appreciated! </BLOCKQUOTE></BODY></HTML>