Is 4.0.2 released?
by Brian Enderle
I have looked on the Drools download page and do not see a download for 4.0.2,
just 4.0.1 for Aug 30th. Is this out there somewhere or is it only available
thru SVN?
Thanks,
Brian Enderle
17 years, 3 months
DSL expression - ??
by vdelbart
Hi,
I have this in my DSL consequence :
{name}."{indic}"+:{value}={name}.putIndicator("{indic}",{name}.get("{indic}")+{value});
{name}."{indic}":{value}={name}.putIndicator("{indic}",{value});
If I write in my dslr :
...
then
ex."eeee"+:200
ex."eeee":200
end
the mapping is :
then
ex."eeee"+:200
ex.putIndicator("eeee",ex.get("eeee") + 200);
end
Why I have not this :
then
ex.putIndicator("eeee",ex.get("eeee") + 200);
ex.putIndicator("eeee",200);
end
:confused::confused:
thanks,
V.
--
View this message in context: http://www.nabble.com/DSL-expression------tf4507913.html#a12856258
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Using DSL and accumulate in Drools BRMS leads to unexpected results
by pentarious
Hi,
I'm using the following DSL:
[when]There are at least {N} objects in the domain=Number(intValue>={N})
from accumulate ( i : Object(), count( i ) )
[when]- category is {Category}=category== "{Category}"
Using the above DSL from Drools BRMS leads to the following result (rule
source code):
Number(intValue>=10) from accumulate ( i : Object(), count( i,
category=="CATEGORY") )
Of course this is not the expected behavior. This should lead to something
like:
Number(intValue>=10) from accumulate ( i : Object(category=="CATEGORY"),
count( i) )
I have no such a problem when using the same approach with a collect
statement, i.e. the following source code is generated:
ArrayList() from collect ( Object(category=="CATEGORY") )
Is it a bug?
Regards,
CG
--
View this message in context: http://www.nabble.com/Using-DSL-and-accumulate-in-Drools-BRMS-leads-to-un...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
import statements and performance
by ekke
do import statements have any impact on the performance of a .drl or .rfm ?
I plan to make some templates (.drl and .rfm) to use by the business guys -
from my UML model I know which entities were used from which Services,
so I can pre-configure a .drl/.rfm for each service (= drool package) and
its easier for the business guys to create Rules. they know that there are
orders, offers, addresses etc. but they have no knowledge about java package
structures
but then it will be that there are many unused import statements - I think
this would create no runtime - performance issues. am I right ?
and then I've noticed that Drools supports import a.b.c.* which means all
classes from package a.b.c were known, but not from subpackages like
a.b.c.d.e. there's nothing in the docs - so I obly want to confirm that this
is right. (inside the BRMS I noticed that .* was not supported with import
statements)
thanks for info
ekke
--
View this message in context: http://www.nabble.com/import-statements-and-performance-tf4511270.html#a1...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
JBoss AS 4.0.5 GA + Drools 4.0.1
by Guardian
Hello,
I have many problems to integrate Drools in my existing Application that is
running on JBoss AS 4.0.5 GA.
When I try to load and execute the rule-file I get the following Exception:
java.lang.RuntimeException: java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclip
se/jdt/core/compiler/CategorizedProblem;
javax.ejb.EJBException: java.lang.RuntimeException:
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclip
se/jdt/core/compiler/CategorizedProblem;
at
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:10
1)
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationIntercepto
r.java:76)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:10
1)
at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstan
ceInterceptor.java:62)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:10
1)
at
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationIn
terceptor.java:77)
at
org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Authenticat
ionInterceptor.java:102)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:10
1)
at
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.ja
va:47)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:10
1)
at
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInter
ceptor.java:106)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:10
1)
at
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer
.java:263)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingIn
vocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThr
ead.java:358)
at
org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412
)
My Application consists of the following parts:
The rule-file:
#created on: 04.09.2007
package drools.rules
#list any import classes here.
import drools.session.Message;
#declare any global variables here
rule "Hello World"
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message );
m.setMessage( "Goodbye cruel world" );
m.setStatus( Message.GOODBYE );
update( m );
end
rule "GoodBye"
no-loop true
when
m : Message( status == Message.GOODBYE, message : message )
then
System.out.println( message );
m.setMessage( message );
end
a Class to encapsulate the rule-initialisation and rule-execution
(wrapper-Class):
public class RuleEngineWrapper
{
private WorkingMemory workingMemory;
private boolean debugMode = false;
private DebugAgendaEventListener debugListener;
public RuleEngineWrapper(WorkingMemory wm) {
this.workingMemory = wm;
debugListener = new DebugAgendaEventListener();
}
/**
* construct a RuleEngineWrapper with only a rule-file-name, no idea
of
* callers' class. Assume the rule file is located
*
* @param rulesFile
*/
public RuleEngineWrapper(String rulesFile) {
this(RuleEngineWrapper.class, rulesFile);
}
/**
* construct a RuleEngineWrapper with only a calling object known
*
* @param caller
* @param rulesFile
*/
public RuleEngineWrapper(Object caller, String rulesFile) {
this(caller.getClass(), rulesFile);
}
/**
* construct a RuleEngineWrapper with Class caller and
rule-file-name known.
* We load the rule-file as classpath resource.
*
* @param caller
* @param rulesFile
*/
public RuleEngineWrapper(Class caller, String rulesFile) {
super();
try {
final PackageBuilder builder = new PackageBuilder();
System.out.println(caller);
builder.addPackageFromDrl(new InputStreamReader(caller
.getResourceAsStream(rulesFile)));
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
workingMemory = ruleBase.newStatefulSession();
debugListener = new DebugAgendaEventListener();
} catch (Exception e) {
System.out.println("cannot read rule file: " + rulesFile);
}
}
/**
* Allow to add arbitrary objects as facts. Users can add any
objects to
* workingMemory
*
* @param o
* the fact to be added
*/
public void addFact(Object o) {
workingMemory.insert(o);
}
/**
* Execute rules.
*
*/
public void executeRules() {
workingMemory.fireAllRules();
}
/**
* toggle debugging mode (adds a DebugAgendaEventListener if called
once.
* Removes if called again.
*/
public void setDebugMode( boolean debug ) {
if (debugMode ) {
workingMemory.removeEventListener( debugListener );
}
else workingMemory.addEventListener(debugListener);
}
public WorkingMemory getWorkingMemory() {
return workingMemory;
}
public void setWorkingMemory(WorkingMemory workingMemory) {
this.workingMemory = workingMemory;
}
}
A stateless Sessionbean for the access from the Testcase
@Remote(droolsManagement.class)
public @Stateless class droolsManagementBean implements droolsManagement
{
public void startRuleEngineWrapper(String rulesFile, ArrayList<Object>
objektListe) throws Exception
{
try
{
//load up the rulebase + StatefulSession (WorkingMemory)
RuleEngineWrapper rew = new
RuleEngineWrapper("/drools/rules/" + rulesFile);
for (Object object : objektListe)
{
rew.addFact(object);
}
rew.executeRules();
}
catch (Exception e)
{
System.out.println("exception in
'droolsManagementBean.startRuleEngineWrapper(String, ArrayList<Object>)',
cannot handle it...");
}
}
}
And the test-case:
@Test
public void TestDroolsRuleEngineWrapper()
{
try
{
String rulesFile = "testRule.drl";
//go !
Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
ArrayList<Object> objektListe = new ArrayList<Object>();
objektListe.add(message);
droolsM.startRuleEngineWrapper(rulesFile, objektListe);
}
catch (Exception e)
{
System.out.println("Exception in
TestDroolsRegeln.TestDroolsRuleEngineWrapper: " + e.getMessage());
e.printStackTrace();
}
}
17 years, 3 months
dialect: Java or MVEL
by ekke
can someone tell me, when to use java or mvel as dialect ?
I've experienced that in some cases inside the drl editor using java
gives me more context-help then using mvel
but: what can I do with java and not with mvel
and what advantages has mvel compared with java
which dialect is more performant ?
thx for infos from insiders
ekke
--
View this message in context: http://www.nabble.com/dialect%3A-Java-or-MVEL-tf4509146.html#a12859759
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
RuleFlow, packages, ruleflow-group
by ekke
I know,
* packages are Collections of related rules
* a rule can only belong to one package
in the BRMS I can use
* categories to structure rules,
* one rule can belong to n Categories
but this has nothing to do with the execution of rules, only organization
In a rule I can define a ruleflow-group,
but as I understand,
* a rule can only belong to one ruleflow-group
but I think its common, that a rule can be used in different
Business-Context
= different RuleFlows.
have I to duplicate those rules or is there another recommanded way ?
thx
ekke
--
View this message in context: http://www.nabble.com/RuleFlow%2C-packages%2C-ruleflow-group-tf4489786.ht...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
BRMS and IDE
by ekke
I did some first tests with BRMS and also with the IDE editors,
I like the features of BRMS like Categories and I like it to use a web
interface,
so Business users can take a look at the rules and verify them
developing of the rules is much easier using the eclipse editors with
context-assist, so I'm thinking about "how to combine it"
perhaps I misunderstood the concept, here's what I read from the docs:
I can import drls into BRMS, so this would be for the "first shot",
then I can modify and categorize them and change the status from
draft to reviewed or so
in my application I can use an Agent to get the changes from BRMS
automatically, but there seems no way to push new drls or changed
drls from the IDE into the BRMS - the only I've seen is to import single
drls into BRMS
any thoughts or ideas ?
thx - ekke
--
View this message in context: http://www.nabble.com/BRMS-and-IDE-tf4508320.html#a12857320
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months