<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="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
h1
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        page-break-after:avoid;
        font-size:16.0pt;
        font-family:Arial;}
h2
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        page-break-after:avoid;
        font-size:14.0pt;
        font-family:Arial;
        font-style:italic;}
h3
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        page-break-after:avoid;
        font-size:13.0pt;
        font-family:Arial;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:6.0pt;
        margin-left:0in;
        font-size:10.0pt;
        font-family:"Times New Roman";
        font-weight:bold;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        text-align:center;
        font-size:16.0pt;
        font-family:Arial;
        font-weight:bold;}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:6.0pt;
        margin-left:0in;
        text-indent:.5in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        text-align:center;
        font-size:12.0pt;
        font-family:Arial;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p.Code, li.Code, div.Code
        {margin:0in;
        margin-bottom:.0001pt;
        background:#F3F3F3;
        border:none;
        padding:0in;
        font-size:9.0pt;
        font-family:"Courier New";}
span.EmailStyle22
        {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>
<!--[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=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Not getting into whether this is a bad
practice, the only language I&#8217;ve ever seen support this syntax is COBOL.
Every other language I&#8217;ve worked in (and there are many) do not support
this technique, so it seems reasonable that this syntax should be disallowed in
drools as well.<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'><o:p>&nbsp;</o:p></span></font></p>

<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>Edson Tirelli<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, March 16, 2009 9:58
AM<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] single
binding for or CE flagged by compiler</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>&nbsp;</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'><br>
&nbsp;&nbsp; This is an old discussion. Single binding on &quot;or&quot; is a
non-orthogonal special case on the language syntax that was introduced in the
early days when we only had &quot;infix&quot; CEs. When we started to support
prefix CE, the special case was not updated, and as a result, the single
binding works only with infix.<br>
<br>
&nbsp;&nbsp; IMO, this syntax promotes bad practices and should be disallowed.
Although, some people like it and it is still in there. Just to clarify why I
think it promotes bad practice:<br>
<br>
* When you have the same object type for all the patterns inside an
&quot;or&quot; group, you should be using constraint connector ||, not the
&quot;or&quot; CE. Using your example:<br>
<br>
$t : Trigger( fa == 1 || == 2 ) // or any variation of the syntax.<br>
<br>
&nbsp;&nbsp; This keeps the network smaller and prevents unexpected behavior
when the constraints are not mutually exclusive and in some cases people forget
that the rule will fire once for each logical branch when using &quot;or&quot;.<br>
<br>
* If the object types are different, then you can't use single binding anyway:<br>
<br>
$o&nbsp; : ( Cheese() or Wine() ) // this will lead to ClassCastExceptions on
the usage of $o.<br>
<br>
&nbsp;&nbsp; So, I really think that the &quot;single binding or&quot;
fulfilled its purpose on Drools 3, when we didn't had all the flexibility in
the language we have today. But now, the only thing it achieves is promoting
bad practices.<br>
<br>
&nbsp;&nbsp; Just my 0.02c.<br>
<br>
&nbsp;&nbsp; []s<br>
&nbsp;&nbsp; Edson<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2009/3/16 Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;<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'>As far as I know, this
should work:<br>
<br>
package <st1:City w:st="on"><st1:place w:st="on">orel</st1:place></st1:City>;<br>
import orel.Main.Trigger;<br>
rule ror1<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $t : (or Trigger(fa == 1)<br>
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Trigger(fa == 2))<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println( &quot;fired &quot; +
$t.getName() );<br>
end<br>
<br>
This is what Drools-5.0.0 kbuilder.getErrors().toString() returns:<br>
<br>
[5,11]: [ERR 102] Line 5:11 mismatched input 'Trigger' expecting '(' in rule
ror1 in pattern or[6,14]: [ERR 102] Line 6:14 mismatched input 'Trigger'
expecting ')' in rule ror1[6,30]: [ERR 102] Line 6:30 mismatched input ')'
expecting 'then' in rule ror1<br>
<br>
Shouldn't toString() insert line ends? As it is, the result is pretty much
useless.<br>
<br>
This works:<br>
rule ror1<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (or $t : Trigger(fa == 1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $t :
Trigger(fa == 2))<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println( &quot;fired &quot; +
$t.getName() );<br>
end<br>
<font color="#888888"><span style='color:#888888'><br>
-W<br>
<br>
</span></font><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="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'><br>
<br clear=all>
<br>
-- <br>
&nbsp;Edson Tirelli<br>
&nbsp;JBoss Drools Core Development<br>
&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><o:p></o:p></span></font></p>

</div>

</body>

</html>