Re: [rules-users] Planner: What is a good example/algo to chain entities?

2013-02-08 Thread Michiel Vermandel
Hi,

Any one got an idea?

Thanks


 
-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials



 From: Michiel Vermandel mverm...@yahoo.com
To: Rules lists.jboss.org rules-users@lists.jboss.org 
Sent: Wednesday, February 6, 2013 8:44 AM
Subject: [rules-users] Planner: What is a good example/algo to chain entities?
 

Hi,

I need to keep some Planning entities (Tasks) together and I am looking for 
some insights/ideas/examples in how to tackle this.
Tasks are grouped by a groupId (Groups are problem facts).

The Tasks do not have to be grouped like a pillar but more like an accordion.
One of the planning variables is Period, a Period typically is 3 weeks and we 
have 12 Periods to plan the tasks into.


The requirement is that all tasks within  a group need to be kept together in 
such a way that:
- the spread (nr of periods) of the tasks is minimal
- the spread is never more than the sum of the duration of the separate tasks 
in the group.

So given a group of 3 tasks:

1)This is good:

Period 12345789ABC

T1:  xxx
T2: xx
T3:   x

2)This is better:

Period 12345789ABC

T1:  xxx
T2:   xx
T3: x

3)This is (one of) the best:

Period 12345789ABC

T1:  xxx
T2:   xx
T3:    x

4)This is bad:

Period 12345789ABC

T1:  xxx
T2:   xx
T3:  x

Of course 3 is favorite, but maybe not possible due to other planning variables 
(- availability of people to execute the tasks).
I need to plan a few hundred of such groups of tasks which all share the same 
Period space and list of available people.
(A person can only do one task per period)


I have got the DRL rule that keeps the tasks together (rule counts the gaps) , 
but giving penalty for making gaps (by shifting a single task) makes it hard to 
find a good solution.
What would be the best approach to solve this problem?

- A combination of custom mover and swapper which moves/swaps groups instead of 
single tasks?
- The above in combination with a group shuffle factory (swapping tasks in a 
single group)?


Other ideas?

Thanks a lot!

-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
___
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] Blaze to drools

2013-02-08 Thread starfish15
Hello,

We have a situation wherein we want to convert rules from Blaze into Drools.
Basically closed to open source. I would highly appreciate if someone could
guide me in this case.

Regards,
Starfish



--
View this message in context: 
http://drools.46999.n3.nabble.com/Blaze-to-drools-tp4022151.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] Find out order of insert in RHS

2013-02-08 Thread Sandjaja, Dominik
Hello Wolfgang,

thank you for the hint. I introduced a new Class Counter with just an int 
property and a method getAndIncrease. This class is referenced in a base rule 
which all the other rules extend.

On the RHS of all rule inserts I set a field to the value of 
c.getAndIncrease() which gives me the correct order. The hint with the static 
counter was the right one!

Regards
Dominik

-Ursprüngliche Nachricht-
Von: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun
Gesendet: Donnerstag, 7. Februar 2013 18:59
An: Rules Users List
Betreff: Re: [rules-users] Find out order of insert in RHS

If object creation is done in the same order as the insertion: surely a simple 
static counter in the class would give you the required monotonous value.

Otherwise, a listener could be set, which will see the actual order of 
insertion, and it can set the order-of-insertion property.

-W


On 07/02/2013, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote:
 Hi everybody,

 short: is there a way to have an automatic counter for the RHS of a
 rule when inserting several objects in one rule?

 Long:
 I use drools with a DSL to insert items for a frontend dropdown box.
 The generated rule is e.g. like the following one:

 rule testRule_H
 dialect mvel
 when
 SomePartOfMyModel( someField == H )
 then
 DropDownItem fact1 = new DropDownItem();
 fact1.setLabel( My Label 1 ); fact1.setValue( B );

 insert (fact1);
 DropDownItem fact1 = new DropDownItem();
 fact1.setLabel( My Label 2 ); fact1.setValue( A );

 insert (fact1);

 This works nicely and I get all the items. The problem I have is with
 the sorting. Users use Guvnor to edit the available items for the
 dropdown box, so they add and remove items from the RHS. Since I
 retrieve those objects from the knowledge base in my java code like this:

 CollectionFactHandle handles =
 statefulKnowledgeSession.getFactHandles(new
 ClassObjectFilter(DropDownItem.class));
 for (FactHandle handle : handles) {
 DropDownItem selectItem = (DropDownItem)
 statefulKnowledgeSession.getObject(handle);
 ...

 I think I cannot be sure about the order the objects are retrieved
 (it's a collection, no guaranteed sorting!). So, I sort the
 DropDownItems alphabetically by their value.

 My question now is, as stated above: How can I implement a counter
 which I can use in the facts being inserted to keep my inserted facts
 (DropDownItems) in the same order as they are inserted?

 Thanks in advance
 Dominik

 …
 mit freundlichen Grüßen / kind regards Dominik Sandjaja
 Fon: +49 (0) 203 60878 183
 Fax: +49 (0) 203 60878 222
 e-mail: dominik.sandj...@it-motive.de

 it-motive AG
 Zum Walkmüller 10-12
 47269 Duisburg
 i...@it-motive.de
 http://www.it-motive.de
 ……
 Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub
 Vorstand: Horst-Dieter Deelmann (Vors.),  Matthias Heming, Christoph
 Tim Klose HRB 9207, Amtsgericht Duisburg

 ___
 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

…
mit freundlichen Grüßen / kind regards
Dominik Sandjaja
Fon: +49 (0) 203 60878 183
Fax: +49 (0) 203 60878 222
e-mail: dominik.sandj...@it-motive.de

it-motive AG
Zum Walkmüller 10-12
47269 Duisburg
i...@it-motive.de
http://www.it-motive.de
……
Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub
Vorstand: Horst-Dieter Deelmann (Vors.),  Matthias Heming, Christoph Tim Klose
HRB 9207, Amtsgericht Duisburg

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

Re: [rules-users] Planner: What is a good example/algo to chain entities?

2013-02-08 Thread rjr201
It sounds like a really interesting task that you are working on. But I've
read this through a couple of times and I'm afraid (and I suspect I'm not
alone) I don't really understand a lot of the terms you use. 


mvermand wrote
 The Tasks do not have to be grouped like a pillar but more like an
 accordion.







--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Planner-What-is-a-good-example-algo-to-chain-entities-tp4022083p4022153.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] Uploading JAR using REST

2013-02-08 Thread rjr201
Thanks for your help. I'll take a look at that. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Uploading-JAR-using-REST-tp4022115p4022154.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] Blaze to drools

2013-02-08 Thread Stephen Masters
That would depend very much on what kind of Blaze app you have. Usually, 
building a Blaze application is about building a rules management web site 
based on lots of code templates nested within other code templates. The rules 
engine itself is a very minor consideration. The corollary would be to use 
Guvnor, but I would say that it's a long way off being a one-for-one mapping.

Much as I like Guvnor, it doesn't lend itself so well to building such a custom 
rules management app. It's more about doing things the Guvnor way, which 
non-technical users tend to find off-putting due to a lot of stuff which looks 
like code rather than plain English. That is unless you build your own web app 
in which you embed Guvnor components, or interact with the repository via REST.

Much will depend on how much of the application has been built up with code 
templates, which do a lot of heavy lifting in the Blaze world. Blaze has very 
rich capabilities along those lines, making it possible to build simple-seeming 
decision tables, which do quite complex things underneath. Guvnor is starting 
to get similar functionality using BRL fragments in decision tables, but that's 
pretty new, and I would say that if the existing application makes heavy use of 
nested code templates, then you might struggle to get equivalent functionality 
in a Guvnor decision table. Likewise, the way Guvnor guided editor works with 
DSLs is a lot more simplistic than what Blaze provides, so again depending on 
the complexity of those code templates, what you can do in Guvnor may look 
rather clunky in comparison.

In general, as a first step it's probably worth having a dig through the app to 
see how complex the code fragments are. If it has all been built using decision 
tables, with very little in the way of code fragments, it should be an easy 
transition.

On a side note, I'm a bit curious what the reasoning is for doing such a 
re-write. Unless the plan is to run the application on the community supported 
Drools platform rather than JBPM, the cost of the license wouldn't be an issue. 
Similarly, although the community is growing, I don't get the impression that 
there is a very large supply of quality Drools consultants out there.

Steve


On 8 Feb 2013, at 09:59, starfish15 pooja.gh...@accenture.com wrote:

 Hello,
 
 We have a situation wherein we want to convert rules from Blaze into Drools.
 Basically closed to open source. I would highly appreciate if someone could
 guide me in this case.
 
 Regards,
 Starfish
 
 
 
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Blaze-to-drools-tp4022151.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] Guvnor-5.5

2013-02-08 Thread Stephen Masters
Sounds like a plan. I'll get stuck into it and write up the experiences. I 
suspect that anybody who's conservative enough to be locked into WAS is 
probably not going to be too keen to hit up 6.0 for a little while. So I'll 
have a go at 5.5 for now, as at least I know the Tomcat build is pretty stable 
and should be a decent starting point. If I have time I'll apply the same steps 
to 6.0 and see where they diverge (if at all).

Any big differences between 5.5 and 6.0 that you can think of off-hand, which 
are likely to cause them to need different steps? I haven't had a look at the 
tech stack under 6.0 yet.

Now I'm going to have to brush off my WAS skills. My JEE bloatware app server 
experience is mostly with WebLogic. :)


On 7 Feb 2013, at 22:22, Michael Anstis michael.ans...@gmail.com wrote:

 Hi Stephen,
 
 We're asked how to run Guvnor on WebSphere quite often... if you fancy taking 
 a look we can blog your achievements and you can take your place in history ;)
 
 Targeting 6.0 would add to the coolness - but might have less interest from 
 others in the community.
 
 Cheers,
 
 Mike
 
 sent on the move
 
 On 7 Feb 2013 18:28, Stephen Masters stephen.mast...@me.com wrote:
 
 I guess that most folks who are tied into the WebSphere stack probably just 
 go with JRules rather than Drools. Although FICO is also thoroughly usable in 
 that stack.
 
 I'd probably recommend using Drools Expert within your application on WAS, 
 and stick with running Guvnor on Tomcat, as it does't need to be part of a 
 'production' installation.
 
 However … is there much interest in getting Guvnor up and running on 
 alternative app servers such as WAS/WebLogic/Glassfish?
 
 I intend to be unemployed for the next few weeks, and I was thinking of 
 finding myself a little OS project to work on. :)
 
 Steve
 
 
 On 7 Feb 2013, at 15:23, Michael Anstis michael.ans...@gmail.com wrote:
 
 Drools Expert is just a Java library and should work on WebSphere as well as 
 any other (to the best of my knowledge, but always happy to learn something 
 new!)
 
 Guvnor is really the issue as we do not have an off the shelf distribution 
 targeting WAS (not that we wouldn't want to, but nobody in the community has 
 been prepared to work out what is required).
 
 IDK if RedHat Consulting would be able to advise on setting up Guvnor on 
 WAS... but I'll forward this email to others who might know better.
 
 RedHat's certified BRMS does not contain the most recent features.
 
 With kind regards,
 
 Mike
 
 On 7 February 2013 15:03, Ricardo sprabak...@gmail.com wrote:
 ok,
 I understand your goal, what is your advise for the companies already using
 WAS server and wants to try drools expert and guvnor for rules engine POC .
 need to get certified version for POC too? is the certified version got all
 the latest futures?
 
 
 
 -
 with kind regards,
 
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Guvnor-5-5-tp4022096p4022121.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
 
 ___
 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] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread pdario
Damn, I can't!

Simple rule

rule TEST
  dialect mvel
when
  s : String()
then
  System.out.println(s);
end

Java Test

StatefulKnowledgeSession s = ...
s.insert(ONE);
s.insert(TWO);
s.fireAllRules();
s.dispose();

Output

TWO

What the...???

Using v5.4.0.Final



--
View this message in context: 
http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157.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] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread pdario
Can you suggest a way to diagnose what's going wrong?

I added DebugAgendaEventListener and DebugWorkingMemoryEventListener, but
the output is too confusing for me



--
View this message in context: 
http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022159.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] Ruleflow not working with stateless session in drools-server 5.5.0.Final

2013-02-08 Thread tslonaker
I am new to Drools and I am struggling with this ruleflow issue.  Please let
me know if I have been posting this info to the wrong message board.  

My situation is that I am working on converting our application from using
an expensive commercial rule engine to Drools.  Our rule engine
implementation uses a stateless server and it heavily depends on ruleflows. 
We could develop the rules using salience but that isn't ideal.

It seems to me that there is still a bug in drools-server when using
ruleflows in a stateless session.  It seems that the fix for  issue 2718
https://issues.jboss.org/browse/JBRULES-2718   partially fixed the
problem.  There is an easy workaround if you are coding your solution in
Java.  You just create a new instance of the Stateless session every time. 
But in drools-server I don’t have any control over that. 


tslonaker wrote
 I found a much easier way to recreate the problem described in my previous
 post.  I believe I have also found the root cause of the problem.  Below
 are the steps to recreate the issue: 
 
 - Create a simple ruleflow and rules and compile them into a rule package.
 - In code create a stateless session
 - In a loop
 o Create a fact
 o Create a new execution batch with the following commands
 - Insert the fact from above
 - Start Process 
 - Fire All Rules
 - Get Objects
 o Execute the batch
 o Check the results (number of rules that ran)
 
 I posted before that the problem didn’t happen while executing locally
 (not in drools server).  I didn’t realize this before, but adding a loop
 that executes the rules multiple times with the same session recreates the
 problem.  
 
 Below is code that will recreate the issue.  Notice that the code below
 creates one instance of ksession and reuses it in the loop.  
 
   //Setup
   KnowledgeBuilder kbuilder =
 KnowledgeBuilderFactory.newKnowledgeBuilder();
 
   //The package includes the ruleflow
   kbuilder.add( ResourceFactory.newFileResource(
 (YourRulePackage_WithRuleflow.pkg) ), ResourceType.PKG );
   KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
   kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
*
   //Create the stateless knowledge session outside the for loop
   StatelessKnowledgeSession ksession =
 kbase.newStatelessKnowledgeSession();
*
 
   //Loop through executing the rules with the same data 3 times
   for (int x = 0; x  3; x++)
   {
   //Create a new instance of the input fact 
   FactType inputDataType = 
 kbase.getFactType(SimpleRuleflowTest, 
 Input);
   Object inputData = inputDataType.newInstance();
   inputDataType.set(inputData, Name, Test data);
 
   //Create a new instance of the command list
   List cmds = new ArrayList();
   cmds.add( CommandFactory.newInsert( inputData ));
   cmds.add( CommandFactory.newStartProcess( TestRuleflow));
   cmds.add( CommandFactory.newFireAllRules(rules));
   cmds.add( CommandFactory.newGetObjects(output));  
   
 
   //Execute the rules
   ExecutionResults results = ksession.execute(
 CommandFactory.newBatchExecution( cmds ) );
 
   //Get the number of rules that ran
   Object rules = results.getValue(rules);
   System.out.println(Rules that ran:   + rules.toString());
   }
 
 
 
 Each iteration through the loop should fire 3 rules.  Running the code
 above you should get the following output:
 
Rules that ran:  3
Rules that ran:  1
Rules that ran:  1
  
 
 I spent several hours researching the drools source code and I believe I
 have found the problem.  What I have found is related to 
 Issue 2718 https://issues.jboss.org/browse/JBRULES-2718  
 .  
 Check out the change made for this issue:  
 2718 fix
 https://source.jboss.org/viewrep/Drools/drools-core/src/main/java/org/drools/impl/StatelessKnowledgeSessionImpl.java?r1=63021da325036ec6fbdf4019e8c8293db21555ecr2=fad9b951f44ac813e5faf50f097335c2a97007ae
   
 .  
 
 Below is a snippet from the code that was modified for issue 2718.  The
 “if (!initialized)” block was added.  The code loops through event
 listeners on the wm object and adds them to the stateless session’s
 listeners.  This works fine for the first rule execution.  But the next
 rule execution creates a new instance for wm.  Therefore it also creates
 new instances of listeners for wm.  So we have a new instance of wm and
 the stateless session is pointing to the old listeners from the first
 instance of wm.  I believe that is why it only runs correctly one time. It
 seems that that the “if (!initialized)” block of code needs to execute
 every time newWorkingMemory() is called.  
 
   public StatefulKnowledgeSession newWorkingMemory() {
   :

Re: [rules-users] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread pdario
I'll try to make it; in the meanwhile, do you find this meaningful?

==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST, act#=0,
salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]
], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
==[ObjectInsertedEventImpl: getFactHandle()=[fact
0:1:30100654:78406:1:DEFAULT:ONE], getObject()=ONE,
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c,
getPropagationContext()=PropagationContextImpl [activeActivations=0,
dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:1:30100654:78406:1:DEFAULT:ONE], leftTuple=null, originOffset=-1,
propagationNumber=3, rule=null, type=0]]
==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST, act#=1,
salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
==[ObjectInsertedEventImpl: getFactHandle()=[fact
0:2:30649454:83500:2:DEFAULT:TWO], getObject()=TWO,
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c,
getPropagationContext()=PropagationContextImpl [activeActivations=1,
dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:2:30649454:83500:2:DEFAULT:TWO], leftTuple=null, originOffset=-1,
propagationNumber=4, rule=null, type=0]]
TWO
==[BeforeActivationFiredEvent:  getActivation()=[Activation rule=TEST,
act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
==[ActivationCancelledEvent: getCause()=CLEAR, getActivation()=[Activation
rule=TEST, act#=0, salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]
], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
==[AfterActivationFiredEvent: getActivation()=[Activation rule=TEST,
act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
Direct Line, l'assicurazione online con il famoso Telefono Rosso e il Mouse
sulle Ruote. Nel 1985 Direct Line ha rivoluzionato il mercato nel Regno
Unito lanciando per prima la vendita diretta di polizze auto. In Italia ha
vinto nel 2008 il primo premio per i clienti piu' soddisfatti.
www.directline.it RESTRICTED: This e-mail (including any linked or attached
documents) is intended for the addressee/s only and may contain
confidential, proprietary or legally privileged information. Please do not
distribute further without prior permission from the author 




--
View this message in context: 
http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022162.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] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread Jeremy Ary
It appears you have a rule named CLEAR not included in the original post
that's cancelling the activation that should println ONE, can you share
this rule with us?


On Fri, Feb 8, 2013 at 9:10 AM, pdario dario.piantan...@gmail.com wrote:

 I'll try to make it; in the meanwhile, do you find this meaningful?

 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST, act#=0,
 salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]
 ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], getObject()=ONE,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c,
 getPropagationContext()=PropagationContextImpl [activeActivations=0,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], leftTuple=null, originOffset=-1,
 propagationNumber=3, rule=null, type=0]]
 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST, act#=1,
 salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], getObject()=TWO,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c,
 getPropagationContext()=PropagationContextImpl [activeActivations=1,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], leftTuple=null, originOffset=-1,
 propagationNumber=4, rule=null, type=0]]
 TWO
 ==[BeforeActivationFiredEvent:  getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ActivationCancelledEvent: getCause()=CLEAR, getActivation()=[Activation
 rule=TEST, act#=0, salience=0, tuple=[fact
 0:1:30100654:78406:1:DEFAULT:ONE]
 ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[AfterActivationFiredEvent: getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 Direct Line, l'assicurazione online con il famoso Telefono Rosso e il Mouse
 sulle Ruote. Nel 1985 Direct Line ha rivoluzionato il mercato nel Regno
 Unito lanciando per prima la vendita diretta di polizze auto. In Italia ha
 vinto nel 2008 il primo premio per i clienti piu' soddisfatti.
 www.directline.it RESTRICTED: This e-mail (including any linked or
 attached
 documents) is intended for the addressee/s only and may contain
 confidential, proprietary or legally privileged information. Please do not
 distribute further without prior permission from the author




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022162.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] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread Jeremy Ary
Actually, incorrect, I misread the output, sorry.


On Fri, Feb 8, 2013 at 9:12 AM, Jeremy Ary jeremy@gmail.com wrote:

 It appears you have a rule named CLEAR not included in the original post
 that's cancelling the activation that should println ONE, can you share
 this rule with us?


 On Fri, Feb 8, 2013 at 9:10 AM, pdario dario.piantan...@gmail.com wrote:

 I'll try to make it; in the meanwhile, do you find this meaningful?

 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST, act#=0,
 salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], getObject()=ONE,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c,
 getPropagationContext()=PropagationContextImpl [activeActivations=0,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], leftTuple=null, originOffset=-1,
 propagationNumber=3, rule=null, type=0]]
 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST, act#=1,
 salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], getObject()=TWO,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c,
 getPropagationContext()=PropagationContextImpl [activeActivations=1,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], leftTuple=null, originOffset=-1,
 propagationNumber=4, rule=null, type=0]]
 TWO
 ==[BeforeActivationFiredEvent:  getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
 ==[ActivationCancelledEvent: getCause()=CLEAR,
 getActivation()=[Activation
 rule=TEST, act#=0, salience=0, tuple=[fact
 0:1:30100654:78406:1:DEFAULT:ONE]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
 ==[AfterActivationFiredEvent: getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c]
 Direct Line, l'assicurazione online con il famoso Telefono Rosso e il
 Mouse
 sulle Ruote. Nel 1985 Direct Line ha rivoluzionato il mercato nel Regno
 Unito lanciando per prima la vendita diretta di polizze auto. In Italia ha
 vinto nel 2008 il primo premio per i clienti piu' soddisfatti.
 www.directline.it RESTRICTED: This e-mail (including any linked or
 attached
 documents) is intended for the addressee/s only and may contain
 confidential, proprietary or legally privileged information. Please do not
 distribute further without prior permission from the author




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022162.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] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread Jeremy Ary
==[ActivationCancelledEvent: getCause()=CLEAR, getActivation()=[Activation
rule=TEST, act#=0, salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]

There's definitely something cancelling the activation, but it's not
apparent to me right-out what's causing it based on the information
provided so far. To Estaban's comment, would it be possible to share an
isolated example as I can't help but to think there's something missing
from what we've seen so far that would cause this to occur.


On Fri, Feb 8, 2013 at 9:14 AM, Jeremy Ary jeremy@gmail.com wrote:

 Actually, incorrect, I misread the output, sorry.


 On Fri, Feb 8, 2013 at 9:12 AM, Jeremy Ary jeremy@gmail.com wrote:

 It appears you have a rule named CLEAR not included in the original post
 that's cancelling the activation that should println ONE, can you share
 this rule with us?


 On Fri, Feb 8, 2013 at 9:10 AM, pdario dario.piantan...@gmail.comwrote:

 I'll try to make it; in the meanwhile, do you find this meaningful?

 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST,
 act#=0,
 salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], getObject()=ONE,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ,
 getPropagationContext()=PropagationContextImpl [activeActivations=0,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], leftTuple=null, originOffset=-1,
 propagationNumber=3, rule=null, type=0]]
 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST,
 act#=1,
 salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], getObject()=TWO,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ,
 getPropagationContext()=PropagationContextImpl [activeActivations=1,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], leftTuple=null, originOffset=-1,
 propagationNumber=4, rule=null, type=0]]
 TWO
 ==[BeforeActivationFiredEvent:  getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ActivationCancelledEvent: getCause()=CLEAR,
 getActivation()=[Activation
 rule=TEST, act#=0, salience=0, tuple=[fact
 0:1:30100654:78406:1:DEFAULT:ONE]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[AfterActivationFiredEvent: getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 Direct Line, l'assicurazione online con il famoso Telefono Rosso e il
 Mouse
 sulle Ruote. Nel 1985 Direct Line ha rivoluzionato il mercato nel Regno
 Unito lanciando per prima la vendita diretta di polizze auto. In Italia
 ha
 vinto nel 2008 il primo premio per i clienti piu' soddisfatti.
 www.directline.it RESTRICTED: This e-mail (including any linked or
 attached
 documents) is intended for the addressee/s only and may contain
 confidential, proprietary or legally privileged information. Please do
 not
 distribute further without prior permission from the author




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022162.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] To group some objects by type

2013-02-08 Thread mdzaebel
Mister Nono wrote
 ... only the last car is in the TreeMap

Thats why I said /you need Lists or Maps as values of the TreeMap/.

*Here is fast solution:*
import Vehicle
import java.util.*
rule Print grouped vehicles
when  $map : Map() from accumulate ($v : Vehicle($w : wheels), 
init(TreeMap map=new TreeMap()), 
action( if(map.containsKey($w)) 
((List)map.get($w)).add($v); 
else map.put($w, new 
ArrayList(Arrays.asList($v)));),
result(map))
then  System.out.println($map);
end



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-group-some-objects-by-type-tp4022085p4022167.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] Drools 5.2 - 5.5 problems

2013-02-08 Thread darktyco
Hey everyone,

I have been running Drools 5.2 for a long time now and decided to try out
Drools 5.5 to see what was new. I felt that 5.2 was always a bit of a memory
hog so I was hoping that 5.5 would be better, however it seems to have
gotten worse. Previously I could run my company's test suite with -Xmx1024m
-XX:MaxPermSize=256m. Now I get:

[Error: Java heap space]
[Near : {... MyDomainObject != CE }]
 ^
[Line: 1, Column: 1]
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:308)
at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
at org.mvel2.MVEL.compileExpression(MVEL.java:810)
at
org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:435)
at
org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:238)
at
org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:206)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:190)
at
org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at 
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
at
my.company.KnowledgeBaseStatelessRuleEngine.execute(KnowledgeBaseStatelessRuleEngine.java:48)

I incrementally increased the max heap size in steps of 500m to see when the
heap error would go away and I had to go all the way up to 4000m. Is it
common knowledge that Drools requires more memory since 5.5? Is there
anything our rules could possibly be doing wrong that the newer versions
don't like?

Once I do get the tests running, I am getting a lot of errors about a
comparison to a string with the value of null:

Exception executing consequence for rule SomeRule_39 in
my.company.user.rules: [Error: incompatible types in statement: class
java.lang.String (compared from: class
my.company.userdata.intermediate.numbers.TotalScore)]
[Near : {... this != null }]
 ^
[Line: 1, Column: 1]
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1297)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at
my.company.commons.rules.util.KnowledgeBaseStatelessRuleEngine.execute(KnowledgeBaseStatelessRuleEngine.java:49)

Caused by: [Error: incompatible types in statement: class java.lang.String
(compared from: class my.company.userdata.intermediate.numbers.TotalScore)]
[Near : {... this != null }]
 ^
[Line: 1, Column: 1]
at org.mvel2.ast.BinaryOperation.init(BinaryOperation.java:84)
at org.mvel2.util.CompilerTools.finalizePayload(CompilerTools.java:118)
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:287)
at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
at org.mvel2.MVEL.compileExpression(MVEL.java:810)
at
org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:435)
at
org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:238)
at
org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:206)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:190)
at

Re: [rules-users] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread Wolfgang Laun
It's clear from the log that the first activation (ONE) is cancelled
by some action in rule TEST, since the cancellation is bracketed
between Before- and AfterActivationFired of the activation for TWO.

I dislike the artificial creation of mysteries - as if we hadn't enough without.

-W

On 08/02/2013, Esteban Aliverti esteban.alive...@gmail.com wrote:
 Jeremy is right. In the log you can see 2 activations (one for each fact
 you insert), then the execution of one of the activations and then
 the cancellation of the other. How many rules do you have in your kbase? Is
 your rule as simple as the one you posted? Do you have more than just 1
 condition in your LHS? Are you doing anything else other than the
 system.out in your RHS?

 Best Regards,


 

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


 On Fri, Feb 8, 2013 at 4:17 PM, Jeremy Ary jeremy@gmail.com wrote:

 ==[ActivationCancelledEvent: getCause()=CLEAR,
 getActivation()=[Activation
 rule=TEST, act#=0, salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:
 ONE]

 There's definitely something cancelling the activation, but it's not
 apparent to me right-out what's causing it based on the information
 provided so far. To Estaban's comment, would it be possible to share an
 isolated example as I can't help but to think there's something missing
 from what we've seen so far that would cause this to occur.


 On Fri, Feb 8, 2013 at 9:14 AM, Jeremy Ary jeremy@gmail.com wrote:

 Actually, incorrect, I misread the output, sorry.


 On Fri, Feb 8, 2013 at 9:12 AM, Jeremy Ary jeremy@gmail.com wrote:

 It appears you have a rule named CLEAR not included in the original
 post
 that's cancelling the activation that should println ONE, can you share
 this rule with us?


 On Fri, Feb 8, 2013 at 9:10 AM, pdario
 dario.piantan...@gmail.comwrote:

 I'll try to make it; in the meanwhile, do you find this meaningful?

 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST,
 act#=0,
 salience=0, tuple=[fact 0:1:30100654:78406:1:DEFAULT:ONE]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], getObject()=ONE,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ,
 getPropagationContext()=PropagationContextImpl [activeActivations=0,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:1:30100654:78406:1:DEFAULT:ONE], leftTuple=null, originOffset=-1,
 propagationNumber=3, rule=null, type=0]]
 ==[ActivationCreatedEvent: getActivation()=[Activation rule=TEST,
 act#=1,
 salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ObjectInsertedEventImpl: getFactHandle()=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], getObject()=TWO,
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ,
 getPropagationContext()=PropagationContextImpl [activeActivations=1,
 dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
 0:2:30649454:83500:2:DEFAULT:TWO], leftTuple=null, originOffset=-1,
 propagationNumber=4, rule=null, type=0]]
 TWO
 ==[BeforeActivationFiredEvent:  getActivation()=[Activation
 rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[ActivationCancelledEvent: getCause()=CLEAR,
 getActivation()=[Activation
 rule=TEST, act#=0, salience=0, tuple=[fact
 0:1:30100654:78406:1:DEFAULT:ONE]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 ==[AfterActivationFiredEvent: getActivation()=[Activation rule=TEST,
 act#=1, salience=0, tuple=[fact 0:2:30649454:83500:2:DEFAULT:TWO]
 ],
 getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@4703c
 ]
 Direct Line, l'assicurazione online con il famoso Telefono Rosso e il
 Mouse
 sulle Ruote. Nel 1985 Direct Line ha rivoluzionato il mercato nel
 Regno
 Unito lanciando per prima la vendita diretta di polizze auto. In
 Italia
 ha
 vinto nel 2008 il primo premio per i clienti piu' soddisfatti.
 www.directline.it RESTRICTED: This e-mail (including any linked or
 attached
 documents) is intended for the addressee/s only and may contain
 confidential, proprietary or legally privileged information. Please do
 not
 distribute further without prior permission from the author




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022162.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
 

Re: [rules-users] Evaluate rules for multiple facts of the same type within a StateuflSession

2013-02-08 Thread Grant Rettke
On Fri, Feb 8, 2013 at 12:47 PM, Wolfgang Laun wolfgang.l...@gmail.comwrote:

 I dislike the artificial creation of mysteries - as if we hadn't enough
 without.


Who says it was artificially created?!
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] To group some objects by type

2013-02-08 Thread mdzaebel
see expert documentation for *accumulate*



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-group-some-objects-by-type-tp4022085p4022173.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] Ruleflow not working with stateless session in drools-server 5.5.0.Final

2013-02-08 Thread Yuri
Hi Tim,
I know that you posted these through nabble, and it's not necessarily
propagating your message to the community.  I have gotten a good response
by registering for the mailing list and sending messages directly to Rules
Users List rules-users@lists.jboss.org.
I am replying to your message through the rules-users mailing list - this
way everyone on the list will definitely see your post.


On Fri, Feb 8, 2013 at 9:08 AM, tslonaker tslonaker+dro...@gmail.comwrote:

 I am new to Drools and I am struggling with this ruleflow issue.  Please
 let
 me know if I have been posting this info to the wrong message board.

 My situation is that I am working on converting our application from using
 an expensive commercial rule engine to Drools.  Our rule engine
 implementation uses a stateless server and it heavily depends on ruleflows.
 We could develop the rules using salience but that isn't ideal.

 It seems to me that there is still a bug in drools-server when using
 ruleflows in a stateless session.  It seems that the fix for  issue 2718
 https://issues.jboss.org/browse/JBRULES-2718   partially fixed the
 problem.  There is an easy workaround if you are coding your solution in
 Java.  You just create a new instance of the Stateless session every time.
 But in drools-server I don’t have any control over that.


 tslonaker wrote
  I found a much easier way to recreate the problem described in my
 previous
  post.  I believe I have also found the root cause of the problem.  Below
  are the steps to recreate the issue:
 
  - Create a simple ruleflow and rules and compile them into a rule
 package.
  - In code create a stateless session
  - In a loop
  o Create a fact
  o Create a new execution batch with the following commands
  - Insert the fact from above
  - Start Process
  - Fire All Rules
  - Get Objects
  o Execute the batch
  o Check the results (number of rules that ran)
 
  I posted before that the problem didn’t happen while executing locally
  (not in drools server).  I didn’t realize this before, but adding a loop
  that executes the rules multiple times with the same session recreates
 the
  problem.
 
  Below is code that will recreate the issue.  Notice that the code below
  creates one instance of ksession and reuses it in the loop.
 
//Setup
KnowledgeBuilder kbuilder =
  KnowledgeBuilderFactory.newKnowledgeBuilder();
 
//The package includes the ruleflow
kbuilder.add( ResourceFactory.newFileResource(
  (YourRulePackage_WithRuleflow.pkg) ), ResourceType.PKG );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
 *
//Create the stateless knowledge session outside the for loop
StatelessKnowledgeSession ksession =
  kbase.newStatelessKnowledgeSession();
 *
 
//Loop through executing the rules with the same data 3 times
for (int x = 0; x  3; x++)
{
//Create a new instance of the input fact
FactType inputDataType =
 kbase.getFactType(SimpleRuleflowTest,
  Input);
Object inputData = inputDataType.newInstance();
inputDataType.set(inputData, Name, Test data);
 
//Create a new instance of the command list
List cmds = new ArrayList();
cmds.add( CommandFactory.newInsert( inputData ));
cmds.add( CommandFactory.newStartProcess( TestRuleflow));
cmds.add( CommandFactory.newFireAllRules(rules));
cmds.add( CommandFactory.newGetObjects(output));
 
//Execute the rules
ExecutionResults results = ksession.execute(
  CommandFactory.newBatchExecution( cmds ) );
 
//Get the number of rules that ran
Object rules = results.getValue(rules);
System.out.println(Rules that ran:   + rules.toString());
}
 
 
 
  Each iteration through the loop should fire 3 rules.  Running the code
  above you should get the following output:
 
 Rules that ran:  3
 Rules that ran:  1
 Rules that ran:  1
 
 
  I spent several hours researching the drools source code and I believe I
  have found the problem.  What I have found is related to
  Issue 2718 https://issues.jboss.org/browse/JBRULES-2718
  .
  Check out the change made for this issue:
  2718 fix
  
 https://source.jboss.org/viewrep/Drools/drools-core/src/main/java/org/drools/impl/StatelessKnowledgeSessionImpl.java?r1=63021da325036ec6fbdf4019e8c8293db21555ecr2=fad9b951f44ac813e5faf50f097335c2a97007ae
 
  .
 
  Below is a snippet from the code that was modified for issue 2718.  The
  “if (!initialized)” block was added.  The code loops through event
  listeners on the wm object and adds them to the stateless session’s
  listeners.  This works fine for the first rule execution.  But the next
  rule execution 

Re: [rules-users] Found solution vs actual optimum [planner]

2013-02-08 Thread john poole
I ran the benchmarker and it's showing that I should be using simulated
annealing. So that's useful info.

I'm only getting 525-650 for the average calculate count per second though.
(I didn't realize I could get it without the benchmarker until reading the
docs again)

I'm going through Score calculation performance tricks now, but I didn't
see anything about the hardware used for the expected 1000 value. If my
older laptop is sort of crappy( a Pentium(R)2.2GHz), that would explain the
difference, correct?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Found-solution-vs-actual-optimum-tp4022027p4022175.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] Guvnor-5.5

2013-02-08 Thread Michael Anstis
Hi Stephen,

Guvnor 6.0 uses GWT2.5, Errai 2.2, UberFire and Seam (3, I think, but
similarly to 5.5 for server-side CDI).

Errai needs the most care but they provide settings for a lot of the common
(open source) web-servers (not WebSphere).

We have assemblies for Jboss AS 7 and Tomcat 7... one might provide a good
starting point.

As with 5.5 most issues relate to the correct exclusion of libraries
bundled with the container.

Anything you might be able to do will be warmly appreciated.

Oh, and have a nice vacation ;)

sent on the move

On 8 Feb 2013 12:15, Stephen Masters stephen.mast...@me.com wrote:

 Sounds like a plan. I'll get stuck into it and write up the experiences. I
 suspect that anybody who's conservative enough to be locked into WAS is
 probably not going to be too keen to hit up 6.0 for a little while. So I'll
 have a go at 5.5 for now, as at least I know the Tomcat build is pretty
 stable and should be a decent starting point. If I have time I'll apply the
 same steps to 6.0 and see where they diverge (if at all).

 Any big differences between 5.5 and 6.0 that you can think of off-hand,
 which are likely to cause them to need different steps? I haven't had a
 look at the tech stack under 6.0 yet.

 Now I'm going to have to brush off my WAS skills. My JEE bloatware app
 server experience is mostly with WebLogic. :)


 On 7 Feb 2013, at 22:22, Michael Anstis michael.ans...@gmail.com wrote:

 Hi Stephen,

 We're asked how to run Guvnor on WebSphere quite often... if you fancy
 taking a look we can blog your achievements and you can take your place in
 history ;)

 Targeting 6.0 would add to the coolness - but might have less interest
 from others in the community.

 Cheers,

 Mike

 sent on the move

 On 7 Feb 2013 18:28, Stephen Masters stephen.mast...@me.com wrote:

 I guess that most folks who are tied into the WebSphere stack probably
 just go with JRules rather than Drools. Although FICO is also thoroughly
 usable in that stack.

 I'd probably recommend using Drools Expert within your application on
 WAS, and stick with running Guvnor on Tomcat, as it does't need to be part
 of a 'production' installation.

 However … is there much interest in getting Guvnor up and running on
 alternative app servers such as WAS/WebLogic/Glassfish?

 I intend to be unemployed for the next few weeks, and I was thinking of
 finding myself a little OS project to work on. :)

 Steve


 On 7 Feb 2013, at 15:23, Michael Anstis michael.ans...@gmail.com wrote:

 Drools Expert is just a Java library and should work on WebSphere as well
 as any other (to the best of my knowledge, but always happy to learn
 something new!)

 Guvnor is really the issue as we do not have an off the shelf
 distribution targeting WAS (not that we wouldn't want to, but nobody in the
 community has been prepared to work out what is required).

 IDK if RedHat Consulting would be able to advise on setting up Guvnor on
 WAS... but I'll forward this email to others who might know better.

 RedHat's certified BRMS does not contain the most recent features.

 With kind regards,

 Mike

 On 7 February 2013 15:03, Ricardo sprabak...@gmail.com wrote:

 ok,
 I understand your goal, what is your advise for the companies already
 using
 WAS server and wants to try drools expert and guvnor for rules engine
 POC .
 need to get certified version for POC too? is the certified version got
 all
 the latest futures?



 -
 with kind regards,

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Guvnor-5-5-tp4022096p4022121.html
 Sent from the Drools: User forum mailing list archive at 
 Nabble.comhttp://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


 ___
 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

[rules-users] How can I serialize a stateful KB in Drools Server ?

2013-02-08 Thread billg
Can't find any entry point to serialize a stateful KB in Drools Server. 
I need to create periodic checkpoints of my stateful KB in case of a crash,
or when I intentionally shutdown.  Then I need to be able to reload it when
bringing Drools Server back up.
I can't find where any APIs for this are exposed.

I do see how to do this running standalone Drools, it sesms like I should be
able to access the same   APIs?

thanks



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-I-serialize-a-stateful-KB-in-Drools-Server-tp4022177.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