Globals not working with Drools Guvnor 5.0.CR1 Web Guided Decision tables
by guyt1122@aim.com
Hi,
I'm trying to use Globals with the Web Guided Decision tables and there seems to be a few issues.? I can define the Action column and select the global fact but the field selector contains "(please choose a fact pattern first)" and the edit button seems to be disabled.? The global fact is not visible on the Condition column pattern selector.
Please let me know if I'm not suppose to use Globals with Web Guided Decision tables or if this is a bug.
I'm using Drools 5.0.CR1 build.
Thanks,
-GuyT
17 years
Use of bitwise operators in LHS expression
by CK
Hi,
I am running into some expression evaluation issues, mostly revolving
around MVEL scripting in the RHS and some expression evals on the left
hand side.
Specifically, here are some of my questions
1) Does Drools support bitwise operators inside the rules? I've tried
all different kinds of combinations, but it doesn't seem to like it.
This is happening on the LHS. I believe I tried it on the RHS and it
still causes compile exceptions. My understanding is that MVEL 2.0
supports Bitwise ops.
2) Object casting. Strangely, on the RHS, I have a Float that doesn't
want to cast to float. Doesn't Drools (or perhaps MVEL) do auto-
unboxing?
3) Function calling. I read somewhere that MVEL cannot call out to a
declared function in the rule. So that means, the rule will have to
be in Java mode. Also, the function can only be written in java
style, not mvel. Am I correct on this one?
Thank you,
CK
17 years
Problem with updated facts
by thomas moncieu
Hi,
I have a problem when updating fields in rules :
Here's the rule :
when
t : Bill($amount : totalAmount, totalAmount > (new
Double(150.0).doubleValue()));
then
System.out.println("tot : " + $tot);
end
The original totalAmount is 200.
A fact update sets the totalAmount at 100 (with an update of the facthandle
that I can see in the debugger of the working memory) so the condition of
the rule does not be true.
Nevertheless, the System.out is made and prints 100.
I use Statefull session and set shadow facts to true.
Thanks for helping me !
17 years
Drools 5.0.0 CR1 : multibyte characters in dsl fails with "no viable alternative at character"
by Yusuke Yamamoto
Hi,
I found that Drools 5.0.0 CR1 is unable to compile DSLs including
multibyte characters in them.
For example, mydsl.dsl as following:
---------
[consequence]print:"{value}" = System.out.println("{value}");
[consequence]出力:"{value}" = System.out.println("{value}");
---------
Fails to be compiled with
---------
line 3:13 no viable alternative at character '出'
line 3:14 no viable alternative at character '力'
---------
"出力" means "print" in Japanese.
It used to be work with Drools 4.0.7.
I couldn't found any related issues on Jira. But is it a known issue?
Best regards,
Yusuke
17 years
application for creating rules
by Stjepan Cvitanović
Greetings
After many months of inactivity we have finally released a final version of
MSM Drools Rule Editor.
This version differs from the previous versions in many aspects, most
notable of which are:
- workspace integration
- full separation of data model and logic model
The old features have remained:
- Full graphical rule representation
- Parser for drools and HQL/SQL
- Fast rule testing using HQL/SQL
- Replay of rule fireing (for drools only)
- replay save/load capabilities
New features added:
- plugin support
- docking visual interface (multiple views)
- workspaces
- rules history with SVN
- import from CSV for rule testing
and more...
Java 1.5 required, java 1.6 recommended
Download it from http://www.sourceforge.net/projects/droolsruleedit and tell
us what you think of it
Any feedback is welcome.
MSM Team
17 years
Internal type used together with function throws ClassCastException
by Michal Bali
Hi,
Internal type together with a function in one drl file cause
ClassCastException when setting properties of a new instance of this type.
java.lang.ClassCastException: org.drools.generatedbeans.Cheese cannot be
cast to org.drools.generatedbeans.Cheese
at
org.drools.base.org.drools.generatedbeans.Cheese6778431$setType.setValue(Unknown
Source)
at org.drools.base.ClassFieldWriter.setValue(ClassFieldWriter.java:195)
at
org.drools.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:319)
at org.drools.factmodel.ClassDefinition.set(ClassDefinition.java:207)
at
org.drools.integrationtests.MiscTest.testGeneratedBeansWithFunction(MiscTest.java:1072)
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:616)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Test case to reproduce:
test_GeneratedBeansWithFunction.drl:
-------------------------------
package org.drools.generatedbeans;
function void someFunction(String arg) {
System.out.println("hello");
}
declare Cheese
type: String
end
-------------------------------
test method:
public void testGeneratedBeansWithFunction() throws Exception {
final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newInputStreamResource(
getClass().getResourceAsStream( "test_GeneratedBeansWithFunction.drl" ) ),
ResourceType.DRL );
assertFalse( kbuilder.getErrors().toString(),
kbuilder.hasErrors() );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
// Retrieve the generated fact type
FactType cheeseFact = kbase.getFactType(
"org.drools.generatedbeans",
"Cheese" );
// Create a new Fact instance
Object cheese = cheeseFact.newInstance();
cheeseFact.set( cheese,
"type",
"stilton" );
}
The last line throws the ClassCastException. If we remove the function from
the drl file all works fine.
Best Regards,
Michal
17 years
single binding for or CE flagged by compiler
by Wolfgang Laun
As far as I know, this should work:
package orel;
import orel.Main.Trigger;
rule ror1
when
$t : (or Trigger(fa == 1)
Trigger(fa == 2))
then
System.out.println( "fired " + $t.getName() );
end
This is what Drools-5.0.0 kbuilder.getErrors().toString() returns:
[5,11]: [ERR 102] Line 5:11 mismatched input 'Trigger' expecting '(' in rule
ror1 in pattern or[6,14]: [ERR 102] Line 6:14 mismatched input 'Trigger'
expecting ')' in rule ror1[6,30]: [ERR 102] Line 6:30 mismatched input ')'
expecting 'then' in rule ror1
Shouldn't toString() insert line ends? As it is, the result is pretty much
useless.
This works:
rule ror1
when
(or $t : Trigger(fa == 1)
$t : Trigger(fa == 2))
then
System.out.println( "fired " + $t.getName() );
end
-W
17 years
Missing libs for persistence in 5.0.0CR1
by Petersen, Jan (CH Ext)
Hi
I have been trying to get persistence to work in 5.0.0CR1, but I have
noticed that many of libs decribed in the documentation (chapter 5.1.3)
are missing ....
As they were present in M5 I'm just wondering why this is the case?
Best regards
Jan Petersen
17 years