<!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.2873" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT
size=2><STRONG>If</STRONG> you can add the CatalogObject element data to working
memory and <SPAN class=010334607-04042007><STRONG>if</STRONG> </SPAN>you
can add a connective property ("parent" in the rule below) you can eliminate the
use of "eval" (which does not allow the benefits of a RETE network to be fully
realised) I think a rule like the below<SPAN class=010334607-04042007> using
3.1-M1 would provide the same function as that shown by Michael Neale. Lots of
assumptions but performance would be better.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New"><FONT color=#0000ff><FONT
size=2><SPAN class=010334607-04042007>
</SPAN>rule "UCCnet_DVE_Depth_All"</FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff
size=2> when</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff
size=2>
catalogObject : CatalogObject( )</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff
size=2>
elementValue( name = "depth", value == null | == "", parent == catalogObject
)</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff
size=2> then</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff
size=2>
logWriter.logDebug( "Package Depth is Blank"); </FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff
size=2>
System.out.println( "Package Depth is Blank" );</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><FONT
face="Courier New"> end</FONT>
</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=010334607-04042007><FONT face=Arial color=#0000ff size=2>With
kind regards,</FONT></SPAN></DIV>
<DIV><SPAN class=010334607-04042007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=010334607-04042007><FONT face=Arial color=#0000ff
size=2>Mike</FONT></SPAN></DIV><BR>
<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>Michael
Neale<BR><B>Sent:</B> 04 April 2007 05:18<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> Re: [rules-users] Need DRL authoring
Help<BR></FONT><BR></DIV>
<DIV></DIV>you are close ;)<BR><BR>Yes, it is a challenge, thats what the
examples are for etc.<BR><BR>but try this (FYI I think you mean "or"):<BR><BR>
<P><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">rule</SPAN></FONT></B><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"> </SPAN></FONT><FONT face="Courier New"
color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green">"UCCnet_DVE_Depth_All"</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
</SPAN></FONT><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">when</SPAN></FONT></B><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
catalogObject : CatalogObject( </SPAN></FONT><FONT face="Courier New"
color=green size=2><SPAN style="FONT-SIZE: 10pt; COLOR: green">
</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">)</SPAN></FONT></P>
<P> eval( <FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">catalogObject.</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">getElementValue(</SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green"> "depth"</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">) == </SPAN></FONT><B><FONT
face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">null</SPAN></FONT></B><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"> || </SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">catalogObject.</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">getElementValue(</SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green"> "depth"</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">) == </SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green">"" )</SPAN></FONT><BR><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"></SPAN></FONT><FONT face="Courier New"
size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
String depth = CatalogObject.getElementValue("depth")</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
depth == null</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN></FONT> </P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
depth == ""</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN> </FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
catalogObject : CatalogObject( depth == null)</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
catalogObject : CatalogObject( depth == "")</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
</SPAN></FONT><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">then</SPAN></FONT></B><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
# DON'T do this
logWriter : LogWriter();</SPAN></FONT></P>
<P> # BUT you can pass in a
logWriter global variable <BR><FONT face="Courier New" color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"></SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
logWriter.logDebug(</SPAN></FONT><FONT face="Courier New" color=green
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: green"> "Package Depth is
Blank"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">);</SPAN></FONT><FONT face="Courier New"
size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
System.out.println( </SPAN></FONT><FONT face="Courier New" color=green
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: green">"Package Depth is
Blank"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"> ); </SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN></FONT></P><B><FONT face="Courier New"
color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">end</SPAN></FONT></B><BR><BR><BR>Hope
that helps.<BR>In the up coming BRMS, there will be a GUI which also has a
secret purpose of "coaching" what DRL looks like, for those who need to know.
<BR><BR>
<DIV><SPAN class=gmail_quote>On 4/4/07, <B class=gmail_sendername><A
href="mailto:John.Tal@gxs.com">John.Tal@gxs.com</A></B> <<A
href="mailto:John.Tal@gxs.com">John.Tal@gxs.com</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV lang=EN-US vlink="purple" link="blue">
<DIV>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Writing DRL is not easy for
people new to drools. Can someone please help me understand how
to write this simple rule? You can see the approaches I have
taken.</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">In this case I do not have
getters and setters for the attributes I am checking. I need to pass
parameters to the object for it to get the data.</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I can't get any of the code in
the when block to be syntax proper. Existing DRL doc is lacking in
this area.</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks
John</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">rule</SPAN></FONT></B><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"> </SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green">"UCCnet_DVE_Depth_All"</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN> </FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
</SPAN></FONT><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">when</SPAN></FONT></B><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
catalogObject : CatalogObject( getElementValue(</SPAN></FONT><FONT
face="Courier New" color=green size=2> <SPAN
style="FONT-SIZE: 10pt; COLOR: green">"depth"</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">) == </SPAN></FONT><B><FONT
face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">null</SPAN></FONT></B><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">, getElementValue(</SPAN></FONT><FONT
face="Courier New" color=green size=2> <SPAN
style="FONT-SIZE: 10pt; COLOR: green">"depth"</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">) == </SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green">""</SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">)</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
String depth = CatalogObject.getElementValue("depth")</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
depth == null</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN></FONT> </P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
depth == ""</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN> </FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
catalogObject : CatalogObject( depth == null)</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=olive size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: olive">#
catalogObject : CatalogObject( depth == "")</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
</SPAN></FONT><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">then</SPAN></FONT></B><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
logWriter : LogWriter();</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
logWriter.logDebug(</SPAN></FONT><FONT face="Courier New" color=green
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: green"> "Package Depth is
Blank"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">);</SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> </SPAN></FONT></P>
<P><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">
System.out.println( </SPAN></FONT><FONT face="Courier New" color=green
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: green">"Package Depth is
Blank"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"> ); </SPAN></FONT><FONT
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></P>
<P><B><FONT face="Courier New" color=#960000 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: rgb(150,0,0)">end</SPAN></FONT></B><FONT
face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
</SPAN></FONT></P></DIV></DIV><BR>_______________________________________________<BR>rules-users
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>