Inconsistent output when @PropertyReactive is used
by Sonata
Below is a test to demonstrate it, also add the @PropertyReactive property to
MyClass()
package com.sample;
rule base
when m : MyClass(data == null)
then
end
rule "2" extends base
when
String()
MyClass(value != "test") from m
then
System.out.println("2 fired");
end
rule "1" extends base
salience 1
when
MyClass(value == null) from m
then
System.out.println("1 fired");
insert(new String());
modify(m) { setValue("test") }
end
The test above should output "1 fired" and "2 fired".
Although we have set the value to "test", rule "2" supposes to not fire, but
it is in fact expected to fire due to the non-reactive property of CE
"from", and the result confirms this.
But if we reorder the code in rule "1" to
rule "1" extends base
salience 1
when
MyClass(value == null) from m
then
System.out.println("1 fired");
modify(m) { setValue("test") }
insert(new String());
end
Then you get only "1 fired", as if CE "from" is reactive again.
This only happens when you have the @PropertyReactive property added to
MyClass()
Version tested are 5.5.0.Final and 5.6.0.Final
Could the Drools team review this? Thank you.
--
View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReacti...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Ability to use Any of the Following (OR) with DSLs
by Nikita Patel
Hi,
I have created multiple DSLs. I now want to be able to create a rule which says:
1. For any of the following:
DSL 1
DSL 2
2. For any of the following:
DSL 3
DSL 2
DSL 4
3. For any of the following:
DSL 3
How can I currently do this?
Appreciate any pointers.
Thanks,
Nikita
12 years, 1 month
Problem when creating KieModuleModel
by Demian Calcaprina
Hi Guys!
I am having a problem using drools 6 in my project. And I was able to
reproduce it in one of the examples..
I just got this example:
https://github.com/droolsjbpm/drools/tree/master/drools-examples-api/kiem...
built the 2 dependant projects, kiebase inclusion and namedkiesession.
Then, run the org.drools.example.api.kiemodulemodel.KieModuleModelExample
in my eclipse, and I get the following:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details.
Exception in thread "main" java.lang.NullPointerException
at
org.drools.compiler.kie.builder.impl.KieBuilderImpl.generateKieModuleMetaInfo(KieBuilderImpl.java:222)
at
org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:194)
at
org.drools.example.api.kiemodulemodel.KieModuleModelExample.go(KieModuleModelExample.java:39)
at
org.drools.example.api.kiemodulemodel.KieModuleModelExample.main(KieModuleModelExample.java:63)
Exactly the same happens when I do the same in my project.
Any ideas?
Thanks!
Demian
12 years, 1 month
How to add generated rules (from templates) to a KB on the fly?
by Shinsekai
Hi,
I use Drools (6.0.0) with KIE-api and I have a method to generate drl rules
from templates+hashmaps. These rules are stored in a List<String>.
Now, I would to pack up these generated rules and make them available to a
preexistant KieSession.
Thus, a KieSession could access to standard KieBases (with rules stored in
resource directories) AND to these generated rules (stored in an object, in
memory).
Is it possible to do that?
I precise I don't want to use org.drools.internal.* classes.
Regards,
Alexandre
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-add-generated-rules-from-templat...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
KnowledgeAgent fallback FROM local cache?
by dunnlow
I am using drools 5.5 with Guvnor and the Integration Server. My integration
server uses a knowledgeagent that pulls the package from guvnor and I have
set the drools.resource.urlcache for a local cache in case Guvnor is
unavailable.
If Guvnor is available at startup, the KAgent sees any deployed changes to
my package from then on. If guvnor is NOT available, the local cache is
used and everything works fine UNTIL I make a change to Guvnor. The KAgent
seems to never fall back to checking for Guvnor's availability.
I'd like the KnowledgeAgent to use the local cache until Guvnor is available
again. Is there an (existing) way to make this happen?
If not, any thought about implementing a solution?
Thanks,
- J
--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgent-fallback-FROM-local-cach...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
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.
12 years, 1 month
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
12 years, 1 month
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
12 years, 1 month