Can When part of DRL contains simple logics?
by wtang
I have the following code to set a Calendar object at Jan-1-2013 and roll it
3 days to 1-4-2013 and test to see if it is less then the current date.
This in all done inside the THEN part of a DRL rule
then
Calendar c = Calendar.getInstance();
c.set(2013, 1, 1);
c.roll(3, true);
if (c.getTime().before(new Date())) {
System.out.println("successfully rolled 3 days ahead");
}
How to you do this in the WHEN part of a DRL rule?
--
View this message in context: http://drools.46999.n3.nabble.com/Can-When-part-of-DRL-contains-simple-lo...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 11 months
Problem with declare event
by Demian Calcaprina
Hey Guys, I am having a drools compilation error when declaring an error.
I tried to isolate this as much as possible.
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test...
I just added after the given line, this:
header = header + " declare Message\n "+
" @role(event) \n " +
" end \n ";
And I get this exception:
java.lang.NullPointerException
at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
at
org.drools.compiler.compiler.io.memory.MemoryFileSystem.writeJarEntries(MemoryFileSystem.java:437)
at
org.drools.compiler.compiler.io.memory.MemoryFileSystem.writeJarEntries(MemoryFileSystem.java:430)
at
org.drools.compiler.compiler.io.memory.MemoryFileSystem.writeJarEntries(MemoryFileSystem.java:430)
at
org.drools.compiler.compiler.io.memory.MemoryFileSystem.writeJarEntries(MemoryFileSystem.java:430)
at
org.drools.compiler.compiler.io.memory.MemoryFileSystem.zip(MemoryFileSystem.java:387)
at
org.drools.compiler.compiler.io.memory.MemoryFileSystem.writeAsBytes(MemoryFileSystem.java:365)
at
org.drools.compiler.kie.builder.impl.MemoryKieModule.getBytes(MemoryKieModule.java:64)
at
org.drools.compiler.CommonTestMethodBase.createKJar(CommonTestMethodBase.java:421)
at
org.drools.compiler.integrationtests.IncrementalCompilationTest.createAndDeployJar(IncrementalCompilationTest.java:205)
at
org.drools.compiler.integrationtests.IncrementalCompilationTest.testLoadOrderAfterRuleRemoval(IncrementalCompilationTest.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Any idea on how to declare an event on the drl?
Thanks!
Demian
10 years, 11 months
Rules confilct and resulution strategy
by bobby nick
I am using Drools 5.5 and I have two drl files, i.e. Sample.drl, Sample1.drl, with four rules, two
sets of duplicate rules. When I assert facts, rules from Sample1.drl
file is getting fired. I assume in this situation rules are in conflict, therefore rules engine using rules resolution strategy firing rules
loaded last to knowledge base. But I don't find any documentation
indicating what leads to conflict in rules.
If anyone in mailing list has experienced
similar issue, appreciate if you could share.
Thanks,Amit
10 years, 11 months
Process' RulesetNode and SplitNode working memory
by kenhelmes
Hello,
I am working on proof-of-concept with the Process API. A small cutout of
code shows an example process:
startnode->actionnode->rulesetnode-splitnode(gateway). The process flow
starts and runs normally.
However, the splitnode constraint does not seem to use the working memory of
the rulesetnode and never finds a rule hit. Does the splitnode constraint
rule generated by drools, use the same working memory as the rulesetnodes?
If a rulesetnode has one ruleflow-group, is there a way to put the splitnode
constraint rule into the same ruleflow-group?
// Nodes
.startNode(1)
.name("Start")
.done()
.actionNode(2)
.name("Action")
.action("java", "System.out.println(\"Starting process\");")
.done()
.ruleSetNode(3)
.name("City is in list")
.ruleFlowGroup("CityRules")
.done()
// Gateway
.splitNode(11)
.name("Split 11")
.type(Split.TYPE_XOR)
.constraint(4, "yes", "rule", "mvel",
"City(name == \"Copenhagen\")")
.constraint(92, "no", "rule", "mvel",
"not City(name == \"Copenhagen\")")
.done()
--
View this message in context: http://drools.46999.n3.nabble.com/Process-RulesetNode-and-SplitNode-worki...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 11 months