Re: [rules-users] 'else' in rule

2011-12-06 Thread Wolfgang Laun
The request for "else" is not as simple as it may seem. (Has the
fundamental difference between a rule and an if statement impregnated
itself?)

Given rules
   when Car(color=Color.RED) then
   when Car(color=Color.BLUE) then
and assuming that we have an "else" linked to these rules,
how should this "else" rule fire?

(a) Fire once, when there are no RED or BLUE Car facts ano no other
Car facts at all.
(b) Fire once, when there are no RED or BLUE cars but when there is at
least one Car fact, with any other color.
(c) When there are no RED or BLUE cars, but fire once for each Car
that has any other color.
(d) Irrespective of the presence or absence of RED and BLUE Car facts,
once for each Car that has any other rule.

I am, of course, assuming that rules do not fire mutually exclusive;
hence an "else" could fire even when one of its associated "when"
rules should fire.

There is, of course, a thing called "decision tree", and it's
legitimate to expect that a "decision making system" should provide
this technique (just like "decision tables"). But I think it should
not be tacked onto rules (and you may not even need a Rete engine for
that) - the user confusion is bound to reach new levels.

-W







On 06/12/2011, Mark Proctor  wrote:
> On 05/12/2011 18:43, ronalbury wrote:
>> Please consider the possibility of
>>
>> When
>>
>> Then
>>
>> When
>>
>> Then
>>
>> Else
> It's already specced up in "relational data flows" which allows a
> tree-like data flow for your decision:
> http://community.jboss.org/wiki/RelationalDataFlows
>
> I hope that it, or a variation on it, is delivered in 2012.
>
> Mark
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3562187.html
>> Sent from the Drools: User forum 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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Error in resteasy war deployment.....

2011-12-06 Thread subhransu sekhar

Hi,
   Thanks for ur response..i have solved that problem by removing some 
unnecessary dependency from my pom.xml file..


thanks to all...




Thanks & Regards,
subhransu sekhar













Hi,
   first i have integrated my resteasy ws to jbpm workflow project and added 
all the necessay jars to it.it is succesfully excuted in command prompt and 
created the wars  in repository.

but whenever i am trying to deploy that war file in tomcat(6) it shows the 
following errors:



java.lang.NoClassDefFoundError: org/drools/rule/CompositeClassLoader
at org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnowledgeBuil

der(KnowledgeBuilderProviderImpl.java:29)
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(Knowle
dgeBuilderFactory.java:29)
at com.ocqc.flow.OCQCWorkflowManager.readKnowledgeBase(OCQCWorkflowManag

er.java:59)
at com.ocqc.flow.OCQCWorkflowManager.operate(OCQCWorkflowManager.java:40
)
at com.ocqc.flow.OCQCWorkflowManager.initProcess(OCQCWorkflowManager.jav
a:31)
at com.restfully.shop.services.JobResource.getAvailableReport(JobResourc

e.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.
java:140)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.

java:255)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220
)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209
)
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(Synchronous

Dispatcher.java:519)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispa
tcher.java:496)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispa
tcher.java:119)

at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.
service(ServletContainerDispatcher.java:208)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.servi
ce(HttpServletDispatcher.java:55)

at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.servi
ce(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl

icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV

alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j

ava:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java

:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:48
9)
at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: org.drools.rule.CompositeClassLoade
r
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa

der.java:1493)
... 33 more


plaese help .


Thanks & Regards

subhransu sekhar



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


Re: [rules-users] How to use lock-on-active?

2011-12-06 Thread Zhao Yi
There are some questions on your reply:


laune wrote
> All activations from group A have been fired. Therefore, agenda group A
> "loses the focus", and the agenda group that had the focus previously
> receives the focus (becomes active) again.
When you say the agenda group becomes active again, do you mean the agenda
group A become active?


laune wrote
> Focus may be given (by an API method call) to another agenda group B while
> there still are some activations from group A pending. Eventually, A will
> receive the focus again, and rule firings from A continue as usual. 
How does the agenda group A give its focus to B? Is the API setFocus? What's
kind of activations is pending when A left?

On 5 December 2011 03:47, Zhao Yi  wrote:
> the pending activations mean the rules in other group or this group? If a
> group left, all its rules will leave, right?

Rules don't "leave". Do you mean activations?

If an agenda group A is left, there are two cases to consider:

   1. All activations from group A have been fired. Therefore, agenda group
   A "loses the focus", and the agenda group that had the focus previously
   receives the focus (becomes active) again.
   2. Focus may be given (by an API method call) to another agenda group B
   while there still are some activations from group A pending. Eventually,
A
   will receive the focus again, and rule firings from A continue as usual.

-W
>
> --
> View this message in context:
http://drools.46999.n3.nabble.com/How-to-use-lock-on-active-tp3558698p3560348.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users

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



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-use-lock-on-active-tp3558698p3563762.html
Sent from the Drools: User forum 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] How can I get rule's agenda group name?

2011-12-06 Thread Zhao Yi
Hi,

I am not successful to get the agenda name. Instead I give a pattern for the
rule name. For example, my rule name matches the pattern "AGENDA_NAME:RULE
NAME". So when I got the rule name, I will get the agenda name from this
string. I know this is now a good resolution, but this is what I can do
right now. Don't hesitate to share your idea. 

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-I-get-rule-s-agenda-group-name-tp3508539p3563774.html
Sent from the Drools: User forum 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] Want help with Resource Scanner though not using changeSets

2011-12-06 Thread Esteban Aliverti
ResourceChangeScanner is not bound to Guvnor in any way. It just check for
modifications in one or more resources. Resources can be files in the
filesystem, in the classpath or in an URL (being Guvnor a subset of these).
So, you can configure a knowledge agent with a handmade change-set (an xml
containing the resources definitions) pointing to your resources. Don't
forget to start ResourceChangeScanner and ResourceChangeNotifier
using ResourceFactory class.
If you want to have more control over when the changes in a package should
be applied, you can turn off (or never start) these 2 services and force a
scan in the resources using ResourceChangeScannerImpl.scan(). For an
example of this last approach, you can take a look at this test and its
superclass:
https://raw.github.com/droolsjbpm/drools/master/drools-compiler/src/test/java/org/drools/agent/KnowledgeAgentIncrementalChangeSetTest.java
https://raw.github.com/droolsjbpm/drools/master/drools-compiler/src/test/java/org/drools/agent/BaseKnowledgeAgentTest.java

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2011/12/5 Michael Anstis 

> Is there not a file scanner too that can be used with a KnowledgeAgent?
>
> I also recall there being some talk (reasonably) recently about the
> Resource scanner being able to use FILE URLs. Have you tried?
>
> With kind regards,
>
> Mike
>
>
> On 5 December 2011 19:20, starfish15  wrote:
>
>> As such we are not using GUVNOR in the runtime for rules. We simply have
>> the
>> PKG files. Create them using GUVNOR, and then save the binary PKG files in
>> our environment to run the rules.
>>
>> Since we r not using GUVNOR, we cant use Resource Scanner to know the
>> updated PKG files. Also we want to run the rules w/o a server re-start whn
>> the rules are further modified.
>>
>> Any assistance in the same will be highly appreciated.
>>
>> Regards,
>> starfish
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Want-help-with-Resource-Scanner-though-not-using-changeSets-tp3562282p3562282.html
>> Sent from the Drools: User forum 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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How can I get rule's agenda group name?

2011-12-06 Thread Wolfgang Laun
A few days ago I posted a code snippet to print agenda-group names.
Why don't you use that?

-W


On 06/12/2011, Zhao Yi  wrote:
> Hi,
>
> I am not successful to get the agenda name. Instead I give a pattern for the
> rule name. For example, my rule name matches the pattern "AGENDA_NAME:RULE
> NAME". So when I got the rule name, I will get the agenda name from this
> string. I know this is now a good resolution, but this is what I can do
> right now. Don't hesitate to share your idea.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-can-I-get-rule-s-agenda-group-name-tp3508539p3563774.html
> Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Esteban Aliverti
What about *lock-on-active* attribute?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Mon, Dec 5, 2011 at 3:43 AM, Zhao Yi  wrote:

> I am using agenda group and put no-loop in each rule. But the problem is
> that
> when one rule update the rule fact, other matched rules will be fired.
> no-loop will prevent fire in one rule itself not for a whole agenda group.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3560343.html
> Sent from the Drools: User forum 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] How to use lock-on-active?

2011-12-06 Thread Wolfgang Laun
On 06/12/2011, Zhao Yi  wrote:
> There are some questions on your reply:
>
>
> laune wrote
>> All activations from group A have been fired. Therefore, agenda group A
>> "loses the focus", and the agenda group that had the focus previously
>> receives the focus (becomes active) again.
> When you say the agenda group becomes active again, do you mean the agenda
> group A become active?

No, the agenda group that had the focus previously, which must be any
other group, not A.

>
>
> laune wrote
>> Focus may be given (by an API method call) to another agenda group B while
>> there still are some activations from group A pending. Eventually, A will
>> receive the focus again, and rule firings from A continue as usual.
> How does the agenda group A give its focus to B? Is the API setFocus? What's
> kind of activations is pending when A left?

API call is one possibility.

When A is left (by a setFocus to B) then all activations that have not
been fired are still pending.

(What's so difficult to understand here? If you leave a box of
chocolates while some are still uneaten and start eating some
doughnuts from another box, then the chocolates are still there when
you've finished the doughnuts.)

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


Re: [rules-users] How can I get rule's agenda group name?

2011-12-06 Thread Wolfgang Laun
srinivasasanda blocks mail sent directly to the
srinivasasa...@gmail.com mail address, so I won't do it again.
-W

On 06/12/2011, Wolfgang Laun  wrote:
> A few days ago I posted a code snippet to print agenda-group names.
> Why don't you use that?
>
> -W
>
>
> On 06/12/2011, Zhao Yi  wrote:
>> Hi,
>>
>> I am not successful to get the agenda name. Instead I give a pattern for
>> the
>> rule name. For example, my rule name matches the pattern
>> "AGENDA_NAME:RULE
>> NAME". So when I got the rule name, I will get the agenda name from this
>> string. I know this is now a good resolution, but this is what I can do
>> right now. Don't hesitate to share your idea.
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/How-can-I-get-rule-s-agenda-group-name-tp3508539p3563774.html
>> Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Zhao Yi
when I put lock-on-active, the rule will never fire if there is only one
agenda group in a stateful session. 

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3563828.html
Sent from the Drools: User forum 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] How can I get rule's agenda group name?

2011-12-06 Thread Zhao Yi
Is it your post?


laune wrote
> 
> for( Rule rule: knowledgePackage.getRules() ){
> String ruleName = rule.getName();
> org.drools.rule.Rule realRule =
> (org.drools.rule.Rule)
> ((KnowledgePackageImp)knowledgePackage).getRule( ruleName );
> String agName = realRule.getAgendaGroup();
> }
> 

I wander where the knowledgePackage coming from. I am in
beforeActivationFired method, how can I get knowledgePackage in this method?

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-I-get-rule-s-agenda-group-name-tp3508539p3563830.html
Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Esteban Aliverti
Strange... Does the rule at least get activated? I have used lock-on-active
before and it worked as expected. At that time I was not using any explicit
agenda group, so I also had just 1 agenda group.

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Tue, Dec 6, 2011 at 10:16 AM, Zhao Yi  wrote:

> when I put lock-on-active, the rule will never fire if there is only one
> agenda group in a stateful session.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3563828.html
> Sent from the Drools: User forum 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] How to use lock-on-active?

2011-12-06 Thread Zhao Yi
When group A left, why does the some activations not fire when A is active?
Is it because these activations have lock-on-active attribute? If so, how
about if there is only one agenda group A. Will the activations be fired
with lock-on-active attribute?

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-use-lock-on-active-tp3558698p3563860.html
Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Zhao Yi
I just tried and please look at my rule file. It is very simple, after fired
the session, this rule is not fired. I am using drools 5.1.1 and
statefulsession. Could you please provide your rule file to have a look at?


rule "add2"
agenda-group "add"
dialect "java" 
lock-on-active
when 
eval(true)
then 
System.out.println("add2");
end


--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3563873.html
Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Esteban Aliverti
Are you activating the "add" agenda-group before the fireAllRules() call?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Tue, Dec 6, 2011 at 10:45 AM, Zhao Yi  wrote:

> I just tried and please look at my rule file. It is very simple, after
> fired
> the session, this rule is not fired. I am using drools 5.1.1 and
> statefulsession. Could you please provide your rule file to have a look at?
>
>
> rule "add2"
>agenda-group "add"
>dialect "java"
>lock-on-active
>when
>eval(true)
>then
>System.out.println("add2");
> end
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3563873.html
> Sent from the Drools: User forum 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] How can I get rule's agenda group name?

2011-12-06 Thread Wolfgang Laun
On 06/12/2011, Zhao Yi  wrote:
> Is it your post?
>
>
> laune wrote
>>
>> for( Rule rule: knowledgePackage.getRules() ){
>> String ruleName = rule.getName();
>> org.drools.rule.Rule realRule =
>> (org.drools.rule.Rule)
>> ((KnowledgePackageImp)knowledgePackage).getRule( ruleName );
>> String agName = realRule.getAgendaGroup();
>> }
>>

Yes.

>
> I wander where the knowledgePackage coming from. I am in
> beforeActivationFired method, how can I get knowledgePackage in this method?

Pass your listener a reference to the KnowledgeBase, which will give
you the knowledge packages; the rule contains the package name, and so
on.

-W

>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-can-I-get-rule-s-agenda-group-name-tp3508539p3563830.html
> Sent from the Drools: User forum 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] How to use lock-on-active?

2011-12-06 Thread Wolfgang Laun
On 06/12/2011, Zhao Yi  wrote:
> When group A left, why does the some activations not fire when A is active?

If the group is left before an activation is fired, the activation is
not fired. Firing of activations isn't one big bang, it's a series of
shots.

> Is it because these activations have lock-on-active attribute?

No.
-W

> If so, how
> about if there is only one agenda group A. Will the activations be fired
> with lock-on-active attribute?
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-use-lock-on-active-tp3558698p3563860.html
> Sent from the Drools: User forum 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] ASMAccessorImpl classloader issue?

2011-12-06 Thread ollem
Hi!

I'm trying to use jackson to deserialize JSON to declared types.
When I do that I get classloading problems when inserting the fact into
knowledgespace.
I have explicitly set the context classloader to
org.drools.rule.JavaDialectRuntimeData$PackageClassLoader during
deserialization.
The problem only occurs when I insert facts at a high rate. I use a http to
send data that will be inserted as facts and when I send only 100 facts I
have no problems, when I step this up to around 500 I get the following
stacktrace. Has anybody seen anything like this? Please help me!

Best Regards // Olle Mårtensson

java.lang.ClassNotFoundException: com.digitalroute.betssonpoc.Registration
at java.lang.ClassLoader.findClass:358
at java.lang.ClassLoader.loadClass:306
at java.lang.ClassLoader.loadClass:247
at ASMAccessorImpl_8562899311323165422700.getValue
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue:73
at org.mvel2.ast.ASTNode.getReducedValueAccelerated:106
at org.mvel2.MVELRuntime.execute:87
at org.mvel2.compiler.CompiledExpression.getValue:122
at org.mvel2.MVEL.executeExpression:954
at org.drools.base.extractors.MVELClassFieldReader.getValue:100
at
org.drools.base.extractors.BaseObjectClassFieldReader.getLongValue:146
at org.drools.reteoo.ReteooFactHandleFactory.newFactHandle:61
at org.drools.common.AbstractFactHandleFactory.newFactHandle:80
at org.drools.common.AbstractFactHandleFactory.newFactHandle:65
at org.drools.common.NamedEntryPoint.createHandle:720
at org.drools.common.NamedEntryPoint.insert:280
at org.drools.common.AbstractWorkingMemory.insert:886
at org.drools.base.DefaultKnowledgeHelper.insert:180
at org.drools.base.DefaultKnowledgeHelper.insert:174
at
com.digitalroute.betssonpoc.Rule_incoming_registration_event.defaultConsequence:14
at
com.digitalroute.betssonpoc.Rule_incoming_registration_eventDefaultConsequenceInvoker.evaluate
at org.drools.common.DefaultAgenda.fireActivation:1091
at org.drools.common.DefaultAgenda.fireNextItem:1029
at org.drools.common.DefaultAgenda.fireAllRules:1251
at org.drools.common.AbstractWorkingMemory.fireAllRules:708
at org.drools.common.AbstractWorkingMemory.fireAllRules:672
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules:218
..
..




--
View this message in context: 
http://drools.46999.n3.nabble.com/ASMAccessorImpl-classloader-issue-tp3563940p3563940.html
Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Wolfgang Laun
As soon as you use agenda-group "x" you have two groups: "MAIN" and "x".
-W

On 06/12/2011, Esteban Aliverti  wrote:
> Are you activating the "add" agenda-group before the fireAllRules() call?
>
> Best Regards,
>
> 
>
> Esteban Aliverti
> - Developer @ http://www.plugtree.com
> - Blog @ http://ilesteban.wordpress.com
>
>
> On Tue, Dec 6, 2011 at 10:45 AM, Zhao Yi  wrote:
>
>> I just tried and please look at my rule file. It is very simple, after
>> fired
>> the session, this rule is not fired. I am using drools 5.1.1 and
>> statefulsession. Could you please provide your rule file to have a look
>> at?
>>
>>
>> rule "add2"
>>agenda-group "add"
>>dialect "java"
>>lock-on-active
>>when
>>eval(true)
>>then
>>System.out.println("add2");
>> end
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3563873.html
>> Sent from the Drools: User forum 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] duration attribute & other rule language features issue

2011-12-06 Thread prashant.badhe
Changing pseudo-clock to "realtime" solves both timer() and @expires issues.

Also, the java.lang.ClassCastException on updating fact from rule RHS is
also not observed anymore.
Looks like the ClockTypeOption for kSession is a important one.

Thanks for all your replies.
-Prashant

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-duration-attribute-other-rule-language-features-issue-tp3536857p3564050.html
Sent from the Drools: User forum 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] Drools Ruleflow persistence on MySQL - invalid SQL query generated

2011-12-06 Thread victorC
Hi,

Found what is the cause, so will post it here so it could save somebody
time.

The process that I tried to restore contained few nodes with no "waiting"
nodes and thus by the time of persisting the process it was actually in
FINISHED state. After I added some additional nodes to make it stay live
longer, the SQL error has gone.

Have a nice day,




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Ruleflow-persistence-on-MySQL-invalid-SQL-query-generated-tp3548289p3564107.html
Sent from the Drools: User forum 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] Can we compose DRLS into JARS

2011-12-06 Thread rahulkrishnan
Can we make drl files into jar

--
View this message in context: 
http://drools.46999.n3.nabble.com/Can-we-compose-DRLS-into-JARS-tp3564113p3564113.html
Sent from the Drools: User forum 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] Can we compose DRLS into JARS

2011-12-06 Thread Esteban Aliverti
Yes, you should be able to embed your drl files into jars and then use a
ClassPathResource to make reference to them.

Best Regards



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Tue, Dec 6, 2011 at 12:51 PM, rahulkrishnan wrote:

> Can we make drl files into jar
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Can-we-compose-DRLS-into-JARS-tp3564113p3564113.html
> Sent from the Drools: User forum 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] Drools fusion example in 5.3.0

2011-12-06 Thread Salina Fung/UFL - ICIL
^
[Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy more 
shares']

Unable to Analyse Expression percent < -0.06:
[Error: Comparison operation requires compatible types. Found class 
org.mvel2.util.MethodStub and class java.lang.Double]
[Near : {... percent < -0.06 }]
I download Drools 5.3.0 Final and try to
run the Broker example that comes with the package.  But I got the
following error, what is wrong?

   ^
[Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy more 
shares']

Unable to Analyse Expression percent < -0.08:
[Error: Comparison operation requires compatible types. Found class 
org.mvel2.util.MethodStub and class java.lang.Double]
[Near : {... percent < -0.08 }]
   ^
[Line: 69, Column: 28] : [Rule name='If the drop is on more than 8%, sell 
shares']

Unable to Analyse Expression percent >= -0.06:
[Error: Comparison operation requires compatible types. Found class 
org.mvel2.util.MethodStub and class java.lang.Double]
[Near : {... percent >= -0.06 }]
^
[Line: 83, Column: 28] : [Rule name='If the drop is between 5% and 6%, do 
nothing']





Thanks
Salina

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


Re: [rules-users] ASMAccessorImpl classloader issue?

2011-12-06 Thread Olle Martensson

I found a workaround by setting this property when starting the JVM:

-Dmvel2.disable.jit=true


I guess that this makes things less performant though.

Best regards // Olle Mårtensson







On 12/6/11 11:22 AM, "Olle Martensson" 
wrote:

>Hi!
>
>I'm trying to use jackson to deserialize JSON to declared types.
>When I do that I get classloading problems when inserting the fact into
>knowledgespace.
>I have explicitly set the context classloader to
>org.drools.rule.JavaDialectRuntimeData$PackageClassLoader during
>deserialization.
>The problem only occurs when I insert facts at a high rate. I use a http
>to
>send data that will be inserted as facts and when I send only 100 facts I
>have no problems, when I step this up to around 500 I get the following
>stacktrace. Has anybody seen anything like this? Please help me!
>
>Best Regards // Olle Mårtensson
>
>java.lang.ClassNotFoundException: com.digitalroute.betssonpoc.Registration
>at java.lang.ClassLoader.findClass:358
>at java.lang.ClassLoader.loadClass:306
>at java.lang.ClassLoader.loadClass:247
>at ASMAccessorImpl_8562899311323165422700.getValue
>at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue:73
>at org.mvel2.ast.ASTNode.getReducedValueAccelerated:106
>at org.mvel2.MVELRuntime.execute:87
>at org.mvel2.compiler.CompiledExpression.getValue:122
>at org.mvel2.MVEL.executeExpression:954
>at org.drools.base.extractors.MVELClassFieldReader.getValue:100
>at
>org.drools.base.extractors.BaseObjectClassFieldReader.getLongValue:146
>at org.drools.reteoo.ReteooFactHandleFactory.newFactHandle:61
>at org.drools.common.AbstractFactHandleFactory.newFactHandle:80
>at org.drools.common.AbstractFactHandleFactory.newFactHandle:65
>at org.drools.common.NamedEntryPoint.createHandle:720
>at org.drools.common.NamedEntryPoint.insert:280
>at org.drools.common.AbstractWorkingMemory.insert:886
>at org.drools.base.DefaultKnowledgeHelper.insert:180
>at org.drools.base.DefaultKnowledgeHelper.insert:174
>at
>com.digitalroute.betssonpoc.Rule_incoming_registration_event.defaultConseq
>uence:14
>at
>com.digitalroute.betssonpoc.Rule_incoming_registration_eventDefaultConsequ
>enceInvoker.evaluate
>at org.drools.common.DefaultAgenda.fireActivation:1091
>at org.drools.common.DefaultAgenda.fireNextItem:1029
>at org.drools.common.DefaultAgenda.fireAllRules:1251
>at org.drools.common.AbstractWorkingMemory.fireAllRules:708
>at org.drools.common.AbstractWorkingMemory.fireAllRules:672
>at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules:218
>..
>..
>
>
>
>
>--
>View this message in context:
>http://drools.46999.n3.nabble.com/ASMAccessorImpl-classloader-issue-tp3563
>940p3563940.html
>Sent from the Drools: User forum 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] Drools fusion example in 5.3.0

2011-12-06 Thread Geoffrey De Smet
Please see
   https://issues.jboss.org/browse/JBRULES-3306
I 'll try to figure out what's going wrong.

Op 06-12-11 13:12, Salina Fung/UFL - ICIL schreef:
> ^
> [Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy 
> more shares']
>
> Unable to Analyse Expression percent<  -0.06:
> [Error: Comparison operation requires compatible types. Found class 
> org.mvel2.util.MethodStub and class java.lang.Double]
> [Near : {... percent<  -0.06 }]
> I download Drools 5.3.0 Final and try to
> run the Broker example that comes with the package.  But I got the
> following error, what is wrong?
>
> ^
> [Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy 
> more shares']
>
> Unable to Analyse Expression percent<  -0.08:
> [Error: Comparison operation requires compatible types. Found class 
> org.mvel2.util.MethodStub and class java.lang.Double]
> [Near : {... percent<  -0.08 }]
> ^
> [Line: 69, Column: 28] : [Rule name='If the drop is on more than 8%, sell 
> shares']
>
> Unable to Analyse Expression percent>= -0.06:
> [Error: Comparison operation requires compatible types. Found class 
> org.mvel2.util.MethodStub and class java.lang.Double]
> [Near : {... percent>= -0.06 }]
>  ^
> [Line: 83, Column: 28] : [Rule name='If the drop is between 5% and 6%, do 
> nothing']
>
>
>
>
>
> Thanks
> Salina
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

-- 
With kind regards,
Geoffrey De Smet


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


Re: [rules-users] Dynamic Fact(field) Generation in Declarative Model

2011-12-06 Thread srinivasasanda
Yes Manstis,That is my requirement.Can you suggest me the API and classes
used to insert that dynamic facts into the model through a small piece of
code.Really Thanks for your reply and Please suggest me in this context.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Dynamic-Fact-field-Generation-in-Declarative-Model-tp3545088p3564179.html
Sent from the Drools: User forum 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] Drools fusion example in 5.3.0

2011-12-06 Thread Salina Fung/UFL - ICIL
Noted.  Thanks will wait


Thanks
Salina


- Original Message -
From: Geoffrey De Smet
[mailto:ge0ffrey.s...@gmail.com]
To: rules-users@lists.jboss.org
Sent: Tue,
06 Dec 2011 20:24:12 +0800
Subject: Re: [rules-users] Drools fusion example
in 5.3.0


> Please see
>https://issues.jboss.org/browse/JBRULES-3306
> I 'll try to figure out what's going wrong.
> 
> Op 06-12-11 13:12, Salina Fung/UFL - ICIL schreef:
> > ^
> > [Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy
> more shares']
> >
> > Unable to Analyse Expression percent<  -0.06:
> > [Error: Comparison operation requires compatible types. Found class
> org.mvel2.util.MethodStub and class java.lang.Double]
> > [Near : {... percent<  -0.06 }]
> > I download Drools 5.3.0 Final and try to
> > run the Broker example that comes with the package.  But I got the
> > following error, what is wrong?
> >
> > ^
> > [Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy
> more shares']
> >
> > Unable to Analyse Expression percent<  -0.08:
> > [Error: Comparison operation requires compatible types. Found class
> org.mvel2.util.MethodStub and class java.lang.Double]
> > [Near : {... percent<  -0.08 }]
> > ^
> > [Line: 69, Column: 28] : [Rule name='If the drop is on more than 8%, sell
> shares']
> >
> > Unable to Analyse Expression percent>= -0.06:
> > [Error: Comparison operation requires compatible types. Found class
> org.mvel2.util.MethodStub and class java.lang.Double]
> > [Near : {... percent>= -0.06 }]
> >  ^
> > [Line: 83, Column: 28] : [Rule name='If the drop is between 5% and 6%, do
> nothing']
> >
> >
> >
> >
> >
> > Thanks
> > Salina
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> 
> -- 
> With kind regards,
> Geoffrey De Smet
> 
> 
> ___
> 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] Dynamic Fact(field) Generation in Declarative Model

2011-12-06 Thread Michael Anstis
Package org.drools.guvnor.client.asseteditor.drools.factmodel contains the
model (class FactMetaModel represents a Fact type).

org.drools.guvnor.server.contenthandler.drools.FactModelContentHandler
handles the conversion to DRL.

These packages are as they are named in the current git master branch. They
will be different pre-5.4.0-beta1, but the class names remain the same.


On 6 December 2011 12:26, srinivasasanda  wrote:

> Yes Manstis,That is my requirement.Can you suggest me the API and classes
> used to insert that dynamic facts into the model through a small piece of
> code.Really Thanks for your reply and Please suggest me in this context.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Dynamic-Fact-field-Generation-in-Declarative-Model-tp3545088p3564179.html
> Sent from the Drools: User forum 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] Drools fusion example in 5.3.0

2011-12-06 Thread Geoffrey De Smet
Problem found, read
https://issues.jboss.org/browse/JBRULES-3306?focusedCommentId=12648364&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12648364
 


Op 06-12-11 13:30, Salina Fung/UFL - ICIL schreef:
> Noted.  Thanks will wait
>
>
> Thanks
> Salina
>
>
> - Original Message -
> From: Geoffrey De Smet
> [mailto:ge0ffrey.s...@gmail.com]
> To: rules-users@lists.jboss.org
> Sent: Tue,
> 06 Dec 2011 20:24:12 +0800
> Subject: Re: [rules-users] Drools fusion example
> in 5.3.0
>
>
>> Please see
>> https://issues.jboss.org/browse/JBRULES-3306
>> I 'll try to figure out what's going wrong.
>>
>> Op 06-12-11 13:12, Salina Fung/UFL - ICIL schreef:
>>> ^
>>> [Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy
>> more shares']
>>> Unable to Analyse Expression percent<   -0.06:
>>> [Error: Comparison operation requires compatible types. Found class
>> org.mvel2.util.MethodStub and class java.lang.Double]
>>> [Near : {... percent<   -0.06 }]
>>> I download Drools 5.3.0 Final and try to
>>> run the Broker example that comes with the package.  But I got the
>>> following error, what is wrong?
>>>
>>>  ^
>>> [Line: 56, Column: 28] : [Rule name='If the drop is between 6% and 8%, buy
>> more shares']
>>> Unable to Analyse Expression percent<   -0.08:
>>> [Error: Comparison operation requires compatible types. Found class
>> org.mvel2.util.MethodStub and class java.lang.Double]
>>> [Near : {... percent<   -0.08 }]
>>>  ^
>>> [Line: 69, Column: 28] : [Rule name='If the drop is on more than 8%, sell
>> shares']
>>> Unable to Analyse Expression percent>= -0.06:
>>> [Error: Comparison operation requires compatible types. Found class
>> org.mvel2.util.MethodStub and class java.lang.Double]
>>> [Near : {... percent>= -0.06 }]
>>>   ^
>>> [Line: 83, Column: 28] : [Rule name='If the drop is between 5% and 6%, do
>> nothing']
>>>
>>>
>>>
>>>
>>> Thanks
>>> Salina
>>>
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> -- 
>> With kind regards,
>> Geoffrey De Smet
>>
>>
>> ___
>> 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
>

-- 
With kind regards,
Geoffrey De Smet


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


Re: [rules-users] How to let a rule run only one time

2011-12-06 Thread Zhao Yi
Yes, I have set focus on the agenda "add". I can see the push and pop event
in my listener.

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3564315.html
Sent from the Drools: User forum 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] 'else' in rule

2011-12-06 Thread ronalbury
I agree that I jumped in on an effort to define a requirement in terms of a
solution ... however, people generally understand else and otherwise, so
there is some justification in saying you want something to work like them.

I don't care what the underlying mechanism is, but as it stands now we have
to write a rule "When (condition-A)" and then another rule "When not
(condition-A)" ... and I think that makes the rules more difficult to
understand and to maintain.

Thanks
   Ron

--
View this message in context: 
http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3564318.html
Sent from the Drools: User forum 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] How can I get Rule Id

2011-12-06 Thread srinivasasanda
Does every rule will have Unique Id(it has unique name).In the same way,does
it have any unique name?If so,How can i retrieve that Id?

Can you please suggest me in this.

Thanks in Advance

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-I-get-Rule-Id-tp3564401p3564401.html
Sent from the Drools: User forum 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] How can I get Rule Id

2011-12-06 Thread Michael Anstis
Nope, rules don't have ID

sent on the move

On 6 Dec 2011 13:58, "srinivasasanda"  wrote:

> Does every rule will have Unique Id(it has unique name).In the same
> way,does
> it have any unique name?If so,How can i retrieve that Id?
>
> Can you please suggest me in this.
>
> Thanks in Advance
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-can-I-get-Rule-Id-tp3564401p3564401.html
> Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Wolfgang Laun
The correct sequence is
   insert facts (amd observe activations)
   call setFocus( "add" )
   call fireAllrules()
-W

On 06/12/2011, Zhao Yi  wrote:
> Yes, I have set focus on the agenda "add". I can see the push and pop event
> in my listener.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3564315.html
> Sent from the Drools: User forum 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] How can I get Rule Id

2011-12-06 Thread Wolfgang Laun
The combination
package name + ":" + rule name
should be unique

-W

On 06/12/2011, Michael Anstis  wrote:
> Nope, rules don't have ID
>
> sent on the move
>
> On 6 Dec 2011 13:58, "srinivasasanda"  wrote:
>
>> Does every rule will have Unique Id(it has unique name).In the same
>> way,does
>> it have any unique name?If so,How can i retrieve that Id?
>>
>> Can you please suggest me in this.
>>
>> Thanks in Advance
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/How-can-I-get-Rule-Id-tp3564401p3564401.html
>> Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread Zhao Yi
Yes, that's exactly what I did. Could you try with my rule file?

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p3564636.html
Sent from the Drools: User forum 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] Salience & activation-group

2011-12-06 Thread ronalbury
Expert 5.2.Final

My data comes to me as all strings, but I sometimes need to convert some
fields into integers in order to test their value.  I wanted to avoid
conversion errors, so I combined rules into an activation-group and used
salience to control the order.  However, at runtime I am getting a number
format error in method underWritingClassAsInt.  I don't understand why - can
you explain?

rule "XmLifeParticipant underWritingClass Validation"
activation-group "XmLifeParticipant-underWritingClass"
salience 100
when
$lp : XmLifeParticipant(fieldWasModified("underWritingClass")
&& underWritingClass not matches "^\\d$" )
then
$lp.addError(drools.getRule().getName());
end

rule "XmLifeParticipant underWritingClass Value Check"
activation-group "XmLifeParticipant-underWritingClass"
salience 50
when
$lp : XmLifeParticipant(fieldWasModified("underWritingClass")
&& underWritingClassAsInt not in (1, 2, 4, 6))
then
$lp.addError(drools.getRule().getName());
end

--
View this message in context: 
http://drools.46999.n3.nabble.com/Salience-activation-group-tp3564649p3564649.html
Sent from the Drools: User forum 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] Salience & activation-group

2011-12-06 Thread Wolfgang Laun
We had this earlier today ;-)
"Rules are not if statements - salience doesn't change this."

Left hand sides of both rules are fully evaluated for any
XmLifeParticipant. If that value isn't a number, you'll get an error
(unless you write that method very carefully).

-W

On 06/12/2011, ronalbury  wrote:
> Expert 5.2.Final
>
> My data comes to me as all strings, but I sometimes need to convert some
> fields into integers in order to test their value.  I wanted to avoid
> conversion errors, so I combined rules into an activation-group and used
> salience to control the order.  However, at runtime I am getting a number
> format error in method underWritingClassAsInt.  I don't understand why - can
> you explain?
>
> rule "XmLifeParticipant underWritingClass Validation"
>   activation-group "XmLifeParticipant-underWritingClass"
>   salience 100
>   when
>   $lp : XmLifeParticipant(fieldWasModified("underWritingClass")
>   && underWritingClass not matches "^\\d$" )
>   then
>   $lp.addError(drools.getRule().getName());
> end
>
> rule "XmLifeParticipant underWritingClass Value Check"
>   activation-group "XmLifeParticipant-underWritingClass"
>   salience 50
>   when
>   $lp : XmLifeParticipant(fieldWasModified("underWritingClass")
>   && underWritingClassAsInt not in (1, 2, 4, 6))
>   then
>   $lp.addError(drools.getRule().getName());
> end
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Salience-activation-group-tp3564649p3564649.html
> Sent from the Drools: User forum 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] Salience & activation-group

2011-12-06 Thread ronalbury
Thanks for your quick response, but I am still confused.

An activation-group assures that only one rule in the group will fire (an
XOR group)

Salience controls the order of evaluation

The regular expression test has the higher salience and will trigger if it
is a bad number ... so why is the other rule even being tested?


In the mean time I will re-write the underWritingClassAsInt method to deal
with a bad number ... but this seems wrong to me.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Salience-activation-group-tp3564649p3564748.html
Sent from the Drools: User forum 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] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?

2011-12-06 Thread Geoffrey De Smet


Op 06-12-11 05:38, guyramirez schreef:
> Still the same issue, starting with the construction heuristic phase. Please
> let me know if you need more explanations in what I am trying to do.
>
> Here is the error. Please note that there is only one planning entity
> (ShiftAssignment) object instance in this test.
>
> Total Staffing required: 8
> 2011-12-05 22:21:49,627 [main] INFO  Solver started: time spend (0), score
> (null), new best score (null), random seed (0).
> ShiftAssignment: emp. id: 10 [st: 100, dur: 3]
> ShiftAssignment: emp. id: 10 [st: 100, dur: 2]
> ShiftAssignment: emp. id: 10 [st: 100, dur: 4]
> ShiftAssignment: emp. id: 10 [st: 100, dur: 1]
> 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence summary
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 101, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st:
> 100, dur: 1]]]=1)
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 103, position id: 1, staffingRequired: 2, []]=2)
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 102, position id: 1, staffingRequired: 2, []]=2)
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st:
> 100, dur: 1], ShiftAssignment: emp. id: 10 [st: 100, dur: 1]]]=0)
> 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence summary
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 101, position id: 1, staffingRequired: 2, []]=2)
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 103, position id: 1, staffingRequired: 2, []]=2)
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st:
> 100, dur: 1]]]=1)
> 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> 102, position id: 1, staffingRequired: 2, []]=2)
> Exception in thread "main" java.lang.IllegalStateException: The
> presumedScore (-5hard/-1soft) is corrupted because it is not the realScore
> (-7hard/-1soft).
> Presumed workingMemory:
>Score rule (intervalRequirementCovered) has count (4) and weight total
> (5).
> Real workingMemory:
>Score rule (intervalRequirementCovered) has count (4) and weight total
> (7).
So the score rule intervalRequirementCovered is to blame.
>   at
> org.drools.planner.core.solution.director.DefaultSolutionDirector.assertWorkingScore(DefaultSolutionDirector.java:157)
>   at
> org.drools.planner.core.solver.DefaultSolverScope.assertWorkingScore(DefaultSolverScope.java:105)
>   at
> org.drools.planner.core.phase.AbstractSolverPhaseScope.assertWorkingScore(AbstractSolverPhaseScope.java:132)
>   at
> org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:65)
>   at
> org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:62)
>   at
> org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166)
>   at
> org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138)
>   at 
> com.lfsoscience.planner.LfsoPlannerMain.execute(LfsoPlannerMain.java:36)
>   at com.lfsoscience.planner.LfsoPlannerMain.main(LfsoPlannerMain.java:27)
>
>
>
> The drl:
> rule "intervalRequirementCovered"
Let's take a look
>   when
>   $intervalReq : IntervalRequirement($interval : interval, 
> $position :
> position, $staffingRequired : staffingRequired)
>  $matchingShiftAssignments : ArrayList( size<= $staffingRequired )
>   from 
> collect ( ShiftAssignment(shiftStartTime<= $interval,
> shiftEndTime>  $interval, position == $position) )
I never used "from collect" in my examples yet.
You probably stumbled upon a "statefull memory corruption bug" in drools.

First try this alternative way:

$intervalReq : IntervalRequirement($interval : interval, 
$position : position, $staffingRequired : staffingRequired)
 $matchingShiftAssignmentSize : Number(intValue <= 
$staffingRequired) from accumulate(
 $x : ShiftAssignment(shiftStartTime <= $interval, 
shiftEndTime > $interval, position =

Re: [rules-users] Salience & activation-group

2011-12-06 Thread Swindells, Thomas

> Thanks for your quick response, but I am still confused.
>
> An activation-group assures that only one rule in the group will fire (an XOR
> group)
>
> Salience controls the order of evaluation
No salience controls the order of the activations firing.
There is no ordering of evaluating rules because rules aren't evaluated.
Instead the rules clauses are transposed into a RETE graph which evaluates each 
clause as the necessary data is available.
If two rules share a clause then they may share a node in the RETE graph.

> The regular expression test has the higher salience and will trigger if it is 
> a bad
> number ... so why is the other rule even being tested?
The RETE graph is evaluated as deeply as possible in order to produce the 
current list of possible activations.
The activations are then sorted by salience and filtered by agenda-group. The 
top of the list is taken and fired.
If any other pending activations have the same activation-group those pending 
activations are then removed.
(It's a lot more complicated than that as you have things such as lock on 
active, no-loop, etc but it hopefully
makes it make a little more sense.

>
> In the mean time I will re-write the underWritingClassAsInt method to deal
> with a bad number ... but this seems wrong to me.
Or do the check for both parts in both rules , or use inheritance, but the 
easiest way would probably be to just have it return null if the number isn't 
valid - at least if you are just doing in comparisons.

Thomas


**
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


Re: [rules-users] Salience & activation-group

2011-12-06 Thread Java Bean
Or do the check for both parts in both rules , or use inheritance, but the
easiest way would probably be to just have it return null if the number
isn't valid - at least if you are just doing in comparisons.

How do I use inheritance in Drools ?
  --
*From:* "Swindells, Thomas" 
*To:* Rules Users List 
*Sent:* Tuesday, December 6, 2011 11:15 AM
*Subject:* Re: [rules-users] Salience & activation-group


> Thanks for your quick response, but I am still confused.
>
> An activation-group assures that only one rule in the group will fire (an
XOR
> group)
>
> Salience controls the order of evaluation
No salience controls the order of the activations firing.
There is no ordering of evaluating rules because rules aren't evaluated.
Instead the rules clauses are transposed into a RETE graph which evaluates
each clause as the necessary data is available.
If two rules share a clause then they may share a node in the RETE graph.

> The regular expression test has the higher salience and will trigger if
it is a bad
> number ... so why is the other rule even being tested?
The RETE graph is evaluated as deeply as possible in order to produce the
current list of possible activations.
The activations are then sorted by salience and filtered by agenda-group.
The top of the list is taken and fired.
If any other pending activations have the same activation-group those
pending activations are then removed.
(It's a lot more complicated than that as you have things such as lock on
active, no-loop, etc but it hopefully
makes it make a little more sense.

>
> In the mean time I will re-write the underWritingClassAsInt method to deal
> with a bad number ... but this seems wrong to me.
Or do the check for both parts in both rules , or use inheritance, but the
easiest way would probably be to just have it return null if the number
isn't valid - at least if you are just doing in comparisons.

Thomas


**
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
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Salience & activation-group

2011-12-06 Thread ronalbury
Thank you Thomas ... I understand what you are saying and appreciate the
explanation (hopefully it will reduce the number of future questions I
have).  I guess I was looking for an 'evaluation-group' and confused it with
the 'activation-group'. 

Please do not take offense at this - it is important that the development
team understand how Drools is being used, and how it is being received in
the marketplace (and I am not suggesting I could do any better).  I was told
that Drools would suck-up my cpu, and I am now gaining some insight into
why.  

For all of the theoretical underpinnings of Expert, I am ending up with lots
of rules with essentially the same condition (I am including not 
in that lot).  This leads to a less clarity and more difficult maintenance. 
I have also read about and received suggestions that I include extra 'dummy'
(e.g. show-stopper) objects to get the behavior I'm seeking.  My concern is
that this really screws up the clarity and that our analysts won't really
understand (nor should they be asked to).

Is there any advantage to my considering a rule-flow rather than drl rules? 
I am still a newbie and haven't tried rule-flow, but I'm thinking a
rule-flow may improve the clarity.  However, I'm also guessing that a rule
flow does the same sort of evaluations you just explained to me.  If that is
so, would this approach make a bad cpu situation even worse?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Salience-activation-group-tp3564649p3564877.html
Sent from the Drools: User forum 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] Salience & activation-group

2011-12-06 Thread Swindells, Thomas
Good question, not sure it is documented properly at the moment, I think it is 
the extends keyword, but you can't easily use it anyway as you want the inverse 
of the other rule (regex doesn't match) rather than the regex does match.

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Java Bean
Sent: 06 December 2011 16:35
To: Rules Users List
Subject: Re: [rules-users] Salience & activation-group


Or do the check for both parts in both rules , or use inheritance, but the 
easiest way would probably be to just have it return null if the number isn't 
valid - at least if you are just doing in comparisons.

How do I use inheritance in Drools ?


From: "Swindells, Thomas" mailto:tswinde...@nds.com>>
To: Rules Users List 
mailto:rules-users@lists.jboss.org>>
Sent: Tuesday, December 6, 2011 11:15 AM
Subject: Re: [rules-users] Salience & activation-group


> Thanks for your quick response, but I am still confused.
>
> An activation-group assures that only one rule in the group will fire (an XOR
> group)
>
> Salience controls the order of evaluation
No salience controls the order of the activations firing.
There is no ordering of evaluating rules because rules aren't evaluated.
Instead the rules clauses are transposed into a RETE graph which evaluates each 
clause as the necessary data is available.
If two rules share a clause then they may share a node in the RETE graph.

> The regular expression test has the higher salience and will trigger if it is 
> a bad
> number ... so why is the other rule even being tested?
The RETE graph is evaluated as deeply as possible in order to produce the 
current list of possible activations.
The activations are then sorted by salience and filtered by agenda-group. The 
top of the list is taken and fired.
If any other pending activations have the same activation-group those pending 
activations are then removed.
(It's a lot more complicated than that as you have things such as lock on 
active, no-loop, etc but it hopefully
makes it make a little more sense.

>
> In the mean time I will re-write the underWritingClassAsInt method to deal
> with a bad number ... but this seems wrong to me.
Or do the check for both parts in both rules , or use inheritance, but the 
easiest way would probably be to just have it return null if the number isn't 
valid - at least if you are just doing in comparisons.

Thomas


**
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

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


[rules-users] Sliding window behavior in stream mode and realtime clock

2011-12-06 Thread MarcoMojana
Hi,

The situation is the following: we need to process a stream of delayed
events. This means that the event timestamp is provided for each one
of them and that it doesn't generally correspond to the system time when
we insert them in the entry-point. The events delay may vary, but they
are always inserted in chronological order. My questions refer to the
enclosed implementation and are:
1) Given my source code, would the timestamps correctly read and used?
2) I would like that the "time window" behaves as if it is initially
   placed at t = -inf and, when a new event is inserted in the
   entry-point, it would slide to the time of the last event timestamp.
   In my code I have used the stream mode and a realtime clock: is it
   correct?
3) When I run the given application, I expect it to print only:
   Found TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011]
   because it is the only event of type TriggerEvent for which there
   exists a window of size 1h that contains no InhibitEvent. Instead,
   sometimes it prints nothing and sometimes:
   Found TriggerEvent [timestamp=Tue Dec 06 14:10:00 CET 2011]
   Found TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011]
   How is this possible? How can I achieve my goal?

(I'm currently using Drools 5.3.0 final.)

Cheers

Marco Mojana



package com.sample;

import java.sql.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;

import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.conf.EventProcessingOption;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.KnowledgeSessionConfiguration;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.conf.ClockTypeOption;
import org.drools.runtime.rule.WorkingMemoryEntryPoint;

public class DroolsTest {

public static final void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();

final KnowledgeSessionConfiguration sessionConfig =
KnowledgeBaseFactory.newKnowledgeSessionConfiguration();

sessionConfig.setOption(ClockTypeOption.get("realtime"));
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession(sessionConfig, null);
WorkingMemoryEntryPoint eventStream =
ksession.getWorkingMemoryEntryPoint("EventStream");
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");

// Insert events
eventStream.insert(new InhibitEvent(new 
GregorianCalendar(2011,
Calendar.DECEMBER, 6, 12,  0, 0).getTime()));
eventStream.insert(new TriggerEvent(new 
GregorianCalendar(2011,
Calendar.DECEMBER, 6, 13,  0, 0).getTime()));
eventStream.insert(new InhibitEvent(new 
GregorianCalendar(2011,
Calendar.DECEMBER, 6, 14,  0, 0).getTime()));
eventStream.insert(new TriggerEvent(new 
GregorianCalendar(2011,
Calendar.DECEMBER, 6, 14, 10, 0).getTime()));
eventStream.insert(new InhibitEvent(new 
GregorianCalendar(2011,
Calendar.DECEMBER, 6, 14, 20, 0).getTime()));

ksession.fireAllRules();
ksession.dispose();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}

private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Rules.drl"),
ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse 
knowledge.");
}

final KnowledgeBaseConfiguration kbConfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbConfig.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = 
KnowledgeBaseFactory.newKnowledgeBase(kbConfig);

Re: [rules-users] Sliding window behavior in stream mode and realtime clock

2011-12-06 Thread Wolfgang Laun
See below.

On 06/12/2011, MarcoMojana  wrote:
> Hi,
>
> The situation is the following: we need to process a stream of delayed
> events. This means that the event timestamp is provided for each one
> of them and that it doesn't generally correspond to the system time when
> we insert them in the entry-point. The events delay may vary, but they
> are always inserted in chronological order. My questions refer to the
> enclosed implementation and are:
> 1) Given my source code, would the timestamps correctly read and used?

I haven't checked this carefully, but it seems that your declare's contain
@timestamp(...) referring to the correct field - so why not?

> 2) I would like that the "time window" behaves as if it is initially
>placed at t = -inf and, when a new event is inserted in the
>entry-point, it would slide to the time of the last event timestamp.
>In my code I have used the stream mode and a realtime clock: is it
>correct?

A virtual ("pseudo") clock is indicated. The timestamp of the facts
should control the advancement of the clock.

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


[rules-users] target directory checked in?

2011-12-06 Thread Laird Nelson
I just did a git pull on the drools repositories and noticed that at least
one of the projects has the target directory checked in.  Was this
intentional?

My apologies if this is a known issue or deliberate.  It just struck me as
odd, that's all.

Arbitrary excerpt:

 create mode 100644
drools-ruleml/target/test-classes/ruleml/translator/TestDataModel$Sell.class
 create mode 100644
drools-ruleml/target/test-classes/ruleml/translator/TestDataModel.class
 create mode 100644
drools-ruleml/target/test-classes/ruleml/translator/TestDrools2RuleML.class
 create mode 100644
drools-ruleml/target/test-classes/ruleml/translator/TestRuleML2Drools.class
 create mode 100644
drools-ruleml/target/test-classes/ruleml/translator/Util.class

Best,
Laird

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


Re: [rules-users] target directory checked in?

2011-12-06 Thread Michael Anstis
What is the git URL you used?

drools-rulem1 does not match any of ours at https://github.com/droolsjbpm

2011/12/6 Laird Nelson 

> I just did a git pull on the drools repositories and noticed that at
> least one of the projects has the target directory checked in.  Was this
> intentional?
>
> My apologies if this is a known issue or deliberate.  It just struck me as
> odd, that's all.
>
> Arbitrary excerpt:
>
>  create mode 100644
> drools-ruleml/target/test-classes/ruleml/translator/TestDataModel$Sell.class
>  create mode 100644
> drools-ruleml/target/test-classes/ruleml/translator/TestDataModel.class
>  create mode 100644
> drools-ruleml/target/test-classes/ruleml/translator/TestDrools2RuleML.class
>  create mode 100644
> drools-ruleml/target/test-classes/ruleml/translator/TestRuleML2Drools.class
>  create mode 100644
> drools-ruleml/target/test-classes/ruleml/translator/Util.class
>
> Best,
> Laird
>
> --
> http://about.me/lairdnelson
>
> ___
> 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] 'else' in rule

2011-12-06 Thread JimK
My $.02
I'm early in my use of Drools and Rules and struggled at first with the lack
of ELSE.  At first I would frequently feel "an ELSE would be prefect here". 
After awhile I believe that NOT having Else is a good thing.   As I get
better with writing rules I find that most of the times when I think I need
an Else it usually means I should take a closer look at the rule.  

If I have a true Else situation for me I put the two rules one right after
another. In these situations I think it is better to have to write the
"ELSE" rule as effectively a NOT of the WHEN rule then having an ELSE fall
through. Isn't that much extra coding and usually gives me pause to give it
one more evaluation to see if this is a true ELSE or a new rule with similar
criteria from the When.

Many times the ELSE covers too many possibilities that should be explicitly
checked and for me at least tells me I might not have fully broken the
requirements down.  As another posting indicates the complexity of
implementing it I also wonder about the performance hit the logic to allow
for an ELSE would add.

With my current understanding of business rules and drools I would vote
against an ELSE.

Jim K.

--
View this message in context: 
http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3565278.html
Sent from the Drools: User forum 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] 'else' in rule

2011-12-06 Thread Mark Proctor
On 06/12/2011 19:08, JimK wrote:
> My $.02
> I'm early in my use of Drools and Rules and struggled at first with the lack
> of ELSE.  At first I would frequently feel "an ELSE would be prefect here".
> After awhile I believe that NOT having Else is a good thing.   As I get
> better with writing rules I find that most of the times when I think I need
> an Else it usually means I should take a closer look at the rule.
>
> If I have a true Else situation for me I put the two rules one right after
> another. In these situations I think it is better to have to write the
> "ELSE" rule as effectively a NOT of the WHEN rule then having an ELSE fall
> through. Isn't that much extra coding and usually gives me pause to give it
> one more evaluation to see if this is a true ELSE or a new rule with similar
> criteria from the When.
>
> Many times the ELSE covers too many possibilities that should be explicitly
> checked and for me at least tells me I might not have fully broken the
> requirements down.  As another posting indicates the complexity of
> implementing it I also wonder about the performance hit the logic to allow
> for an ELSE would add.
>
> With my current understanding of business rules and drools I would vote
> against an ELSE.
What is currently in early propsoal stage is a sort of directional data 
flow concept:
http://community.jboss.org/wiki/RelationalDataFlows

While there is no 'else' keyword you can control the direction of flow 
from failure of a tuple to propagate, this allows you create tree like 
data structures to handle the flow, which can solve "else" like situations.

For me the most interesting and useful construct there will be the 
"case" statement, which I find I often need.  I'm looking to be able to 
better handle signal processing type problems, that people might use 
languages such as erlang for.

Mark
>
> Jim K.
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3565278.html
> Sent from the Drools: User forum 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] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?

2011-12-06 Thread Patrik Dufresne
I'm still experimenting with Drools Planner and I also have the exact same
issue :

java.lang.IllegalStateException: The presumedScore (0hard/-1soft) is
corrupted because it is not the realScore  (0hard/0soft).
Presumed workingMemory:
  Score rule (soft-ReduceNullAssignment) has count (1) and weight total (1).
Real workingMemory:
at
org.drools.planner.core.solution.director.DefaultSolutionDirector.assertWorkingScore(DefaultSolutionDirector.java:157)
at
org.drools.planner.core.solver.DefaultSolverScope.assertWorkingScore(DefaultSolverScope.java:105)
at
org.drools.planner.core.phase.AbstractSolverPhaseScope.assertWorkingScore(AbstractSolverPhaseScope.java:132)
at
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:69)
at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166)
at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138)
...

I've read this (https://issues.jboss.org/browse/JBRULES-3301), but it
didn't help :

   - I'm using IntConstraintOccurrence
   - I double check the soft constraint named "soft-ReduceNullAssignment"
   -- it's include all the cause.
   - I'm using Drools 5.3

After more digging, I think something is missing in
DefaultSolutionDirector.java:153. The facts are added, but the
planningEntity are not added. So when the score calculation is running,
there is two different result. I'v place a breakpoint
at DefaultSolutionDirector.java:157 and looking
in tmpWorkingMemory->defaultEntryPoint->objectStore->identifyMap->table, I
don't see the planningEntity.

Here is the my rule :

rule "soft-ReduceNullAssignment"
when
$planif : PlanifEventAssignment( employee == null )
then
insertLogical(new
IntConstraintOccurrence("soft-ReduceNullAssignment",
ConstraintType.NEGATIVE_SOFT,
1,
$planif));
end


Thanks

On Tue, Dec 6, 2011 at 11:12 AM, Geoffrey De Smet
wrote:

>
>
> Op 06-12-11 05:38, guyramirez schreef:
> > Still the same issue, starting with the construction heuristic phase.
> Please
> > let me know if you need more explanations in what I am trying to do.
> >
> > Here is the error. Please note that there is only one planning entity
> > (ShiftAssignment) object instance in this test.
> >
> > Total Staffing required: 8
> > 2011-12-05 22:21:49,627 [main] INFO  Solver started: time spend (0),
> score
> > (null), new best score (null), random seed (0).
> > ShiftAssignment: emp. id: 10 [st: 100, dur: 3]
> > ShiftAssignment: emp. id: 10 [st: 100, dur: 2]
> > ShiftAssignment: emp. id: 10 [st: 100, dur: 4]
> > ShiftAssignment: emp. id: 10 [st: 100, dur: 1]
> > 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence
> summary
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 101, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10
> [st:
> > 100, dur: 1]]]=1)
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 103, position id: 1, staffingRequired: 2, []]=2)
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 102, position id: 1, staffingRequired: 2, []]=2)
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10
> [st:
> > 100, dur: 1], ShiftAssignment: emp. id: 10 [st: 100, dur: 1]]]=0)
> > 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence
> summary
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 101, position id: 1, staffingRequired: 2, []]=2)
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 103, position id: 1, staffingRequired: 2, []]=2)
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10
> [st:
> > 100, dur: 1]]]=1)
> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence
> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval:
> > 102, position id: 1, staffingRequired: 2, []]=2)
> > Exception in thread "main" java.lang.IllegalStateException: The
> > presumedScore (-5hard/-1soft) is corrupted because it is not the
> realScore
> > (-7hard/-1soft).
> > Presumed workingMemory:
> >Score rule (intervalRequirementCovered) has count (4) and weight total
> > (5).
> > Real workingMemory:
> >Score r

Re: [rules-users] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?

2011-12-06 Thread guyramirez
Patrik: thx for your feedback. Did you get the chance to run your rule using
Expert only without Planner? I just did that (wrote a test program to change
my planning entity values and update the StatefulKnowledgeSession few times
in row) and I came up with the same currupted result.

Geoffrey: thx for looking at my stuff. I still have the same issue with the
rule modified not to use collect (that's how it was actually written
originally. I later used Collect to be able to add the collection itself as
a cause to the logical insert, thinking that would solve my issue).

I am still wondering: the nurse example is far more complicated that what I
am trying to accomplish with my simple test case, and still it runs fine.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3566474.html
Sent from the Drools: User forum 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] How can I get Rule Id

2011-12-06 Thread srinivasasanda
Thank you Manstis

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-I-get-Rule-Id-tp3564401p3566518.html
Sent from the Drools: User forum 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] Dynamic Fact(field) Generation in Declarative Model

2011-12-06 Thread srinivasasanda
Hi Manstis,

I couldn't find any of the packages.Unable to import them in Drools
5.0.1.I've searched github,grepcode.com but unable to find those
packages.Could you please help me with the small piece of code,how to do
dynamic field generation.Thanks for your valuable replies till now.

Thanks

--
View this message in context: 
http://drools.46999.n3.nabble.com/Dynamic-Fact-field-Generation-in-Declarative-Model-tp3545088p3566534.html
Sent from the Drools: User forum 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] How to let a rule run only one time

2011-12-06 Thread xdyl
i try you code.


  ksession.getAgenda().getAgendaGroup("add").setFocus();  
ksession.fireAllRules();

and it worked

print 


add2









--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p354.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users