Drools5M3 Issues
by keithnielsen
Ok,
I tried to upgrade from M2 to M3. Big Mistake
I see that you have attempted to separate the interface from the
implementation by moving most of
the interfaces that are intended for public consumption from drools-core to
a new jar file called drools-api.
Unfortunately there appears a few different problems with this
1) Unfortunately you have duplicated package names (drools.core) as well
duplicated numerous classes across the two jar files
(WorkingMemoryEntryPoint and FactHandle to name a few)
2) StatefulSession interface has not been moved to drools-api and only exist
in drools-core
This makes this build unusable in Eclipse 3.4 as is. Also I am using Eclipse
as a runtime platform and this makes it impossible to simply expose the api
classes as intended, because when you you embed the rules engine as a plugin
you have to expose those packages containing the api you wish to expose, in
drools case that would be drools-api, unfortunately StatefulSession is still
in drools-core for example forcing me to export both drools-core and
drools-api which defeats the purpose of having drools-api since I have to
expose implementation classes from drools-core which also now exposes
duplicate classes, such as FactHandle and WorkingMemoryEntryPoint
--
View this message in context: http://www.nabble.com/Drools5M3-Issues-tp20727815p20727815.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 1 month
DAO call in LHS
by techy
though I referred other thread about this topic, I'm not successful to make a
dao call.
I beg your pardon to ask again.
1. I want to pass the fact object to the dao function which returns boolean.
I tried following rule and getting "
Unexpected token '$fact'" as eclipse compilation error. Please guide with
right syntax.
global RuleDAO dao;
rule "test DAO call"
$fact : Fact(some condition)
fact : Fact(dao.isValid($fact))
then
#do something
end
2. Will be there any performance issue for above kind of rule?
Thanks
--
View this message in context: http://www.nabble.com/DAO-call-in-LHS-tp20709043p20709043.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 1 month
Best (better) practices question
by Mike Dean
I am working on an application that tells how much insulin should be given to
a patient with different glucose values. I have a decision object that
contains the current value of glucose and the rules alter the decision
object to include advice or explanations.
Since the decision object is modified, I have to have some kind of state
object so that rules do not loop; I have created a state object that has a
series of boolean fields which are checked. However, this feels like I am
circumventing the whole idea of an inference engine. So I have made an
alternative helper class that contains inner classes that can be inserted as
facts.
Here is a sample rule with the first method:
[code]
rule "Detect mild hypoglycemia"
when
decision : GlucoseDecision( serumGlucoseConcentration < 80,
serumGlucoseConcentration >= 60 )
decisionState : GlucoseDecisionState(currentGlucoseBelowRange == true,
mildHypoglycemia == false)
then
decisionState.setMildHypoglycemia(true);
decision.explain("The patient has mild hypoglycemia (serum glucose is " +
decision.getSerumGlucoseConcentration() +" mg/dL).");
end
[/code]
Here is the same rule using the second approach:
[code]
rule "Detect mild hypoglycemia"
when
decision : GlucoseDecision( serumGlucoseConcentration < 80,
serumGlucoseConcentration >= 60 )
currentGlucoseBelowRange()
not(mildHypoglycemia())
then
insert(new mildHypoglycemia());
decision.explain("The patient has mild hypoglycemia (serum glucose is " +
decision.getSerumGlucoseConcentration() +" mg/dL).");
end
[/code]
My question is whether one or the other of these approaches is a better
practice? Using facts would make my rules trace more sensible, I think, but
perhaps it is much less efficient. Comments are appreciated. Thank you.
- Mike
--
View this message in context: http://www.nabble.com/Best-%28better%29-practices-question-tp20742140p207...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 1 month
one rule not fired properly.
by manyasri.m
Hi,
The business requirements are as follows.
We have 3 rules which need to be fired depending upon the criteria which
will be met. We have an order object which has various orderline items and
the following business rules need to be executed depending upon the inserted
facts.
• If a particular item is on discount, the discount % is applied to the line
item.
• If the quantity for a particular item is greater than 10, an added 10%
discount is given for the order.
• If the total order amount is greater than 1000, then an additional 5%
discount is given on the order.
The above rules need to be executed at the same time.
In This case i tryed all the conditions it's working fine.But,
rule "Apply 5% discount if Total Price greater than 1000" is not fired.
package com.sample.orderItem
import com.sample.orderItem.DiscountDetails
import com.sample.orderItem.ItemQuantity
import com.sample.orderItem.PriceCal
import com.sample.orderItem.PriceDetails
expander Sample.dsl
rule "Purchase Item"
salience 10
when
> $p:PriceCal(itemName:itemName, quantity:quantity,
discountPer:discountPer, itemprice:itemprice, totalprice:totalprice,
totalPriceAfterDiscount:totalPriceAfterDiscount)
then
> System.out.println("Purchased Item : " +itemName );
> System.out.println("Itemprice Prise : " +itemprice);
> System.out.println("Itemprice quantity : " +quantity);
> System.out.println("discountPer : " +discountPer);
end
rule "Item Discountper equal to null"
salience 10
when
> $p:PriceCal(itemName:itemName, quantity:quantity,
discountPer:discountPer, itemprice:itemprice, totalprice:totalprice,
totalPriceAfterDiscount:totalPriceAfterDiscount)
> eval($p.getDiscountPer() == null)
then
> $p.setTotalprice(totalprice+itemprice*quantity);
> System.out.println("totalprice non Disc : "
+$p.getTotalprice() );
end
rule "Item Discountper not equal to null"
salience 10
when
> $p:PriceCal(itemName:itemName, quantity:quantity,
discountPer:discountPer, itemprice:itemprice, totalprice:totalprice,
totalPriceAfterDiscount:totalPriceAfterDiscount)
> eval($p.getDiscountPer() != null)
then
> $p.setItemprice(itemprice*(100-Integer.parseInt(discountPer))/100);
> System.out.println("default discountl: "+$p.getItemprice());
> $p.setTotalprice(totalprice+$p.getItemprice()*quantity);
> System.out.println("Totalprice : " +$p.getTotalprice() );
end
rule "Apply 10% discount if quantity greater than 10"
when
> $p:PriceCal(itemName:itemName, quantity:quantity,
discountPer:discountPer, itemprice:itemprice, totalprice:totalprice,
totalPriceAfterDiscount:totalPriceAfterDiscount)
> eval($p.getQuantity() > 10)
then
> $p.setTotalprice($p.getTotalprice()*0.90);
> System.out.println("Apply 10% discount if quantity greater than 10
: " +$p.getTotalprice() );
end
rule "Apply 5% discount if Total Price greater than 1000"
when
> $p:PriceCal(itemName:itemName, quantity:quantity,
discountPer:discountPer, itemprice:itemprice, totalprice:totalprice,
totalPriceAfterDiscount:totalPriceAfterDiscount)
> eval($p.getTotalprice() > 1000)
then
> $p.setTotalprice($p.getTotalprice()*0.95);
> System.out.println("Apply 5% discount if Total Price greater than 1000
: " +$p.getTotalprice() );
end
Result:
-------
Purchased Item : abc
Itemprice Prise : 100.0
Itemprice quantity : 13
discountPer : 5
default discount l: 95.0
Totalprice : 1235.0
Apply 10% discount if quantity greater than 10 : 1111.5
please give me proper suggestion of this.
thanks,
manyasri.
--
View this message in context: http://www.nabble.com/one-rule-not-fired-properly.-tp20706884p20706884.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 1 month
Guvnor and drools-insurance example
by Anthony MailingList
Hi all,
This is my first post to the list. I couldn't find anything on the archive
and decided to post them here.
I'm trying to run the drools-insurance example on Drools 5.0 Guvnor but
bumped into some problems with testing and compiling the war files. Here's
what I did.
- extract drools-insurance example on the desktop (i'm running windows).
- edited 'brmsdeployedrules.properties' (drools-insurance\src\main\rules)
- set the URL properties to
url=http://localhost:8080/drools-*guvnor*/org.drools.*guvnor.Guvnor*
/package/org.acme.insurance.base/InsuranceDemo
- run 'mvn clean package'
- encountered 17 test errors.
I must have missed something here. I couldn't find anywhere else I should
change the new server URL pointer. Should I stick with the original example
configuration file and instead change the Govnor settings to 'JBRMS'?
I'm running the following configuration on my computer:
Drools 5.0 Guvnor M3
JBoss AS 4.2.3
Drools 5.0 M3 Example
Apache Maven 2.0.9
Java JDK 1.6.0 - Update 7
Thanks.
regards,
Anthony
16 years, 1 month
org.Drools.RuntimeRulesException
by Anthony MailingList
This has been bugging me for a while trying out the HelloWorld example with
Drools 5.0 M3.
Unable to load dialect
org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
Although it doesn't affect the operation of the DSL file, the error kept
popping up on my Eclipse 3.4.1 (Ganymade). Some had suggested to add all the
jar libraries to the Java Build Path but that didn't work for me. So, I've
removed most of them except the one recommended by the dependencies README.
The following jars are in my buildpath now:
- antlr3-runtime-3.0.1
- janino-2.5.15
- org.eclipse.jdt.core_3.4.2.v_883_R34x.jar (does it matter if it's not
"eclipse-jdt-core-3.4.1.v_883_R34x" - I can't find it in my eclipse plugin
folder)
- core-3.4.2.v_883_R34x.jar
- mvel2-2.0.4-SNAPSHOT.jar
- entire DROOLS library (including drools-compiler-5.0.0.M3.jar and
drools-core-5.0.0.M3.jar)
Am I missing something else?
Thanks for you assistance.
regards,
Anthony
16 years, 1 month
Firing rules inside an activation-group once per object
by Nimesh Muley
Hi,
Is it possible that rules are fired once within an activation-group for each object? Currently if any rule is satisfied for any object it will fire that and stop the execution process. Thus firing only for one object. What I need is something similar to activation-group "groupName" <FQCN of the class> kind of attribute at rule level.
The rules inside the same activation-group are not mutually exclusive. Also rules need to be fired for each of the objects sent instead of just the first object.
By making the rules mutually exclusive and removing the activation-group would work, but I am looking for a solution by having an activation-group in place. If someone has an idea how this can be done then great.
I am using 4.0.7.
Thanks.
Regards,
- Nimesh
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 years, 1 month
No activation for any rule!
by vanshi
What could be the reason for no activation of any rule, when there should
have been an activation for sure, because right object was inserted in the
session and prior to that, rule parsing did not result in any error? Also,
the audit log has this message, when that happens.
<object-stream>
<list>
<org.drools.audit.event.ObjectLogEvent>
<factId>1</factId>
<objectToString>com.uhg.scs.optum.ng.hibernate.Person@31f2a7</objectToString>
<type>1</type>
</org.drools.audit.event.ObjectLogEvent>
</list>
</object-stream>
--
View this message in context: http://www.nabble.com/No-activation-for-any-rule%21-tp20694737p20694737.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 1 month
Re: [rules-users] cannot find class errors when deploying 5.0.0.MR2 drools-guvnor.war
by Ittyavirah, Seegler
Hi Mark,
We are using JBoss 4.3CP02
Thanks
Seegler
>
>
> I am getting these errors when deploying drools-guvnor.war in jboss?
> What might be causing this? Looks like a seam issue. How do I debug
> further?
>
What version of JBoss are you deploying into?
>
>
>
>
>
> 2008-11-25 07:34:02,770 +0530 ERROR [STDERR] [error] cannot
> find WEB-INF.classes.org.drools.guvnor.server.files.FileManagerUtils:
> org.drools.guvnor.server.files.FileManagerUtils found in
>
WEB-INF/classes/org/drools/guvnor/server/files/FileManagerUtils.class..
> Do verbose mode if you want full stack trace.
>
> 2008-11-25 07:34:03,081 +0530 ERROR [STDERR] [error] cannot
> find
>
WEB-INF.classes.org.drools.guvnor.server.repository.BRMSRepositoryConfig
uration:
> org.drools.guvnor.server.repository.BRMSRepositoryConfiguration found
> in
>
WEB-INF/classes/org/drools/guvnor/server/repository/BRMSRepositoryConfig
uration.class..
> Do verbose mode if you want full stack trace.
>
> 2008-11-25 07:34:03,291 +0530 ERROR [STDERR] [error] cannot
> find
>
WEB-INF.classes.org.drools.guvnor.server.repository.RulesRepositoryManag
er:
> org.drools.guvnor.server.repository.RulesRepositoryManager found in
>
WEB-INF/classes/org/drools/guvnor/server/repository/RulesRepositoryManag
er.class..
> Do verbose mode if you want full stack trace.
>
> 2008-11-25 07:34:03,331 +0530 ERROR [STDERR] [error] cannot
> find
>
WEB-INF.classes.org.drools.guvnor.server.security.DefaultAuthenticator:
> org.drools.guvnor.server.security.DefaultAuthenticator found in
>
WEB-INF/classes/org/drools/guvnor/server/security/DefaultAuthenticator.c
lass..
> Do verbose mode if you want full stack trace.
>
> 2008-11-25 07:34:03,331 +0530 ERROR [STDERR] [error] cannot
> find
> WEB-INF.classes.org.drools.guvnor.server.security.NilAuthenticator:
> org.drools.guvnor.server.security.NilAuthenticator found in
>
WEB-INF/classes/org/drools/guvnor/server/security/NilAuthenticator.class
..
> Do verbose mode if you want full stack trace.
>
> 2008-11-25 07:34:03,371 +0530 ERROR [STDERR] [error] cannot
> find
>
WEB-INF.classes.org.drools.guvnor.server.security.RoleBasedPermissionMan
ager:
> org.drools.guvnor.server.security.RoleBasedPermissionManager found in
>
WEB-INF/classes/org/drools/guvnor/server/security/RoleBasedPermissionMan
ager.class..
> Do verbose mode if you want full stack trace.
>
> 2008-11-25 07:34:03,381 +0530 ERROR [STDERR] [error] cannot
> find
>
WEB-INF.classes.org.drools.guvnor.server.security.RoleBasedPermissionSto
re:
> org.drools.guvnor.server.security.RoleBasedPermissionStore found in
>
WEB-INF/classes/org/drools/guvnor/server/security/RoleBasedPermissionSto
re.class..
> Do verbose mode if you want full stack trace.
>
>
>
> Thanks
>
> Seegler
>
16 years, 1 month