<br> Yap.<br><br> This was one of the latest pieces of code I've been working on. Basically Drools continues to support property setting in conf files, system properties, and directly through the setProperty() method on KnowledgeBaseConfiguration. What I added was type-safe configuration through the Options API:<br>
<br><a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/conf/KnowledgeBaseConfigurationTest.java">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/conf/KnowledgeBaseConfigurationTest.java</a><br>
<br> Quick example:<br><br> KnowledgeBaseConfiguration kbconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br> kbconf.setOption( AssertBehaviorOption.EQUALITY );<br> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( kbconf );<br>
<br> Feedback and help documenting, more than welcome... ;)<br><br> []s<br> Edson<br><br><br><div class="gmail_quote">2009/2/24 Zoltan Farkas <span dir="ltr"><<a href="mailto:zoly@daxtechnologies.com">zoly@daxtechnologies.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="blue" lang="EN-US">
<div>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Another thing, I checked the documentation
on how to set the assert behaviour to equality:</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">RuleBaseConfiguration conf = new
RuleBaseConfiguration();</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">conf.setAssertBehaviour(
AssertBehaviour.IDENTITY );</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">conf.setRemoveIdentities( true );</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">RuleBase ruleBase = RuleBaseFactory.newRuleBase(
conf );</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I am assuming this is how it is done with
the old api, how do you do it with the new api?</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I am assuming it is somehow done with the
new enum AssertBehaviorOption. Any idea how is the new way?</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">--zoly</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<div>
<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">
<hr align="center" size="2" width="100%">
</span></font></div>
<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b><span style="font-weight: bold;">On
Behalf Of </span></b>Edson Tirelli<br>
<b><span style="font-weight: bold;">Sent:</span></b> Tuesday, February 24, 2009
1:59 PM<div><div></div><div class="Wj3C7c"><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] drrols
type declaration and how are the equals and hashcode for those types
implemented...</div></div></span></font></p>
</div><div><div></div><div class="Wj3C7c">
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
The documentation for "fusion" related metadata is in
the fusion docs. Follow the same link, but look for drools-fusion docs instead
of drools-expert docs. Feedback welcome, improvement patches welcome too.<br>
<br>
I need to check with Michael what is the status of the support in
guvnor, but the idea is obviously to support that in there too.<br>
<br>
[]s<br>
Edson</span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2009/2/24 Zoltan Farkas <<a href="mailto:zoly@daxtechnologies.com" target="_blank">zoly@daxtechnologies.com</a>></span></font></p>
<div link="blue" vlink="blue">
<div>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I could write a patch emphasizing the use of it, but first I
would like to understand the metadata part.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">The following metadata that I saw on some blogs is also in my
interest: @role, @timestamp, and the documentation misses them too, I found
them only in some blog entries.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Can you point me to any resource (blogs, code
) that
can give me a better understanding so that I can write something of decent
quality?</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Also it would be nice to have metadata support in the guvnor
fact model builder.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">--zoly</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<div>
<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">
<hr align="center" size="2" width="100%">
</span></font></div>
<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>]
<b><span style="font-weight: bold;">On Behalf Of </span></b>Edson Tirelli<br>
<b><span style="font-weight: bold;">Sent:</span></b> Monday, February 23, 2009
7:49 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] drrols
type declaration and how are the equals and hashcode for those types
implemented...</span></font></p>
</div>
<div>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
We need to improve docs on that, as it is only
mentioned briefly:<br>
<br>
<a href="https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html/ch07.html#d0e3206" target="_blank">https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html/ch07.html#d0e3206</a><br>
<br>
The @key will do it for you:<br>
<br>
declare Person<br>
name : String<br>
ssn : BigDecimal @key<br>
age : int<br>
end<br>
<br>
Wanna write a quick patch for the docs emphasizing the
use of it?<br>
<br>
Thanks,<br>
<br>
[]s<br>
Edson</span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2009/2/23
Zoltan Farkas <<a href="mailto:zoly@daxtechnologies.com" target="_blank">zoly@daxtechnologies.com</a>></span></font></p>
<div link="blue" vlink="blue">
<div>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">declare Person</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> name : String</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> ssn: BigDecimal</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> age : int</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">end</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Is there a way to define what field/s identify a Person?</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">In the example above I would like to define ssn as the unique
indentifier for person, so person1 == person2 if person1.ssn == person2.ssn.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">In this case equals would use only the field ssn to determine
if 2 person objects are equal.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">The hashcode should also be based only on the ssn field.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I want to use Person with assertBehaviour equality
</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">--zoly</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
</div>
</div>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></span></font></p>
</div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<br clear="all">
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a></span></font></p>
</div>
</div>
</div>
</div>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></span></font></p>
</div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<br clear="all">
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a></span></font></p>
</div></div></div>
</div>
<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><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>