Writing rules using java..
by Kolla, Sandeep
Hi Rahul,
Its not about storing the whole file into the database.
I would have a Table representing the parameteres required to construct
a rule.
For example.
Tables:
RuleSetTable:
Ruleset_id
Ruleset_name
RuleTable:
Rule_id
Rule_name
Rule_saliance
Rule_condition
Rule_consequence
Ruleset_id
Now while loading the rules the application basically should read from
the DB, and construct the rules, as everything required to construct the
rules is avaliable in the tables.
This requirement had come up because as the rules keep changing quite
frequently, we don't want to bring down the application to load a new
DRL file.
Hope you understood what I want to achieve.
Thanks much,
Sandeep.
16 years, 2 months
RE: Rules with Lookup Tables...
by Rahul Phadnis
Have you looked at
http://labs.jboss.com/portal/jbossrules/subversion.html
I think that page is not uptodate since at the bottom
it says "Trunk is unstable and may often not build. If
you wish to build form Subversion source the latest
tag is:
http://anonsvn.labs.jboss.com/labs/jbossrules/tags/3.0.3-GA/
"
Are n't we at 3.0.5 already?
-Rahul
--- jjdepaul(a)us.ibm.com wrote:
> Rahul -
>
> Where can I find Maven2 repository that has the
> nightly builds for Drools project?! I've looked
> around on a couple of well-known ones abut no luck
> finding anything above D3.0.5
>
> thanks,
> james
> >
> > The "from" CE (conditional expression) is not
> > available in the current released jboss rules
> version
> > (3.0.5) and you probably have to use the nightly
> build
> > to use it.
> >
> > -Rahul
> >
> >
>
>
16 years, 6 months
RE: [rules-users] Using rules with database scenario
by Uday Kamath
We had similar use case. What we do is we model the Schema elements,
generate Java Beans (pojo), and write rules using these Pojo. Now we
have written a Service on top which takes Hibernate QL and gets the
database records as the same Pojos that Rules are defined on and fire
the Rules. Thus the service is generic and can be changed to take any
Query. The Rules can me modified and changed anytime and redeployed but
business objects in form of Pojos remain the same. Hope this helps
-Uday
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Joe Chuby
Sent: Friday, March 09, 2007 3:53 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Using rules with database scenario
Hi all,
First time trying to learn JBoss Rules here. We have a pretty large
database (DBMS), we want to build some rules and retrieve data based on
the rules.
Could someone give a hint or an example of this usage scenario? I mean,
how can I use rules for database query, without writing my rules in SQL
directly? We are currently writing everything in HQL (Hibernate), but
the rules change every 3 months on average, so that's not a way to
maintain the system. Therefore, we want to extract that portion of the
business logic out of the code. The data structure does not change, but
the rules keep on changing.
I'm reading the user's guide, running thru the examples, writing some of
my own, but still no clue how to make it work with database.
If someone could give a sample, that would be greatly appreciated.
Thanks a lot.
________________________________
Bored stiff? <http://us.rd.yahoo.com/evt=49935/*http:/games.yahoo.com>
Loosen up...
Download and play hundreds of games for free
<http://us.rd.yahoo.com/evt=49935/*http:/games.yahoo.com> on Yahoo!
Games.
17 years, 5 months
Need Help: Errors while running FibonacciExample
by venkatesh devalapura nagabhushana
Hi,
After successfully compiling the example code FibnacciExample.java, I
tried to run it, I get the following error, let me know how to solve it:
java FibonacciExample
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
at org.drools.semantics.java.RuleBuilder.<clinit>() (Unknown Source)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
at
org.drools.compiler.PackageBuilder.addRule(org.drools.lang.descr.RuleDescr) (Unknown Source)
at
org.drools.compiler.PackageBuilder.addPackage(org.drools.lang.descr.PackageDescr) (Unknown Source)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(java.io.Reader)
(Unknown Source)
at FibonacciExample.main(java.lang.String[]) (Unknown Source)
at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Caused by: java.util.regex.PatternSyntaxException: At position 2 in
regular expression pattern:
expected end of character class
(.*)\bmodify\s*\(([^)]+)\)(.*)
^
at java.util.regex.Pattern.Pattern(java.lang.String, int)
(/usr/lib/libgcj.so.6.0.0)
at java.util.regex.Pattern.compile(java.lang.String, int)
(/usr/lib/libgcj.so.6.0.0)
at org.drools.semantics.java.KnowledgeHelperFixer.<clinit>() (Unknown
Source) at java.lang.Class.initializeClass()
(/usr/lib/libgcj.so.6.0.0)
...8 more
Is it require to place .drl file in the same directory as that of the
source code ?
Thanks,
Venkatesh
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 6 months
function compilation error
by JLL
hi all
I've to following error when using one of my drl
Can't i use more than one param in the function call ?
thanks
JLL
javax.ejb.EJBTransactionRolledbackException:
org.drools.rule.InvalidRulePackage: Function Compilation error
Rule Compilation error The method getMin(PrestationFacturable,
PrestationFacturable) in the type GetMin is not applicable for the arguments
(PrestationFacturable, FactHandle)
the drl file is the folowing
package be.labocollard.server.rules ;
import be.labocollard.server.entities.PrestationFacturable;
import be.labocollard.server.entities.Prestation;
function PrestationFacturable getMin(PrestationFacturable pf1,
PrestationFacturable pf2) {
if (pf1.getPrestation().getNombreB() > pf2.getPrestation().getNombreB())
return pf1;
else return pf2;
}
rule "cumul_1"
when
$pf1 : PrestationFacturable( $p1 : prestation ->
($p1.getCodePrestation().equals("120153") ||
$p1.getCodePrestation().equals("120175") ||
$p1.getCodePrestation().equals("120190")))
$pf2 : PrestationFacturable( $p2 : prestation ->
($p2.getCodePrestation().equals("120050") ||
$p2.getCodePrestation().equals("120514")))
then
retract(getMin($pf1, $pf2));
end
--
View this message in context: http://www.nabble.com/function-compilation-error-tf3589880.html#a10032557
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 7 months
FW: Newbie: using a spreadsheet
by Hehl, Thomas
OK, here's my rules table:
RuleTable Court
CONDITION
CONDITION
ACTION
singleStatus: SingleParticipantStatus
singleStatus: SingleParticipantStatus
singleStatus: SingleParticipantStatus
statusType
value
singleStatus.setAnswer("$param");
And this generates a rule that looks like this, for example:
then singleStatus:
SingleParticipantStatus.singleStatus.setAnswer("statusOnly");;
This generates an error b/c it doesn't know how to resolve
SingleParticipantStatus.singleStatus.setAnswer, which is where the error
below is coming from.
So I changed the rule table to simply say:
setAnswer("$param");
Which generates:
then
singleStatus: SingleParticipantStatus.setAnswer("statusOnly");;
Which causes the non-static method error since setAnswer is an instance
method.
Can anyone tell me what I'm doing wrong?
Thanks.
_____
From: Hehl, Thomas
Sent: Monday, April 30, 2007 8:42 AM
To: 'rules-users(a)lists.jboss.org'
Subject: Newbie: using a spreadsheet
I've been following the ExamplePricePolicy example and am attempting to
build my own rules using a spreadsheet.
In my spreadsheet rules, I have the following:
ACTION
singleStatus: SingleParticipantStatus
singleStatus.setAnswer("$param");
This throws:
org.drools.rule.InvalidRulePackage: Rule Compilation error
SingleParticipantStatus.singleStatus cannot be resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
When I googled on this error, most of the occurrences appeared to be related
to an import issue, but if I change the third line to:
setAnswer("$param");
It blows up because it knows that setAnswer is not a static method, which
tends to tell me that it found my class.
I think I've parroted the example exactly and so I'm confused as to where to
go with this issue.
Thanks!
17 years, 8 months
3.1 M1 "from" keyword
by brad hadfield
Hi, I wonder if anyone could help me?
I'm attempting to use the 'from' keyword in the same fashion as the
sample found on the Release Notes/Language Improvement wiki. The
example shows a piece of syntax that uses the 'from' keyword to obtain
data via a Hibernate query. i.e:
$r : Restaurant( $postCode ) from hbSession.getNamedQuery( "some
query" ).setProperties( [ key1 : value2, key2 : value ] ).list()
I'm having difficulty executing syntax using this keyword because
Hibernate uses CGlib which relies on ASM 1.5.3 - the 'from' keyword
seems to rely on MVEL which uses ASM 3.0.
ASM 3.0 is not backwards compatible with ASM 1.5.3 and I get 'no such
method' errors.
So how does one get the 'from' keyword to work in an environment running
Hibernate?
Thanks,
Brad
17 years, 8 months
Newbie: using a spreadsheet
by Hehl, Thomas
I've been following the ExamplePricePolicy example and am attempting to
build my own rules using a spreadsheet.
In my spreadsheet rules, I have the following:
ACTION
singleStatus: SingleParticipantStatus
singleStatus.setAnswer("$param");
This throws:
org.drools.rule.InvalidRulePackage: Rule Compilation error
SingleParticipantStatus.singleStatus cannot be resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved
When I googled on this error, most of the occurrences appeared to be related
to an import issue, but if I change the third line to:
setAnswer("$param");
It blows up because it knows that setAnswer is not a static method, which
tends to tell me that it found my class.
I think I've parroted the example exactly and so I'm confused as to where to
go with this issue.
Thanks!
17 years, 8 months