[rules-users] how to write this rule in Excel? ---- $data: List ( ) from dataHelper.loadData(parameterMap)

2010-01-28 Thread Jane James
Does anyone know how to write the following rules using Excel?

rule 'load Data'
dialect 'mvel'
salience 7000
when

 $data: List ( )  from dataHelper.loadData(parameterMap)
then  
insert($data)

end



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Decision table accessing my own methods

2010-01-08 Thread Jane James
You need to import the function. 

for example,
import YourOtherClass
import function Classroom.hasStudent




- Original Message 
From: djb 
To: rules-users@lists.jboss.org
Sent: Fri, January 8, 2010 8:30:20 AM
Subject: [rules-users]  Decision table accessing my own methods


Hi there,

I have been trying for hours now to get a decision table that can call my
own methods.

Lets say I've got a Classroom, and a list of 4 students.
And my rule is to not have Bill and Bob in the same classroom.

I have a method Classroom.hasStudent(String name), which will say whether
the room has Bill or Bob.

But how do I call it???

Imagine this is my decision table:

classroom: Classroom
classroom.hasStudent("$param")
Bob
Bill

How in the world do I get it to not say "no viable alternative at input
"bob" for blah blah blah"?
I've also tried classroom.hasStudent("$param") == true with no success.


Please help,
Thank you...
Daniel


-- 
View this message in context: 
http://n3.nabble.com/Decision-table-accessing-my-own-methods-tp114250p114250.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] import static class?

2010-01-07 Thread Jane James
Yes, you can.

http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html




- Original Message 
From: HonorGod 
To: rules-users@lists.jboss.org
Sent: Tue, January 5, 2010 8:04:14 AM
Subject: Re: [rules-users] import static class?


You cannot use the constants without classname.

Jane James wrote:
> 
> Thanks, I know I can use the static constants, but I'll have to use
> ClassName.CONSTANT_NAME which is a pain, I was wondering if I can do a
> static import, then just refer them as CONSTANT_NAME in my rules. 
> 
> 
> 
> - Original Message 
> From: HonorGod 
> To: rules-users@lists.jboss.org
> Sent: Tue, December 22, 2009 8:55:54 PM
> Subject: Re: [rules-users] import static class?
> 
> 
> You can definitely use your static constants in decision table or in drl
> files.
> 
> 
> 
> Jane James wrote:
>> 
>> Can we do a import static MyClass in drools? I have a class only contains
>> some constants that to be referenced in my rules, but I can't import
>> static the class. I am wondering if this is supported or not. 
>> 
>> thanks
>> 
>> 
>> 
>>  
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> 
> 
> -- 
> View this message in context:
> http://n3.nabble.com/verifying-is-not-null-in-decision-table-tp96386p98042.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
>  
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: 
http://n3.nabble.com/verifying-is-not-null-in-decision-table-tp96386p109898.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] import static class?

2010-01-04 Thread Jane James
Thanks, I know I can use the static constants, but I'll have to use 
ClassName.CONSTANT_NAME which is a pain, I was wondering if I can do a static 
import, then just refer them as CONSTANT_NAME in my rules. 



- Original Message 
From: HonorGod 
To: rules-users@lists.jboss.org
Sent: Tue, December 22, 2009 8:55:54 PM
Subject: Re: [rules-users] import static class?


You can definitely use your static constants in decision table or in drl
files.



Jane James wrote:
> 
> Can we do a import static MyClass in drools? I have a class only contains
> some constants that to be referenced in my rules, but I can't import
> static the class. I am wondering if this is supported or not. 
> 
> thanks
> 
> 
> 
>  
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: 
http://n3.nabble.com/verifying-is-not-null-in-decision-table-tp96386p98042.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] import static class?

2009-12-22 Thread Jane James
Can we do a import static MyClass in drools? I have a class only contains some 
constants that to be referenced in my rules, but I can't import static the 
class. I am wondering if this is supported or not. 

thanks



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] call a method in web guided decision table?

2009-12-10 Thread Jane James
Hi,
   I am trying to use the web guided decision table to create my rules, 
however, in the Action section, I couldn't call a static method from a utility 
class. The only option I see in the drop down is set field which is not what I 
wanted.

Any ideas?

Thanks


  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor 5.1.0M1 bug?

2009-11-10 Thread Jane James
To make myself clear, here is the difference I copy and paste in a picture.



- Original Message 
From: Jane James 
To: Rules Users List 
Sent: Tue, November 10, 2009 5:30:25 PM
Subject: [rules-users] Guvnor 5.1.0M1 bug?

I downloaded the Guvnor 5.1.0M1 version, but then I found out I found out I 
can't add more than one condition to it now. there used to be a little bracket 
between two conditions but now it's gone. Is it a bug or it's a feature? How am 
I supposed to say startDate > 11/11/2009 and start date < 11/30/2009 now?

thanks



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



  <>___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Guvnor 5.1.0M1 bug?

2009-11-10 Thread Jane James
I downloaded the Guvnor 5.1.0M1 version, but then I found out I found out I 
can't add more than one condition to it now. there used to be a little bracket 
between two conditions but now it's gone. Is it a bug or it's a feature? How am 
I supposed to say startDate > 11/11/2009 and start date < 11/30/2009 now?

thanks



  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] import static function with varargs as one of the parameters doesn't work?

2009-11-02 Thread Jane James
Hi guys,
I have a question regarding the import function feature in Drools 5.1.0M.

I am reading the Drools JBoss Rules 5.0 book Developer's guide by Michal 
Bali and tried one of the examples but somehow I couldn't get my rules work 
with the method that has varargs. 

Here's what I have (copied from page 123):

public class ValidationHelper {
public static void error (RuleContext kcontext, Object... context) {
KnowledgeRuntime knowledgeRuntime = kcontext.getKnowledgeRuntime();
ValidationReport validationReport = 
(ValidationReport)knowledgeRuntime.getGlobal("validationReport");
ReportFactory reportFactory = (ReportFactory) 
knowledgeRuntime.getGlobal("reportFactory");

kcontext.insertLogical(reportFactory.createMessage(
Message.Type.ERROR, kcontext.getRule().getName(),
context));
}
}


then in my drools file (copied from page 42): 
i have

import org.drools.runtime.rule.RuleContext;
import function ValidationHelper.error;
...
rule test
when
   #condition
 then
error(drools)


but when I ran the test, I got error message:

Exception in thread "main" org.drools.runtime.rule.ConsequenceException: 
[Error: unable to resolve method: 
ValidationHelper.error(org.drools.base.DefaultKnowledgeHelper) [arglength=1]]

If I remove the parameter Object... context, then everything worked. But I do 
need the varargs here because I need my error message to be more specific.

Did anyone else encounter the same problems?


thanks!


  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] jboss 4.05GA and drools 5.1.0M1?

2009-10-19 Thread Jane James
 Hi guys,

 Sorry for posting this problem here again, but I've been searching up
 and down for solutions and the only solution I found online doesn't work for
 me.
 So my problem is when I tried to integrate drools into my application
 which is using jboss 4.05GA, I got the following error after I added the
 eclipse JDT core jar to the classpath.

 java.lang.NoSuchMethodError:
 
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;
  at
 org.apache.jasper.compiler.JDTCompiler$2.acceptResult(JDTCompiler.java:345)


 I tried the solution on http://www.jboss.org/community/wiki/RulesTomcat 
-->
 I set -Ddrools.compiler=JANINO in my jboss server startup script, changed my
 java code to use JANINO dialect, but I am still getting the same error, and
 if I remove the JDT core jar, I get

 org.drools.RuntimeDroolsException: Unable to load dialect
 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.dro

 ols.rule.builder.dialect.java.JavaDialectConfiguration'^M

 at
 
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)^M

 People's mentioning that the solution worked, so am I missing something
 here?

 Thanks a lot!


  
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Guvnor and collections.

2009-10-06 Thread Jane James
Hi, All,
 I have a similar questions to Jame's question. 
 I have a list of Strings which is wrapped in a class called Names, and 
what I want to get is to find all the elements that's equal to 
"targetStringname". 
 How do I create a rule using guided rule editor in Guvnor to create a rule 
which looks like the following? (Our system requires  users to be able to 
create their own rules and I doubt that the users will know how to write rules 
like the following).

when
   $name: Names( )
   $foundThese: ArrayList (size >0) from collect (String (this matches 
"targetname" ) from $name.names)

then
   System.out.println("something happened here");

public class Names {
  private List  name = new ArrayList();
}

Thanks a bunch!




From: "Nord, James" 
To: rules-users@lists.jboss.org
Sent: Tue, October 6, 2009 8:48:46 AM
Subject: [rules-users] Guvnor test scenarios and collections.


Hi 
all,
 
One of our facts has 
a collection which the rules add to.
 
I'm trying to write 
a test scenrio to cover the simple case where the fact with an empty collection 
runs through and ends up containing a value "default".
 
However I can't work 
out how to get Guvnor to do this.  I am presented with fact.blah and then 
"equals" or "does not equal" but no contains or does not 
contain.
I have tried the 
MVEL syntax of [default] but this complains that the expectation fails as: 
"[myFact] field [myCollection] was 
[[DEFAULT]] expected [[DEFAULT]]."
 
Is there any any way to do 
this?
 
Regards,
 

/James
**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**


  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users