What if Rules change frequently...
by jdepaul
Would like to use Drools to evaluate Events that come to us from various
systems. The business requirements dictate that the rule definitions change
frequently (at least once every hour), so we need the ability to 'refresh'
rule definition periodically.
How would you design a component that can Assert facts against the the
'current' set of rules as they exist, yet be able to refresh the rule
definitions when they change?
James
--
View this message in context: http://www.nabble.com/What-if-Rules-change-frequently...-tf3149726.html#a...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 11 months
Connective field contraints.
by nicolae oana
Hi everybody,
There are in JBoss Rules other connective field constraints, except for comma ?
Regards,
Oana
---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
17 years, 11 months
Re: Recursion problem whilc execution of rules
by Nirmal.R
initialze the variables with -1 and then assert
add the following to the rules as the first eval condition
rule "gst_rate_ol"
eval(QuoteUpdater . getQuoteLevelGSTRate () == -1 )
rule "NZ_SD"
eval(
QuoteUpdater . getQuoteLevelGSTStreamRate ( ) == -1) ;
QuoteUpdater . getQuoteLevelStampDutyRate ( ) == -1);
QuoteUpdater . getQuoteLevelStampDutyAmount()==-1);
)
rule "gst_stream_rate_ol"
eval(QuoteUpdater . getQuoteLevelGSTStreamRate () == -1);
Tell me if it works
Nirmal
KAPX wrote:
>
> Hi,
>
> I am using drools version 3.0. I have a recursion problem while executing
> a rule.
> Here is the sample code.
>
> import com.thirdpillar.QuoteUpdater
> import java.lang.String
> import java.math.BigDecimal
>
> global BigDecimal TEMP
> global BigDecimal GL_SD_Amt
>
> rule "gst_rate_ol"
> no-loop true
> salience 50
> when
> QuoteUpdater:QuoteUpdater()
> eval(QuoteUpdater.getCustomerTypeCountry().equals("New Zealand") &&
> QuoteUpdater.isFinanceLease() == true ||
> QuoteUpdater.isRental() == true ||
> QuoteUpdater.isOperatingLease() == true ||
> QuoteUpdater.isHirePurchase() == true)
> then
> System.out.println("1");
> TEMP = BigDecimal . valueOf ( 0.125 ) ;
> QuoteUpdater . setQuoteLevelGSTRate ( BigDecimal . valueOf ( TEMP .
> doubleValue ( ) ) ) ;
> modify(QuoteUpdater);
> end
> rule "NZ_SD"
> no-loop true
> salience 45
> when
> QuoteUpdater:QuoteUpdater()
> eval(QuoteUpdater . getCustomerTypeCountry ( ).equals("New Zealand"))
> then
> System.out.println("2");
> QuoteUpdater . setQuoteLevelGSTStreamRate ( BigDecimal . valueOf ( 0 )
> ) ;
> QuoteUpdater . setQuoteLevelStampDutyRate ( BigDecimal . valueOf ( 0 )
> ) ;
> GL_SD_Amt = BigDecimal . valueOf ( 0 ) ;
> QuoteUpdater . setQuoteLevelStampDutyAmount ( BigDecimal . valueOf ( 0
> ) ) ;
> modify(QuoteUpdater);
> end
> rule "gst_stream_rate_ol"
> salience 40
> no-loop true
> when
> QuoteUpdater:QuoteUpdater()
> eval(QuoteUpdater.getCustomerTypeCountry().equals("New Zealand") &&
> QuoteUpdater.isRental() == true ||
> QuoteUpdater.isOperatingLease() == true)
> then
> System.out.println("3");
> TEMP = BigDecimal . valueOf ( 0.125 ) ;
> QuoteUpdater . setQuoteLevelGSTStreamRate ( BigDecimal . valueOf ( TEMP
> . doubleValue ( ) ) ) ;
> modify(QuoteUpdater);
> end
>
> Please help me out to resolve this problem. If you have any solution of
> how to handle it please give your inputs and suggestions.
>
> Regards,
> KAPIL
>
--
View this message in context: http://www.nabble.com/Recursion-problem-whilc-execution-of-rules-tf314682...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 11 months
when to use RuleBase.removePackage()
by Justine Hlista
Hello,
Suppose I have a drl file(s) that defines a rules package. I have loaded
this into the rule base. At runtime however, my user may change the file(s)
that defines the package. Do I need to call RuleBase.removePackage() before
adding the newly modified drl code? Or will the rule base automatically
update all the modified rules correctly?
When I call removePackage, I get the following exception, but I'm not sure
why...
Warning: An error occurred compiling a semantic invoker. Errors should have
been reported elsewhere.
Exception in thread "main" java.lang.NullPointerException
at org.drools.reteoo.ReteooBuilder.removeRule(Unknown Source)
at org.drools.reteoo.ReteooRuleBase.removeRule(Unknown Source)
at org.drools.common.AbstractRuleBase.removePackage(Unknown Source)
at com.vsasset.rules.dynamic.RemovePkgTestCase.replaceRuleFile(
RemovePkgTestCase.java:58)
at com.vsasset.rules.dynamic.RemovePkgTestCase.testLoad1AssertLoad2(
RemovePkgTestCase.java:38)
at com.vsasset.rules.dynamic.RemovePkgTestCase.main(
RemovePkgTestCase.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Process finished with exit code 1
Thanks!
Justine
17 years, 11 months
class loading issue with websphere 6.1
by Vishal Joshi
posting it again after successfule subscription.
I have deployed my application on websphere 6.1, which contains Rule engine
as one of the module using JBoss Rule 3.0.1. When i am trying to invoke
drools api from my class
====================================
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader(drl));
====================================
it throws this exception:
java.lang.NoSuchMethodError:
org/eclipse/jdt/internal/compiler/CompilationResult
.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(E
clipseJavaCompiler.java:237)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJ
avaCompiler.java:268)
at org.drools.compiler.PackageBuilder.compile(Unknown Source)
at org.drools.compiler.PackageBuilder.compileRule(Unknown Source)
at org.drools.compiler.PackageBuilder.addRule(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
I have checked that class
org.eclipse.jdt.internal.compiler.CompilationResult is available with my
application war in core-3.2.0.666.jar (which is part of drools
distributable) and it has getProblems() method also.
any help will be greatly appreciated.
--
View this message in context: http://www.nabble.com/class-loading-issue-with-websphere-6.1-tf3027390.ht...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 11 months
XmlDumper
by Matthew Shaw
Hi,
Is it possible to turn off the xs:schema definition when dumping out the
xml/drl from a packageDescr?
Matt Shaw
Snr Applications Developer
Service Performance & Management Unit
Phone: 3247 8666. ext. 94666
This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient.
Any opinions expressed in this message are those of the individual sender except where the sender expressly,
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.
17 years, 11 months
Antlr
by Matthew Shaw
Hi,
I refer to a JIRA issue 578, which was rejected, however I am still
having dramas with it:
When attempting to create a package from a class called by a JSP ( see
below) I get the following error:
CharScanner; panic: ClassNotFoundException:
org.antlr.stringtemplate.language.ChunkToken
Stopping the Weblogic Workshop debugger...
Debugger Stopped.
The Weblogic server stops as well.
Here is the code snippet called by the jsp
PackageBuilderConfiguration pkgBuilderCfg = new
PackageBuilderConfiguration();
pkgBuilderCfg.setCompiler(PackageBuilderConfiguration.JANINO);
PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
builder.addPackageFromDrl((new InputStreamReader(new
FileInputStream("c:\\myruleresource.drl")) ) );
The solution seemed to be:
It seems it is a classpath issue with Weblogic.I added the
antlr-2.7.7.jar to the pre classpath and the errror no longer manifests
itself
Well I have tried the above and it does not work. I am using weblogic
8.1. This is driving me round the twist any help is greatly appreciated.
What version on antlr should I be using with drools3?
Cheers,
Matt.
Matt Shaw
Snr Applications Developer
Service Performance & Management Unit
Phone: 3247 8666. ext. 94666
This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient.
Any opinions expressed in this message are those of the individual sender except where the sender expressly,
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.
17 years, 11 months
a keyword as attribute name..
by Holla
unfortunately one of the facts (which is provided others) has an attribute
"duration", and rules are not getting compiled...
rule "Duration Check"
when
ThirdPartyFact( duration > 40 )
then
...
end
Drools (3.0.4) documentation says:
"There are some reserved keywords that are used in the rule language. It is wise
to avoid collisions with these words when naming your domain objects,
properties, methods, functions and so on that are used in the rule text. The
following list are words that you should try and avoid in the rule contents if
possible (often times it will work fine, but in some cases the rules may be
parsed incorrectly)"
especially the last sentence is very confusing.. it does not rule out
possibility attribute names like "duration". even eclipse plugin does not report
an error!! but compiling with package builder failed saying "Unexpected token
'duration'" :(
i feel Drools should always allow attributes with name same as that of a
keyword. duration is a very common name... or at least the documentation &
plugin should strictly disallow such usage.
17 years, 11 months