[rules-users] Eclipse validator error

2007-09-11 Thread Tim . Nguyen

Hi,

I am using drool IDE 3.0.6 on eclipse and saw bunch of errors on Eclipse
Problem/ validator. The .drl file compiled and worked fine. But eclipse
validators might not like the drl syntax and throw errors. Here are some
errors:

- The import (class) cannot be resolved
- (declaration) cannot be resolved
- Unable to resolve ObjectType


I don't want to turn off all my Eclipse validator. Any body  has any idea
why I get those errors?


Thanks,
Tim

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


[rules-users] Can't upload model in BRMS

2007-09-11 Thread Drouin.Mathieu
I can't seem to upload a model into the BRMS. I also tried downloading
and uploading the model in the insurance example and it failed. (I tried
both the .war on tomcat 6.0.13 and the standalone version on tomcat
5.5.20).

Can somebody help?

Thanks,

Mat



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


Re: [rules-users] org.mvel.PropertyAccessException

2007-09-11 Thread Kris Verlaenen
Actions in RuleFlow are interpreted at runtime using MVEL.  This error seems to 
indicate that there is a problem in the syntax of your MVEL expression.  
However, looking at your example, I do not see any problem, 
System.out.println("Your text here"); as action property should work (I just 
tested it with the 4.0.1 release).  Could you open a JIRA and provide a 
self-contained test that shows the problem?

That said, we still need to add syntax checking for actions during ruleflow 
validation, to ensure that this error is encountered when checking the ruleflow 
(at compile time) and not during execution.

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


RE: [rules-users] Adding constraints to facts in DSL

2007-09-11 Thread stephane . remillieux



 Hi Vincent,

 Thanks for your answer but I would really like to use my synthax.

 I need to write "or" between 2 constraints and not in a single
complex constraint.

 If someone else could help me ...

 DELBART Vincent <[EMAIL PROTECTED]> a écrit :


Hello Stephane,

I think it's difficult to do that. Could you try this :
There is a Cheese with
        - age is less than 42 or age is more than 60
        - type is 'stilton'
with in your DSL
[condition][]There is a Cheese with=Cheese()
[condition][]- age is less than {low} or age is more than

{high}=age

< {low} || age > {high}
[condition][]- type is '{type}'=type == "{type}"

I don't see other solution...

vdelbart





De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de
[EMAIL PROTECTED]
Envoyé : mardi 11 septembre 2007 10:16
À : rules-users@lists.jboss.org
Objet : [rules-users] Adding constraints to facts in DSL



Hello,

I'm using JBossDrools in my company and I have some problems with

DSL.


Actually, I would like to write something like this :

There is a Cheese with
        ( - age is less
than 42
                or
        -  age is more than 60 )
        - type is
'stilton'

Unfortunately, It's the drools parser which manage "-" char.

Also this previous synthax don't work in the LHS.

Anyone could help me to do an equivalent condition in my DSL ? If
possible with "-" sugar char.

Stephane.

PS : Sorry, for my very bad english.



This message was sent using IMP, the Internet Messaging Program.







This message was sent using IMP, the Internet Messaging Program.

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


[rules-users] Can't access binary rules package in application

2007-09-11 Thread kissro
Using BRMS, I created a rule binary package and downloaded it and am
trying to access it but I'm getting a NullPointerException.  My code
looks like this - 

 public void main(Policy inputPolicy) throws Exception
 {
RuleBase ruleBase = loadRuleBase();
StatefulSession session = ruleBase.newStatefulSession();
session.insert(inputPolicy);
session.fireAllRules();
 }

 private RuleBase loadRuleBase() throws IOException, Exception
 {
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( this.getClass().getResourceAsStream(
   "/underwriting.pkg" ) );
RuleBase ruleBase = loader.getRuleBase();

return ruleBase;
  }

I'm getting the following error.  Can someone tell me what I'm doing
wrong?  Do I have something coded incorrectly?

Exception in thread "main" javax.ejb.EJBException:
java.lang.NullPointerException
at
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
.
.
.
Caused by: java.lang.NullPointerException
at
org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:105)
at
org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:67)
at
com.lidp.server.session.UnderwritingRule.loadRuleBase(UnderwritingRule.java:59)
at
com.lidp.server.session.UnderwritingRule.main(UnderwritingRule.java:20)
at
com.lidp.server.session.RuleProcessEngine.underwriting(RuleProcessEngine.java:42)
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] HELP - Error when accessing RuleAgent

2007-09-11 Thread kissro
I've created the following rule in BRMS and deployed it - 

rule "Underwriting Rule 1"
dialect "mvel"
when
   p : Policy( premium < "50.00" )
then
   p.setStatus( 32 );
end

I have the following code processing the rule - 

 public void main(Policy inputPolicy) throws Exception
 {
 RuleBase ruleBase = loadRuleBase();
 StatefulSession session = ruleBase.newStatefulSession();
 session.insert(inputPolicy);
 session.fireAllRules();
  }

 private RuleBase loadRuleBase() throws IOException, Exception
 {
 RuleAgent agent = RuleAgent.newRuleAgent("/uwrules.properties");
 RuleBase ruleBase = agent.getRuleBase();

 return ruleBase;
  }

When I run my application I get the following error.  Could someone tell
me why or where to look to determine the reason?   Do I have something
coded incorrectly?

Exception in thread "main" javax.ejb.EJBException:
   java.lang.ClassCastException: java.util.HashSet
at
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
.
.
.
Caused by: java.lang.ClassCastException: java.util.HashSet
at org.drools.rule.Package.readExternal(Package.java:172)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
 org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:54)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:137)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109)
at
 org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
at
   org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:297)
at
 org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:265)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:251)
at org.drools.agent.RuleAgent.init(RuleAgent.java:183)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:192) 

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


Re: [rules-users] Using DSL and accumulate in Drools BRMS leads to unexpected results

2007-09-11 Thread Edson Tirelli
   Yes,

   This is a bug in the DSL engine. May I ask you please to open a JIRA?

   Thank you,
 Edson


2007/9/11, pentarious <[EMAIL PROTECTED]>:
>
>
> 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-unexpected-results-tf4421763.html#a12612164
> 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
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] probliem in using "in" and "not in" operator in drool file.

2007-09-11 Thread Edson Tirelli
Inside eval() you must use code in the chosen semantic dialect (either
Java or MVEL). None of them have "not in" operator that is a DRL syntax
sugar.
So, you need to either properly write Java or MVEL code inside the eval,
or use a regular DRL constraint.

In this specific case, if you are asserting the Map into the working
memory, you can do something like:

rule XXX
when
Map( this['name'] not in ("amit","siddhartha") )
then
   // do something
end

[]s
Edson

2007/9/11, Gaurav2007 <[EMAIL PROTECTED]>:
>
>
> Hi All,
>
> I am using drool4.0.1 in my application,
>
> I have one map in global memory this map contains mapping of id and
> value,i
> want to validate these values.
>
> but when i am using in and not in rule like:
>
> eval(validatorMap.get("name")  not in("amit","siddhartha"))
>
> where validatorMap is a map of id and value inserted in global memory.
>
> it is giving following error:
> org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
> name=Short Name, agendaGroup=MAIN, salience=0, no-loop=false]
> com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java
> (8:330) : The
> left-hand side of an assignment must be a variable
> com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java
> (8:357) :
> Syntax error on token "not", invalid AssignmentOperator
>
> please help me how to validate value from a map using in and not in
> operator
> of drool.
>
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/probliem-in-using--%22in%22-and-%22not-in%22-operator-in-drool-file.-tf4421498.html#a12611458
> 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
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Using DSL and accumulate in Drools BRMS leads to unexpected results

2007-09-11 Thread 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-unexpected-results-tf4421763.html#a12612164
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] probliem in using "in" and "not in" operator in drool file.

2007-09-11 Thread Gaurav2007

Hi All,

I am using drool4.0.1 in my application,

I have one map in global memory this map contains mapping of id and value,i
want to validate these values.

but when i am using in and not in rule like:

eval(validatorMap.get("name")  not in("amit","siddhartha"))

where validatorMap is a map of id and value inserted in global memory.

it is giving following error:
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=Short Name, agendaGroup=MAIN, salience=0, no-loop=false]
com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java (8:330) : 
The
left-hand side of an assignment must be a variable
com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java (8:357) :
Syntax error on token "not", invalid AssignmentOperator

please help me how to validate value from a map using in and not in operator
of drool.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/probliem-in-using--%22in%22-and-%22not-in%22-operator-in-drool-file.-tf4421498.html#a12611458
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


RE: [rules-users] Adding constraints to facts in DSL

2007-09-11 Thread DELBART Vincent
Hello Stephane,
 
I think it's difficult to do that. Could you try this :
There is a Cheese with
- age is less than 42 or age is more than 60
- type is 'stilton'
with in your DSL
[condition][]There is a Cheese with=Cheese()
[condition][]- age is less than {low} or age is more than {high}=age < {low} || 
age > {high}
[condition][]- type is '{type}'=type == "{type}"
 
I don't see other solution...
 
vdelbart
 




De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de [EMAIL PROTECTED]
Envoyé : mardi 11 septembre 2007 10:16
À : rules-users@lists.jboss.org
Objet : [rules-users] Adding constraints to facts in DSL



Hello,

I'm using JBossDrools in my company and I have some problems with DSL.

Actually, I would like to write something like this :

There is a Cheese with
( - age is less
than 42 
or
-  age is more than 60 )
- type is
'stilton'

Unfortunately, It's the drools parser which manage "-" char.

Also this previous synthax don't work in the LHS.

Anyone could help me to do an equivalent condition in my DSL ? If possible with 
"-" sugar char.

Stephane.

PS : Sorry, for my very bad english. 



This message was sent using IMP, the Internet Messaging Program.

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


[rules-users] Adding constraints to facts in DSL

2007-09-11 Thread stephane . remillieux



 Hello,

 I'm using JBossDrools in my company and I have some problems with
DSL.

 Actually, I would like to write something like this :  There is a Cheese with
   ( - age is less than 42   or  -  age is more than 60 )
   - type is 'stilton'  Unfortunately, It's the drools parser
which manage "-" char.  Also this previous synthax don't work in the
LHS.

 Anyone could help me to do an equivalent condition in my DSL ? If
possible with  "-" sugar char.

 Stephane.PS : Sorry, for my very bad english.

This message was sent using IMP, the Internet Messaging Program.

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