[rules-users] Global variables thread safety

2008-12-15 Thread Waleed Zedan
Hi,

I am developing a web service that evaluates risks on a certain fact, I
accumulate the risks in the working memory (stateless working memory), but i
need to return the asserted risks from the web service

the web method signature is like public Risks assertFact(Fact fact)
where Risks:
  factId
  Risk[]

The operation of insertion of a fact into the working memory is thread safe
(there is a lock object invoked in the execute or insert operation). I need
to know if i called workingMemory.executeWithResults() and getting the
global variable , are these results thread safe ?

public Risks assertFact(Fact fact){
...
synchronized(workingMemory){
 StatelessSessionResult result = workingMemory.executeWithResults(fact);
  risks = result.getGlobal("xyz");
}
...
return risks
}


it would be better to remove the synchronized block , but I don't know if
this is okay or not.

Thanks in advance.

Best regards,
-- 
Waleed Zedan
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Associate Agenda Group with Guvnor Category

2008-12-15 Thread David Sinclair
I don't believe this is currently supported, but is there an "easy" way to
associate rules within a category to an agenda group? For example, if I have
a category named Validation Rules, I would like to have the burden removed
from the user for placing the rule in the Validation agenda group.

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


Re: [rules-users] Unable to resolve token on function call with mvel dialect

2008-12-15 Thread Edson Tirelli
   Looks like a bug. I will talk to mvel author.

   []s
   Edson

2008/12/15 Olivier THIERRY 

> Well ... I found something very strange with Drools and mvel dialect
> ... It looks like Drools doesn't like points in function parameters !
>
> I made this very simple test with a log function and the easier rule
> you can have :
>
> function void log (String message) {
>System.out.println(message);
> }
>
> rule "test"
>no-loop
>when
>eval(true)
>then
>log("hello world")
> end
>
> log("hello world") works ok
> log("hello.world") (note the point) fails with this stack trace :
>
> org.drools.spi.ConsequenceException:
> org.mvel.UnresolveablePropertyException: unable to resolve token:
> log("hello.world")
> at
> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
>at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
>at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
> at t4.test.drools.TestRuleBase.executeRule(TestRuleBase.java:44)
>at t4.test.drools.Test1.testDebug(Test1.java:57)
> Caused by: org.mvel.UnresolveablePropertyException: unable to resolve
> token: log("hello.world")
> at
> org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129)
>at
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
> at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
>at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
>at org.mvel.MVEL.executeExpression(MVEL.java:235)
>at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
>... 34 more
>
> It looks like there is a problem with point character, doesn't it ? Is
> it a known problem ?
>
> Regards,
>
> Olivier
>
>
> 2008/12/15 Olivier THIERRY :
> > Thanks Edson. Here it is :
> >
> > rule "CALCUL_RELICAT_CP"
> >salience 8
> >no-loop
> >when
> >not $RELICAT_CP : VOCounter (code=="RELICAT_CP")
> >$startDate : RuleDate(name=="startDate")
> >$endDate : RuleDate(name=="endDate")
> >$SOLDE_CP_CUM : VOCounter ( code=="SOLDE_CP_CUM",
> > startDate.year == ($startDate.year - 1) )
> >then
> >VOCounter $relicat =
> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
> >insert($relicat);
> >
>  insert(createCounter(drools,"SOLDE_RELICAT_CP",$SOLDE_CP_CUM.value));
> > end
> >
> > I thought about trying with a newer version of mvel, but it doesn't
> > look so easy to upgrade it :(
> >
> > 2008/12/15 Edson Tirelli :
> >>
> >>  Can you plz show us the DRL instead of the DSLR for your rule? use
> the
> >> DRLViewer tab for that...
> >>
> >> 2008/12/15 Olivier THIERRY 
> >>>
> >>> Hi,
> >>>
> >>> I use drools 4.0.7 and I encounter a problem calling a function from a
> >>> rule written for mvel dialect.
> >>>
> >>> The function I need to call has this signature :
> >>>
> >>> function VOCounter createCounter(org.drools.spi.KnowledgeHelper
> >>> drools, String code, Number number)
> >>>
> >>> When I call this function, I want to assign result to a variable, for
> >>> example to insert it to working memory later, or just to use it in
> >>> another function call.
> >>> So I wrote something like that (I am writing a DSL so part of the code
> is
> >>> DSL ):
> >>>
> >>> rule "CALCUL_RELICAT_CP"
> >>>salience 8
> >>>no-loop
> >>>when
> >>>not There is a counter called "RELICAT_CP"
> >>>There is a date called "startDate"
> >>>There is a date called "endDate"
> >>>There is a counter called "SOLDE_CP_CUM" with
> >>>- start date is last year
> >>>then
> >>> >   VOCounter $relicat =
> >>> > createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
> >>> >   insert($relicat);
> >>>Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP
> >>> end
> >>>
> >>> But I have the following stack trace :
> >>>
> >>> org.drools.spi.ConsequenceException:
> >>> org.mvel.UnresolveablePropertyException: unable to resolve token:
> >>> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
> >>>at
> >>>
> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
> >>>at
> >>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
> >>>at
> >>> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
> >>>at
> >>>

Re: [rules-users] Unable to resolve token on function call with mvel dialect

2008-12-15 Thread Edson Tirelli
   BTW, what version of MVEL are you using?

2008/12/15 Olivier THIERRY 

> Well ... I found something very strange with Drools and mvel dialect
> ... It looks like Drools doesn't like points in function parameters !
>
> I made this very simple test with a log function and the easier rule
> you can have :
>
> function void log (String message) {
>System.out.println(message);
> }
>
> rule "test"
>no-loop
>when
>eval(true)
>then
>log("hello world")
> end
>
> log("hello world") works ok
> log("hello.world") (note the point) fails with this stack trace :
>
> org.drools.spi.ConsequenceException:
> org.mvel.UnresolveablePropertyException: unable to resolve token:
> log("hello.world")
> at
> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
>at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
>at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
> at t4.test.drools.TestRuleBase.executeRule(TestRuleBase.java:44)
>at t4.test.drools.Test1.testDebug(Test1.java:57)
> Caused by: org.mvel.UnresolveablePropertyException: unable to resolve
> token: log("hello.world")
> at
> org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129)
>at
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
> at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
>at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
>at org.mvel.MVEL.executeExpression(MVEL.java:235)
>at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
>... 34 more
>
> It looks like there is a problem with point character, doesn't it ? Is
> it a known problem ?
>
> Regards,
>
> Olivier
>
>
> 2008/12/15 Olivier THIERRY :
> > Thanks Edson. Here it is :
> >
> > rule "CALCUL_RELICAT_CP"
> >salience 8
> >no-loop
> >when
> >not $RELICAT_CP : VOCounter (code=="RELICAT_CP")
> >$startDate : RuleDate(name=="startDate")
> >$endDate : RuleDate(name=="endDate")
> >$SOLDE_CP_CUM : VOCounter ( code=="SOLDE_CP_CUM",
> > startDate.year == ($startDate.year - 1) )
> >then
> >VOCounter $relicat =
> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
> >insert($relicat);
> >
>  insert(createCounter(drools,"SOLDE_RELICAT_CP",$SOLDE_CP_CUM.value));
> > end
> >
> > I thought about trying with a newer version of mvel, but it doesn't
> > look so easy to upgrade it :(
> >
> > 2008/12/15 Edson Tirelli :
> >>
> >>  Can you plz show us the DRL instead of the DSLR for your rule? use
> the
> >> DRLViewer tab for that...
> >>
> >> 2008/12/15 Olivier THIERRY 
> >>>
> >>> Hi,
> >>>
> >>> I use drools 4.0.7 and I encounter a problem calling a function from a
> >>> rule written for mvel dialect.
> >>>
> >>> The function I need to call has this signature :
> >>>
> >>> function VOCounter createCounter(org.drools.spi.KnowledgeHelper
> >>> drools, String code, Number number)
> >>>
> >>> When I call this function, I want to assign result to a variable, for
> >>> example to insert it to working memory later, or just to use it in
> >>> another function call.
> >>> So I wrote something like that (I am writing a DSL so part of the code
> is
> >>> DSL ):
> >>>
> >>> rule "CALCUL_RELICAT_CP"
> >>>salience 8
> >>>no-loop
> >>>when
> >>>not There is a counter called "RELICAT_CP"
> >>>There is a date called "startDate"
> >>>There is a date called "endDate"
> >>>There is a counter called "SOLDE_CP_CUM" with
> >>>- start date is last year
> >>>then
> >>> >   VOCounter $relicat =
> >>> > createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
> >>> >   insert($relicat);
> >>>Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP
> >>> end
> >>>
> >>> But I have the following stack trace :
> >>>
> >>> org.drools.spi.ConsequenceException:
> >>> org.mvel.UnresolveablePropertyException: unable to resolve token:
> >>> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
> >>>at
> >>>
> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
> >>>at
> >>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
> >>>at
> >>> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
> >>>at
> >>>
> org.drools.common.A

[rules-users] How to use KnowledgeAgent in the "old manner" (just like RuleAgent)

2008-12-15 Thread psentosa

Hi all,

Can anyone give some explanation / examples on this? The docu is still using
ruleagent.
I found some piece of codes within the KnowledgeAgentFactory, but I saw that
it uses the configuration object. I personally prefer the old style by using
a property file in which the configuration is defined.

Thanks in advance for any help

Regards
Paul
-- 
View this message in context: 
http://www.nabble.com/How-to-use-KnowledgeAgent-in-the-%22old-manner%22-%28just-like-RuleAgent%29-tp21017373p21017373.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


Re: [rules-users] RuleFlows created in Drools V5M2 can't be parsed in V5M4

2008-12-15 Thread Mark Proctor

keithnielsen wrote:
It appears that ruleflows created in V5M2 can't be parsed in V5M4. 
  
We changed the namespace from 4.0 to 5.0. If you update the namespace at 
the top, it should now work.


mark


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


Re: [rules-users] Unable to resolve token on function call with mvel dialect

2008-12-15 Thread Olivier THIERRY
Well ... I found something very strange with Drools and mvel dialect
... It looks like Drools doesn't like points in function parameters !

I made this very simple test with a log function and the easier rule
you can have :

function void log (String message) {
System.out.println(message);
}

rule "test"
no-loop
when
eval(true)
then
log("hello world")
end

log("hello world") works ok
log("hello.world") (note the point) fails with this stack trace :

org.drools.spi.ConsequenceException:
org.mvel.UnresolveablePropertyException: unable to resolve token:
log("hello.world")
at 
org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
at t4.test.drools.TestRuleBase.executeRule(TestRuleBase.java:44)
at t4.test.drools.Test1.testDebug(Test1.java:57)
Caused by: org.mvel.UnresolveablePropertyException: unable to resolve
token: log("hello.world")
at 
org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129)
at 
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at 
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 34 more

It looks like there is a problem with point character, doesn't it ? Is
it a known problem ?

Regards,

Olivier


2008/12/15 Olivier THIERRY :
> Thanks Edson. Here it is :
>
> rule "CALCUL_RELICAT_CP"
>salience 8
>no-loop
>when
>not $RELICAT_CP : VOCounter (code=="RELICAT_CP")
>$startDate : RuleDate(name=="startDate")
>$endDate : RuleDate(name=="endDate")
>$SOLDE_CP_CUM : VOCounter ( code=="SOLDE_CP_CUM",
> startDate.year == ($startDate.year - 1) )
>then
>VOCounter $relicat = 
> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
>insert($relicat);
>
> insert(createCounter(drools,"SOLDE_RELICAT_CP",$SOLDE_CP_CUM.value));
> end
>
> I thought about trying with a newer version of mvel, but it doesn't
> look so easy to upgrade it :(
>
> 2008/12/15 Edson Tirelli :
>>
>>  Can you plz show us the DRL instead of the DSLR for your rule? use the
>> DRLViewer tab for that...
>>
>> 2008/12/15 Olivier THIERRY 
>>>
>>> Hi,
>>>
>>> I use drools 4.0.7 and I encounter a problem calling a function from a
>>> rule written for mvel dialect.
>>>
>>> The function I need to call has this signature :
>>>
>>> function VOCounter createCounter(org.drools.spi.KnowledgeHelper
>>> drools, String code, Number number)
>>>
>>> When I call this function, I want to assign result to a variable, for
>>> example to insert it to working memory later, or just to use it in
>>> another function call.
>>> So I wrote something like that (I am writing a DSL so part of the code is
>>> DSL ):
>>>
>>> rule "CALCUL_RELICAT_CP"
>>>salience 8
>>>no-loop
>>>when
>>>not There is a counter called "RELICAT_CP"
>>>There is a date called "startDate"
>>>There is a date called "endDate"
>>>There is a counter called "SOLDE_CP_CUM" with
>>>- start date is last year
>>>then
>>> >   VOCounter $relicat =
>>> > createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
>>> >   insert($relicat);
>>>Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP
>>> end
>>>
>>> But I have the following stack trace :
>>>
>>> org.drools.spi.ConsequenceException:
>>> org.mvel.UnresolveablePropertyException: unable to resolve token:
>>> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
>>>at
>>> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
>>>at
>>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
>>>at
>>> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
>>>at
>>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
>>>at
>>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
>>>at
>>> fr.horoquartz.t4.test.drools.TestRuleBase.executeRuleWithDsl(TestRuleBase.java:120)
>>>at fr.horoqua

[rules-users] RuleFlows created in Drools V5M2 can't be parsed in V5M4

2008-12-15 Thread keithnielsen

It appears that ruleflows created in V5M2 can't be parsed in V5M4. 
-- 
View this message in context: 
http://www.nabble.com/RuleFlows-created-in-Drools-V5M2-can%27t-be-parsed-in-V5M4-tp21015946p21015946.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


Re: [rules-users] which libraries to use api or core

2008-12-15 Thread keithnielsen

I have been trying to upgrade to V5M4 with little success. I have all the
Drools libraries in a single Eclipse plug-in. I have both API and Core
libraries which is certainly confusing Eclipse and any plug-ins that are
dependent on it. I have also tried just using Core and deleting API from my
workspace but it appears that some of the classes may have been built
against the classes in API, specifically:

FactHandle accountHandle = session.insert(account); throws a compiler error
of 

The project was not built since its build path is incomplete. Cannot find
the class file for org.drools.runtime.rule.WorkingMemoryEntryPoint. 

Why calling insert on StatefulSession which is in core would be complaining
about an API class is beyond me unless Core was compiled against API and for
some reason the core class had a reference to WorkingMemoryEntryPoint from
the API library.

Again this is in an Eclipse plug-in world so you may not face these problems
depending on your runtime environment. I think the only way you can be sure
is to migrate and try in your own runtime.


Brody bach wrote:
> 
> Hi drools-developers,
> 
> I'd like to integrate drools in my application.
> I read in some threads that the structure of the libs has been changed in
> the newest version, so that same classes exist in several jars.
> So, if I am to use a class from the old one (core), is it safe enough for
> my appl? I mean will it run later when the libraries are completely
> separated?
> Or would it be preferable to use directly the new ones (from drools-api)?
> Thanks for advise
> BB
> 
> 
>   
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/which-libraries-to-use-api-or-core-tp21014726p21015865.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


Re: [rules-users] Unable to resolve token on function call with mvel dialect

2008-12-15 Thread Olivier THIERRY
Thanks Edson. Here it is :

rule "CALCUL_RELICAT_CP"
salience 8
no-loop
when
not $RELICAT_CP : VOCounter (code=="RELICAT_CP")
$startDate : RuleDate(name=="startDate")
$endDate : RuleDate(name=="endDate")
$SOLDE_CP_CUM : VOCounter ( code=="SOLDE_CP_CUM",
startDate.year == ($startDate.year - 1) )
then
VOCounter $relicat = 
createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
insert($relicat);

insert(createCounter(drools,"SOLDE_RELICAT_CP",$SOLDE_CP_CUM.value));
end

I thought about trying with a newer version of mvel, but it doesn't
look so easy to upgrade it :(

2008/12/15 Edson Tirelli :
>
>  Can you plz show us the DRL instead of the DSLR for your rule? use the
> DRLViewer tab for that...
>
> 2008/12/15 Olivier THIERRY 
>>
>> Hi,
>>
>> I use drools 4.0.7 and I encounter a problem calling a function from a
>> rule written for mvel dialect.
>>
>> The function I need to call has this signature :
>>
>> function VOCounter createCounter(org.drools.spi.KnowledgeHelper
>> drools, String code, Number number)
>>
>> When I call this function, I want to assign result to a variable, for
>> example to insert it to working memory later, or just to use it in
>> another function call.
>> So I wrote something like that (I am writing a DSL so part of the code is
>> DSL ):
>>
>> rule "CALCUL_RELICAT_CP"
>>salience 8
>>no-loop
>>when
>>not There is a counter called "RELICAT_CP"
>>There is a date called "startDate"
>>There is a date called "endDate"
>>There is a counter called "SOLDE_CP_CUM" with
>>- start date is last year
>>then
>> >   VOCounter $relicat =
>> > createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
>> >   insert($relicat);
>>Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP
>> end
>>
>> But I have the following stack trace :
>>
>> org.drools.spi.ConsequenceException:
>> org.mvel.UnresolveablePropertyException: unable to resolve token:
>> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
>>at
>> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
>>at
>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
>>at
>> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
>>at
>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
>>at
>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
>>at
>> fr.horoquartz.t4.test.drools.TestRuleBase.executeRuleWithDsl(TestRuleBase.java:120)
>>at fr.horoquartz.t4.test.drools.Test1.testDsl(Test1.java:39)
>> Caused by: org.mvel.UnresolveablePropertyException: unable to resolve
>> token: createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
>>at
>> org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129)
>>at
>> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
>>at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)
>>at
>> org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
>>at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
>>at
>> org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
>>at org.mvel.MVEL.executeExpression(MVEL.java:235)
>>at
>> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
>>at
>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
>>... 34 more
>>
>> What is strange is that it works if I don't assign function call
>> result to a variable. For example the following works  :
>>
>> insert (createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value));
>>
>> It also works if I assign $SOLDE_CP_CUM.value to a temporary variable
>> and use it for function call :
>>
>> Number $val = $SOLDE_CP_CUM.value;
>> VOCounter $relicat = createCounter(drools,"RELICAT_CP",$val);
>> insert($relicat);
>>
>> I had not this problem using java dialect. I understand nothing in
>> what happens ... Anyone has an idea what the problem is ?
>>
>> Thanks in advance,
>>
>> Olivier
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  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
>
>



-- 
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et
encore pour l'univers, je ne suis pas sûr … (Einstein)

_

Re: [rules-users] Unable to resolve token on function call with mvel dialect

2008-12-15 Thread Edson Tirelli
 Can you plz show us the DRL instead of the DSLR for your rule? use the
DRLViewer tab for that...

2008/12/15 Olivier THIERRY 

> Hi,
>
> I use drools 4.0.7 and I encounter a problem calling a function from a
> rule written for mvel dialect.
>
> The function I need to call has this signature :
>
> function VOCounter createCounter(org.drools.spi.KnowledgeHelper
> drools, String code, Number number)
>
> When I call this function, I want to assign result to a variable, for
> example to insert it to working memory later, or just to use it in
> another function call.
> So I wrote something like that (I am writing a DSL so part of the code is
> DSL ):
>
> rule "CALCUL_RELICAT_CP"
>salience 8
>no-loop
>when
>not There is a counter called "RELICAT_CP"
>There is a date called "startDate"
>There is a date called "endDate"
>There is a counter called "SOLDE_CP_CUM" with
>- start date is last year
>then
> >   VOCounter $relicat =
> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
> >   insert($relicat);
>Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP
> end
>
> But I have the following stack trace :
>
> org.drools.spi.ConsequenceException:
> org.mvel.UnresolveablePropertyException: unable to resolve token:
> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
>at
> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
>at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
>at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
>at
> fr.horoquartz.t4.test.drools.TestRuleBase.executeRuleWithDsl(TestRuleBase.java:120)
>at fr.horoquartz.t4.test.drools.Test1.testDsl(Test1.java:39)
> Caused by: org.mvel.UnresolveablePropertyException: unable to resolve
> token: createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
>at
> org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129)
>at
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
>at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)
>at
> org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
>at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
>at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
>at org.mvel.MVEL.executeExpression(MVEL.java:235)
>at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
>... 34 more
>
> What is strange is that it works if I don't assign function call
> result to a variable. For example the following works  :
>
> insert (createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value));
>
> It also works if I assign $SOLDE_CP_CUM.value to a temporary variable
> and use it for function call :
>
> Number $val = $SOLDE_CP_CUM.value;
> VOCounter $relicat = createCounter(drools,"RELICAT_CP",$val);
> insert($relicat);
>
> I had not this problem using java dialect. I understand nothing in
> what happens ... Anyone has an idea what the problem is ?
>
> Thanks in advance,
>
> Olivier
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 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] which libraries to use api or core

2008-12-15 Thread Brody Bach
Hi drools-developers,

I'd like to integrate drools in my application.
I read in some threads that the structure of the libs has been changed in the 
newest version, so that same classes exist in several jars.
So, if I am to use a class from the old one (core), is it safe enough for my 
appl? I mean will it run later when the libraries are completely separated?
Or would it be preferable to use directly the new ones (from drools-api)?
Thanks for advise
BB


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


RE: [rules-users] shadow proxy nullpointerexception

2008-12-15 Thread Gras, Patrick
Hello,

could you send the code of FirstObj ?

I had some problem once with final fields / method because the shadowProxy is 
in fact a subclass of your class so it can't proxy final things...

-Patrick

-Message d'origine-
De : rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org]de la part de Trägenap
Envoyé : mardi, 9. décembre 2008 15:32
À : rules-users@lists.jboss.org
Objet : [rules-users] shadow proxy nullpointerexception


Hello,

I got some problems with shadowproxy.

I have a couple of instances of class "FirstObj". The objects contains 
some other objects like "innerObj" and have a method "computesomething", 
which returns boolean and use the "innerObj" to compute the result.

I try to access this object with the following rule:

rule "doIt"
when
 $firstobj : FirstObj(computesomething == true)
then
 // take a break...
 System.out.println("be happy");

I debug the programm and figure out that the innerObj is not null. 
Instead of my original object "firstobj", there I found a 
FirstObjShadowProxy which offers a field called "innerObj" which is null.

Isnt it possible to get access to "computed" fields? What is wrong here?

Thanks
Thorsten

___
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] Unable to resolve token on function call with mvel dialect

2008-12-15 Thread Olivier THIERRY
Hi,

I use drools 4.0.7 and I encounter a problem calling a function from a
rule written for mvel dialect.

The function I need to call has this signature :

function VOCounter createCounter(org.drools.spi.KnowledgeHelper
drools, String code, Number number)

When I call this function, I want to assign result to a variable, for
example to insert it to working memory later, or just to use it in
another function call.
So I wrote something like that (I am writing a DSL so part of the code is DSL ):

rule "CALCUL_RELICAT_CP"
salience 8
no-loop
when
not There is a counter called "RELICAT_CP"
There is a date called "startDate"
There is a date called "endDate"
There is a counter called "SOLDE_CP_CUM" with
- start date is last year
then
>   VOCounter $relicat = 
> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value);
>   insert($relicat);
Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP
end

But I have the following stack trace :

org.drools.spi.ConsequenceException:
org.mvel.UnresolveablePropertyException: unable to resolve token:
createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
at 
org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
at 
fr.horoquartz.t4.test.drools.TestRuleBase.executeRuleWithDsl(TestRuleBase.java:120)
at fr.horoquartz.t4.test.drools.Test1.testDsl(Test1.java:39)
Caused by: org.mvel.UnresolveablePropertyException: unable to resolve
token: createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)
at 
org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129)
at 
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)
at 
org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at 
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 34 more

What is strange is that it works if I don't assign function call
result to a variable. For example the following works  :

insert (createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value));

It also works if I assign $SOLDE_CP_CUM.value to a temporary variable
and use it for function call :

Number $val = $SOLDE_CP_CUM.value;
VOCounter $relicat = createCounter(drools,"RELICAT_CP",$val);
insert($relicat);

I had not this problem using java dialect. I understand nothing in
what happens ... Anyone has an idea what the problem is ?

Thanks in advance,

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


[rules-users] DSL: concatenating DSLs using "and" and "or"

2008-12-15 Thread Chong Minsk Goh
Hi,

We are currently using Drools to enable conditional routing for our
application. We are using DSLs to make it more user friendly.

Using Eclipse DSL editor, I noticed that there is an error (Duplicate
Declaration of variable) if I use "and" to concatenate 2 DSL statements
using the same variable name but this error does not appear if I use "or"

For example,

DSL Statement
[when]there is an "{id}"=$node: Node(nodeId=="{id}")

Using "and"
(there is an "{id}") and (there is an "{id}")

Using "or"
(there is an "{id}") or (there is an "{id}")

With the brackets, each DSL statement should be isolated right? But it is
kinda tricky as if we need to use 2 or more DSL statements together using
the same variable name.

Also, is there any means to create unique variables for use in DSL,
especially when joining for 2 or more DSL statements is required.


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