Drools web project in eclipse - Drools Library issue
by Malika
Hello,
I started to write web app using drools decision table. Here is what I have
in my web project in eclipse 3.3,
drools 4.0:
1. A Jsp page that takes input and pass it on to a servlet that fires the
rules.
2. Servlet class has import statements:
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.StatelessSession;
import org.drools.WorkingMemory; and so on..
3. When I run the jsp on tomcat, it starts but when i hit submit it throws
the exception:
java.lang.NoClassDefFoundError: org/drools/RuleBase
4. I have drools jar files added under project properties - build path-> add
external jars from
"C:\wtp_all_in_one\eclipse\configuration\org.eclipse.osgi\bundles\503\1\.cp\lib".
This is showing all drools jar files under Libraries hierarchy.
Could anyone please suggest what to do to resolve this error?
Thanks and Regards,
Malika
--
View this message in context: http://www.nabble.com/Drools-web-project-in-eclipse---Drools-Library-issu...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
custom defined types in setter and getters
by jack wu
Hi, i suppose the second form of fact is not supported. but i'd like to confirm.
in other words, you can only have setters and getters that return basic java types. is that right? can i return java collections such as array and map? the documentation is not clear on that.
thanks.
public class Paint
{
String getName();
String getColor();
}
public class Car
{
int getSize();
Paint getPaint();
}
jack.
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting
17 years, 1 month
How to have your emails ignored
by Mark Proctor
Did this for some fun, will add it to the mailing lists info page on the
website. Anyone else have some more ideas? I'll blog the final results :)
How to have your emails ignored:
Start the email with "URGENT"
Tell everyone how desparate you and how you need an immediate response
for your really important project.
Don't wait a minimum of 3 days and resend your email within minutes of
hours.
Send emails directly to mailing list members, especially the developers.
Paste pages of code and then say "it doesn't work, please help".
Paste a long stack trace and say "it doesn't work, please help".
Start your email with "please sirs" or include "do the needful".
Ask dumb questions that are in the manual.
Ask basic java questions.
Ask questions about JRules
17 years, 1 month
RE: [rules-users] rules precompilation
by Manukyan, Sergey
Did it immediately...
If you don't mind could you post code that works?
Thanks.
-Sergey
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Jin, Ming
Sent: Wednesday, October 03, 2007 3:40 PM
To: Rules Users List
Subject: RE: [rules-users] rules precompilation
Did you save the Package right after the creation from PackageBuilder,
or after some other processes?
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Manukyan,
Sergey
Sent: Wednesday, October 03, 2007 2:21 PM
To: Rules Users List
Subject: RE: [rules-users] rules precompilation
Ming, Ekke,
After deserialising the Package back - getting exception when inserting
facts:
Exception thrown : java.lang.NoClassDefFoundError: XXXShadowProxy
XXX - is my class name
Any ideas?
-Sergey
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Jin, Ming
Sent: Wednesday, October 03, 2007 1:50 PM
To: Rules Users List
Subject: RE: [rules-users] rules precompilation
Sergey,
I am using precompiled rules. Serializing instances of
org.drools.rule.Package works for me.
Thanks,
-Ming
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Manukyan,
Sergey
Sent: Wednesday, October 03, 2007 12:29 PM
To: Rules Users List
Subject: [rules-users] rules precompilation
Folks,
Where can I find information on how to pre-compile rules in 4.0.1?
Thanks,
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain legally privileged,
confidential or proprietary information. If you are not the intended
recipient(s), or the employee or agent responsible for delivery of this
message to the intended recipient(s), you are hereby notified that any
dissemination, distribution or copying of this E-mail message is
strictly prohibited. If you have received this message in error, please
immediately notify the sender and delete this E-mail message from your
computer.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 1 month
Rule Compilation error
by Michael Epstein
Hi,
I have a JBRMS question. I have DSL that I am using, when I build a rule in
the guided editor that uses the DSL it works fine. When I use the business
rule text edit, the same [when] fails validation.
Here is the error:
Rule Compilation error Expression "smcUnit" is not an rvalue Unknown
variable or type "smcUnit" Expression "smcUnit" is not an lvalue Unknown
variable or type "smcUnit" A method named "setSmcUnitId" is not declared in
any enclosing class nor any supertype, nor through a static import
Expression "smcUnit" is not an rvalue Expression "smcUnit" is not an rvalue
Expression "smcUnit" is not an rvalue Unknown variable or type "smcUnit"
Unknown variable or type "smcUnit" Expression "smcUnit" is not an rvalue
Expression "smcUnit" is not an rvalue Expression "smcUnit" is not an rvalue
Unknown variable or type "smcUnit" Exception:14 error(s) while compiling
unit "com/symark/smc/Rule_test2_0.java"
Here is the DSL:
[when]There is a Log=LogStartStop()
[when]- runUserId with a command run by user: '{id}'=runUserId == "{id}"
[when]- submitUserId with a command submitted by user: '{id}'=submitUserId
== "{id}"
[when]- runHostId with a command run on host: '{id}'=runHostId == "{id}"
[when]- submitHostId with a command submitted from host: '{id}'=submitHostId
== "{id}"
[then]Assign to unit with id: '{id}' = smcUnit = new SmcUnit() ;
smcUnit.setSmcUnitId("{id}") ; insert(smcUnit ) ;
And finally here is the rule:
when
There is a Log
- runUserId with a command run by user: 'smc_app_elton'
then
Assign to unit with id: '1'
Any help would be greatly appreciated.
Thanks,
Mike
17 years, 1 month
JBRMS - Decision Tables - Effective Dates & Expiration Dates
by Barry K
What is the direction for handling date-effective and date-expiration when
compiling decision tables?
Currently, org.drools.decisiontable.model.Rule does not have attributes for
effective or expiration date. I started going down the path of adding the
attributes to org.drools.decisiontable.model.Rule and using a custom
RulesheetListener to populate them, but I was concerned about
overcustomization the application. Are these attributes going to be added
for decision tables?
Thanks
Barry
--
View this message in context: http://www.nabble.com/JBRMS---Decision-Tables---Effective-Dates---Expirat...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
Re: [rules-users] Retract in a function
by Ronald R. DiFrango
Michael,
In my case, I am modifying the object, so I thought a modifyRetract was the
better option.
As for the differences, I will defer to the Drools team. Please note that
CC'ed the group again as you did not on my response.
Ron
On 10/3/07, Anstis, Michael (M.) <manstis1(a)ford.com> wrote:
>
> Thanks for posting the solution!
>
> Does it work with just "retract" rather than "modifyRetract"?
>
> Could the Drools' team remind me (the group) of the difference between the
> two?
>
> ------------------------------
> *From:* Ronald R. DiFrango [mailto:ron.difrango@gmail.com]
> *Sent:* 03 October 2007 14:57
> *To:* Anstis, Michael (M.)
> *Cc:* Rules Users List
> *Subject:* Re: [rules-users] Retract in a function
>
> I got it, the following works:
>
> function void openRTVLines(WorkingMemory workingMemory, QueryResults
> results, String status)
> {
> System.out.println( "We have " + results.size() + " Open RTV Lines" );
>
> for ( Iterator it = results.iterator(); it.hasNext(); ) {
> QueryResult result = ( QueryResult ) it.next();
> DetailLine line = ( DetailLine ) result.get( "line" );
> line.setStatus (status);
>
> // Now retract those objects from Working Memory
> FactHandle handle = workingMemory.getFactHandle(line);
> System.out.println("handle : " + handle);
> workingMemory.modifyRetract(handle);
> }
> }
>
> On 10/3/07, Ronald R. DiFrango <ron.difrango(a)gmail.com > wrote:
> >
> > I have now tried the following and it did not seem to have the intended
> > result of removing the detail line from working memory:
> >
> > function void openRTVLines(WorkingMemory workingMemory, QueryResults
> > results, String status)
> > {
> > System.out.println( "We have " + results.size() + " Open RTV Lines"
> > );
> > for ( Iterator it = results.iterator(); it.hasNext(); ) {
> > QueryResult result = ( QueryResult ) it.next ();
> > DetailLine line = ( DetailLine ) result.get( "line" );
> > line.setStatus(status);
> >
> > // Now retract those objects from Working Memory
> > FactHandle[] handles = result.getFactHandles();
> > System.out.println("handles.length : " + handles.length);
> > for(int i = 0; i < handles.length; i++)
> > {
> > System.out.println("Retracting : ");
> > workingMemory.retract(handles[i]);
> > }
> > }
> > }
> >
> > Any other thoughts out there?
> >
> > On 10/3/07, Ronald R. DiFrango < ron.difrango(a)gmail.com> wrote:
> > >
> > > Michael,
> > >
> > > Those detail lines are in working memory for sure. In fact the query
> > > it self only works on working memory objects.
> > >
> > > As far as I know you can not place the results of a queryResult in the
> > > LHS.
> > >
> > > Ron
> > >
> > > On 10/3/07, Anstis, Michael (M.) < manstis1(a)ford.com> wrote:
> > > >
> > > > Can you not get a reference to a DetailLine in the LHS?
> > > >
> > > > If you have not inserted DetailLine objects into working memory how
> > > > can you expect to retract them?
> > > >
> > > > If you have inserted DetailLine's into working memory what does
> > > > query "Open RTV Lines" return, can it be joined into the LHS? (or split into
> > > > two rules)?
> > > >
> > > > ------------------------------
> > > > *From:* rules-users-bounces(a)lists.jboss.org [mailto:
> > > > rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Ronald R.
> > > > DiFrango
> > > > *Sent:* 03 October 2007 14:01
> > > > *To:* Rules Users List
> > > > *Subject:* [rules-users] Retract in a function
> > > >
> > > > All,
> > > >
> > > > I have the following function that I call from all of my rules.
> > > > When I execute this function, I need to retract that object from working
> > > > memory. The problem is that when I insert the comment line below I get a
> > > > compiler error saying that I can only issue a retract on fact handles.
> > > >
> > > > Here is an example of my rule plus the function:
> > > >
> > > > rule "QTY Percentage tolerance - Approval"
> > > > salience -25
> > > > no-loop true
> > > > when
> > > > rtvHeader : RtvHeader( totalAmount : totalAmount, status not
> > > > in ( StatusConstants.MATCHED, StatusConstants.APPROVAL) )
> > > > repaymentCode : RepaymentCode( code == "QTY", matchApprv ==
> > > > "Y", tolDollar ==0, tolPercent != 0, tolPercent : tolPercent )
> > > > qtyOutput : QTYOutput( sumRTVQty : sumRTVQty , sumCmAndRnr :
> > > > sumCmAndRnr )
> > > > eval( qtyPercentage(qtyOutput, totalAmount, tolPercent) )
> > > > then
> > > > System.out.println("QTY Percentage tolerance - No
> > > > Approval");
> > > > rtvHeader.setStatus(StatusConstants.APPROVAL );
> > > > openRTVLines(drools.getWorkingMemory(),
> > > > drools.getWorkingMemory().getQueryResults( "Open RTV Lines" ),
> > > > StatusConstants.MATCHED_WITHIN_TOLERANCE);
> > > > end
> > > >
> > > > function void openRTVLines(WorkingMemory workingMemory, QueryResults
> > > > results, String status)
> > > > {
> > > > System.out.println( "We have " + results.size() + " Open RTV
> > > > Lines" );
> > > > for ( Iterator it = results.iterator(); it.hasNext(); ) {
> > > > QueryResult result = ( QueryResult ) it.next ();
> > > > DetailLine line = ( DetailLine ) result.get( "line" );
> > > > line.setStatus(status);
> > > >
> > > > // I need to add this in
> > > > // workingMemory.retract(line);
> > > > }
> > > > }
> > > >
> > > > Thanks in advance,
> > > >
> > > > Ron
> > > >
> > > >
> > > >
> > >
> >
>
>
17 years, 1 month
Drools 4.0 StateExampleWithDynamicRules Question
by Daren Chylinski
Hello,
I am a new Drools user working my way through the examples. To test my
understanding of how the rules work, I modified the
StateExampleUsingSalience.drl file used in the
StateExampleWithDynamicRules example. The result of my change
conflicted with my understanding of how the rules should work.
I made two modifications in the StateExampleUsingSalience.drl file. The
two modifications (shown below) are the commenting out of the two lines
in the RHS portion of the "B to D" rule. My understanding of how this
would affect the result was: because the "D" State object never changes
state to "State.FINISHED" the RHS portion of the "D to E" rule (shown
below) would not execute because the first pattern in the LHS would fail
to find a State object in working memory that met the criteria of the
constraint groups defined within it.
My question is: Why does the "D to E" rule in the
StateExampleDynamicRules.drl execute the statements in the RHS portion
of the rule?
>From StateExampleUsingSalience.drl: My changes in this file are the two
lines commented out in the RHS portion.
rule "B to D"
when
State(name == "B", state == State.FINISHED )
d : State(name == "D", state == State.NOTRUN )
then
//System.out.println(d.getName() + " finished" );
//d.setState( State.FINISHED );
end
>From StateExampleDynamicRules.drl: This is the rule where I expected
the RHS portion to NOT get executed because there aren't any State
objects in working memory that have their name == "D" and its state ==
State.FINISHED because the setState( State.FINISHED ) was never executed
on the "D" state object.
rule "D to E"
when
State(name == "D", state == State.FINISHED )
e : State(name == "E", state == State.NOTRUN )
then
System.out.println(e.getName() + " finished" );
e.setState( State.FINISHED );
end
After my modifications, the output was:
A finished
B finished
C finished
E finished
I did not expect the "E finished" message to be printed.
Regards,
Daren
17 years, 1 month
URGENT: BRMS - how to use variables on Action part?
by Felipe Piccolini
Anyone knows how to use variables (from fields) setted on LHS, to
modify a field on the RHS using the GUI editor
from BRMS?
What I need is to write this rule on BRMS.
rule "Set approvedMount for a women"
no-loop true
when
$p: Person($sex: sex == "F", $income: incomeMount)
then
$p.setApprovedMount($income * 1.2);
update($p);
end
I know I can use formulas, but I only know how to set those on LHS, I
dont know how to put a formula on RHS (setter of the field to modify).
Thanks.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 1 month
Retract in a function
by Ronald R. DiFrango
All,
I have the following function that I call from all of my rules. When I
execute this function, I need to retract that object from working memory.
The problem is that when I insert the comment line below I get a compiler
error saying that I can only issue a retract on fact handles.
Here is an example of my rule plus the function:
rule "QTY Percentage tolerance - Approval"
salience -25
no-loop true
when
rtvHeader : RtvHeader( totalAmount : totalAmount, status not in (
StatusConstants.MATCHED, StatusConstants.APPROVAL) )
repaymentCode : RepaymentCode( code == "QTY", matchApprv == "Y",
tolDollar ==0, tolPercent != 0, tolPercent : tolPercent )
qtyOutput : QTYOutput( sumRTVQty : sumRTVQty , sumCmAndRnr :
sumCmAndRnr )
eval( qtyPercentage(qtyOutput, totalAmount, tolPercent) )
then
System.out.println("QTY Percentage tolerance - No Approval");
rtvHeader.setStatus(StatusConstants.APPROVAL);
openRTVLines(drools.getWorkingMemory(),
drools.getWorkingMemory().getQueryResults(
"Open RTV Lines" ), StatusConstants.MATCHED_WITHIN_TOLERANCE);
end
function void openRTVLines(WorkingMemory workingMemory, QueryResults
results, String status)
{
System.out.println( "We have " + results.size() + " Open RTV Lines" );
for ( Iterator it = results.iterator(); it.hasNext(); ) {
QueryResult result = ( QueryResult ) it.next();
DetailLine line = ( DetailLine ) result.get( "line" );
line.setStatus(status);
// I need to add this in
// workingMemory.retract(line);
}
}
Thanks in advance,
Ron
17 years, 1 month