[rules-users] Fusion: Insert passed events

2012-03-14 Thread javadude
Hi !
scenario: Event A then Event B. If there is no Event B after 5 min of A then
trigger rule.

*when
 time1:(Event) from entry-point xxx
 not (Event(this after[ 0,5m ] time1)) from entry-point xxx
then 
 ...
end*

For realtime event that works fine, but in real life you have the event
coming in delayed, eg. from an interface.

Example:
Event A time: 01:00 (mm:ss) but received at 02:00
Above rule will trigger at 07:00, but the business logic would require it to
be triggered at 06:00

How do I handle this kind of requirement ? 

Thanks
Sven

--
View this message in context: 
http://drools.46999.n3.nabble.com/Fusion-Insert-passed-events-tp3824630p3824630.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] Rule Compilation error when using custom classloader

2012-03-14 Thread M. Kramer
Hello everybody,

I would appreciate some help with the compilation of a rule that involves
dynamically generated POJOs (minimal example at the end of the mail).
When I add the packages of the generated POJOs manually to the imported
packages of my Eclipse plug-in that executes the knowledge session
everything works fine.
When I use my custom classloader (that successfully loads all involved
classes, I checked this thoroughly) I get the following errors:

Unable to generate rule invoker. lts cannot be resolved to a type
Rule Compilation error lts cannot be resolved to a type

Do I need to change my rules just because the involved classes are now
loaded using my custom classloader?

Thanks for your help!

M. Kramer



This is the rule that only works if the package lts is listed under
Import-Package in the MANIFEST.MF:

import java.lang.String;
import java.util.ArrayList;
import java.util.HashMap;
import org.eclipse.emf.ecore.EObject;

global java.lang.String output;
global java.util.List list;
global java.util.List pclist;

rule Aspect
when

$s0Decl: lts.State(name == a)

$s0: lts.State(this == $s0Decl)

then
java.util.List param = new ArrayListHashMaplt;String,EObject();
java.util.List ids = new ArrayListString();

param.add($s0);
ids.add(0);

list.add(param);
pclist.add(ids);
end



This is the code that I am using to execute the rule:

void executeKnowledgeSession(String droolsRules, URLClassLoader
urlClassLoader, IterableEObject iterable) {
KnowledgeBuilderConfiguration kBuilderConfiguration =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,
urlClassLoader);
KnowledgeBuilder knowledgeBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(kBuilderConfiguration);
Resource droolsRulesResource =
ResourceFactory.newByteArrayResource(droolsRules.getBytes());
knowledgeBuilder.add(droolsRulesResource, ResourceType.DRL);
if (knowledgeBuilder.hasErrors()) {
...
}
KnowledgeBaseConfiguration kBaseConfiguration =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, urlClassLoader);
KnowledgeBase knowledgeBase =
KnowledgeBaseFactory.newKnowledgeBase(kBaseConfiguration);
knowledgeBase.getKnowledgePackages().clear();
   
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());
StatelessKnowledgeSession knowledgeSession =
knowledgeBase.newStatelessKnowledgeSession();
knowledgeSession.setGlobal(...);
// execute the knowledge session
knowledgeSession.execute(iterable);
}


These are the exact errors that I get:

Unable to generate rule invoker. lts cannot be resolved to a type
lts cannot be resolved to a type
Rule Compilation error lts cannot be resolved to a type
Unable to generate rule invoker. : [Rule name='Aspect']
defaultpkg/Rule_Aspect_0DefaultConsequenceInvoker.java (22:883) : lts
cannot be resolved to a type
defaultpkg/Rule_Aspect_0DefaultConsequenceInvoker.java (22:901) : lts
cannot be resolved to a type
Rule Compilation error : [Rule name='Aspect']
defaultpkg/Rule_Aspect_0.java (6:322) : lts cannot be resolved to a type

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Compilation-error-when-using-custom-classloader-tp3824716p3824716.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] Fusion: Insert passed events

2012-03-14 Thread Wolfgang Laun
Use the true time of the event for the event's @imestamp attribute
and do not rely on the automatic timestamp added by the engine.

Of course, if some event is delayed on the wire, rules checking the
absence of an event will still fire incorrectly.

-W


On 14/03/2012, javadude s...@bighugesystems.com wrote:
 Hi !
 scenario: Event A then Event B. If there is no Event B after 5 min of A then
 trigger rule.

 *when
  time1:(Event) from entry-point xxx
  not (Event(this after[ 0,5m ] time1)) from entry-point xxx
 then
  ...
 end*

 For realtime event that works fine, but in real life you have the event
 coming in delayed, eg. from an interface.

 Example:
 Event A time: 01:00 (mm:ss) but received at 02:00
 Above rule will trigger at 07:00, but the business logic would require it to
 be triggered at 06:00

 How do I handle this kind of requirement ?

 Thanks
 Sven

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-Insert-passed-events-tp3824630p3824630.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] Problem with temporal operations spanning daylight to standard time

2012-03-14 Thread Wolfgang Laun
Designations like 2012-03-10 13:30:00.000 are just labels we attach
according to several conventions to the points in time (PiT) which are
a continuously numbered sequence of ticks (of a certain length),
starting at an arbitrary point in time. If you select two PiTs this
way and then calculate the number of ticks between them, you must make
sure that the PiTs have been selected by a suitable convention, i.e.,
one that isn't ambiguous and doesn't have gaps.

Such conventions are called Time Zones, and many of these don't pass
the aforementioned requirements. The new Date you create on your
system follows the convention adopted for your host's time and date,
and your cunning sysadmin has chosen a setting to conform to
Californian usage.

You have several options.

You can use the (deprectated) API of java.util.Date to create PiTs
using a clean mapping, e.g., the one provided by UTC.

   Date utc = new Date( Date.UTC( 2012-1900, 3-1, 24, 0, 0, 0 ) );

Alternatively and avoiding deprecated methods and with a cleaner
interface, declare

private static Calendar calUTC =
   new GregorianCalendar( TimeZone.getTimeZone(UTC) );
public static Date utcDate(int year, int month, int day ){
calUTC.set( year-1900, month-1, day );
return calUTC.getTime();
}

and call it like this:

 Date utc = utcDate( 2012, 3, 24 );

Cheers
Wolfgang



On 13/03/2012, lhorton lhor...@abclegal.com wrote:
 Most of the USA went from Standard Time to Daylight Time this past weekend.
 We use some of the temporal operations in our rules, mainly to do
 calculations of date differences by whole days, and some of the calculations
 are wrong.  The ones in error involve comparing dates where one is standard
 time and one is daylight savings time.  I wrote a small test case to prove
 this.

 I have a simple Person class:
 public class Person  {

   private Date birthdate;
   private int status;

   public Date getBirthdate() {
   return birthdate;
   }

   public void setBirthdate(Date birthdate) {
   this.birthdate = birthdate;
   }

   public int getStatus() {
   return status;
   }

   public void setStatus(int status) {
   this.status = status;
   }
 }

 and a simple drl file:

 package com.drools.resources;

 import com.drools.person.Person;
 import java.util.Date;
 import java.util.Calendar;

 global Long now

 rule Birthday Rule
 dialect mvel
 when
   $person : Person(birthdate != null)
   Date($bDate : time before[3d] now) from $person.birthdate
 then
   $person.setStatus(3);
 end

 rule Debug Birthday Rule
 dialect mvel
 when
   $person : Person(birthdate != null)
 then
   System.out.println(now is  + new Date(now));
   System.out.println(birthdate is  + $person.getBirthdate());
 end

 and two tests:
   @Test
   public void testTemporalJanuary() throws Exception {
   KnowledgeBase base =
 createKnowledgeBaseFromRulesFile(src/com/drools/resources/temporal.drl);
   StatelessKnowledgeSession kSession =
 createStatelessKnowledgeSession(base);

   // test january - both dates are standard time
   Date now = new Date(2012-1900, 00, 13);
   kSession.getGlobals().set(now, now.getTime());
   Person p = new Person();
   p.setStatus(0);
   p.setBirthdate(new Date(2012-1900, 00, 10));
   kSession.execute(p);
   assertTrue(p.getStatus() == 3);

   }

   @Test
   public void testTemporalMarch() throws Exception {
   KnowledgeBase base =
 createKnowledgeBaseFromRulesFile(src/com/drools/resources/temporal.drl);
   StatelessKnowledgeSession kSession =
 createStatelessKnowledgeSession(base);

   // test March: one day standard, the other is daylight
   Date now = new Date(2012-1900, 02, 13);
   kSession.getGlobals().set(now, now.getTime());
   Person p = new Person();
   p.setStatus(0);
   p.setBirthdate(new Date(2012-1900, 02, 10));
   kSession.execute(p);
   assertTrue(p.getStatus() == 3);


   }


 the first test (testTemporalJanuary) compares January 13 to January 10, and
 it passes (matches the before[3d] condition).

 the second test (testTemporalMarch, which is the same except for using March
 instead of January) fails.

 The output of the debug rule for these tests is:

now is Fri Jan 13 00:00:00 PST 2012
birthdate is Tue Jan 10 00:00:00 PST 2012

now is Tue Mar 13 00:00:00 PDT 2012
birthdate is Sat Mar 10 00:00:00 PST 2012




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Problem-with-temporal-operations-spanning-daylight-to-standard-time-tp3823618p3823618.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list

Re: [rules-users] drools arithmetics without eval()

2012-03-14 Thread fx242
Hi,

These rules are all auto-generated every day, and I don't control what is
going into them, so this kind of optimizations won't work for me. The basic
problem here, is that I have tons of rules that count facts
(PortfolioProducts) and use the result as rule conditions.
Some conditions could look like this: count(PortfolioProduct(A)) +
count(PortfolioProduct(B)) = ( count(PortfolioProduct(C)) -
count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
and so on...

All rules look like the rule I've posted: I first calculate all relevant
fact counts to be used by the rule (accumulates), and then perform the
logic/arithmetic evaluation using evals(). Some rules end up having 15
accumulates and 2 evals as conditions...
My question is if using accumulate and eval() is the only choice I have to
write these kind of rules.

Regards,
Tiago Lopes

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp3823232p3824958.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 arithmetics without eval()

2012-03-14 Thread Vincent LEGENDRE
And what if you perform the count in some java methods (a session listener on 
inserted objects which updates a big map?) and then only use resulting counters 
in rules ?

If you have to use rules to compute the counters (for instance because it is 
not always as simple, or if you want to keep the ability to add arbitrary 
businness logic), you nay consider using objects for counters, and then have :
 - a first set of rules updating counters (using accumulate or not). The 
idea there is to share common accumulates instead of repeating them in many 
many rules. You can also use queries instead of accumulates.
 - a second set of rules checking counters to take a decision.



- Mail original -
De: fx242 dro...@fx242.com
À: rules-users@lists.jboss.org
Envoyé: Mercredi 14 Mars 2012 11:49:19
Objet: Re: [rules-users] drools arithmetics without eval()

Hi,

These rules are all auto-generated every day, and I don't control what is
going into them, so this kind of optimizations won't work for me. The basic
problem here, is that I have tons of rules that count facts
(PortfolioProducts) and use the result as rule conditions.
Some conditions could look like this: count(PortfolioProduct(A)) +
count(PortfolioProduct(B)) = ( count(PortfolioProduct(C)) -
count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
and so on...

All rules look like the rule I've posted: I first calculate all relevant
fact counts to be used by the rule (accumulates), and then perform the
logic/arithmetic evaluation using evals(). Some rules end up having 15
accumulates and 2 evals as conditions...
My question is if using accumulate and eval() is the only choice I have to
write these kind of rules.

Regards,
Tiago Lopes

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp3823232p3824958.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 arithmetics without eval()

2012-03-14 Thread Wolfgang Laun
accumulate is not the way to go.

If you need accumlated counts for certain facts, by type or, within
some type, by attribute value, then you should set up secondary facts
and maintain these during the element insertion process or by separate
(static) rules.

class ProductCounter {
String id;
int  count; }

rule count
when
$pp: PortfolioProduct($pid: productId, prodCounted == false )
$pc: ProductCounter( id == $pid )
then
modify( $pc ){ setCount( $pc.getCount() + 1 ) }
end

And now you can generate the rules accessing the completed counts.
-W





On 14/03/2012, fx242 dro...@fx242.com wrote:
 Hi,

 These rules are all auto-generated every day, and I don't control what is
 going into them, so this kind of optimizations won't work for me. The basic
 problem here, is that I have tons of rules that count facts
 (PortfolioProducts) and use the result as rule conditions.
 Some conditions could look like this: count(PortfolioProduct(A)) +
 count(PortfolioProduct(B)) = ( count(PortfolioProduct(C)) -
 count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
 and so on...

 All rules look like the rule I've posted: I first calculate all relevant
 fact counts to be used by the rule (accumulates), and then perform the
 logic/arithmetic evaluation using evals(). Some rules end up having 15
 accumulates and 2 evals as conditions...
 My question is if using accumulate and eval() is the only choice I have to
 write these kind of rules.

 Regards,
 Tiago Lopes

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp3823232p3824958.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 arithmetics without eval()

2012-03-14 Thread rouvas
Wolfgang Laun wrote:
 accumulate is not the way to go.

 If you need accumlated counts for certain facts, by type or, within
 some type, by attribute value, then you should set up secondary facts
 and maintain these during the element insertion process or by separate
 (static) rules.

 class ProductCounter {
 String id;
 int  count; }

 rule count
 when
 $pp: PortfolioProduct($pid: productId, prodCounted == false )
 $pc: ProductCounter( id == $pid )
 then
 modify( $pc ){ setCount( $pc.getCount() + 1 ) }
 end

Shouldn't then be

 then
 modify( $pc ){ setCount( $pc.getCount() + 1 ) }
 modify ($pp ){ setProdCounted( true ) }
 end

I'm only asking to validate my understanding of the situation.

-Stathis


 And now you can generate the rules accessing the completed counts.
 -W





 On 14/03/2012, fx242 dro...@fx242.com wrote:
 Hi,

 These rules are all auto-generated every day, and I don't control what
 is
 going into them, so this kind of optimizations won't work for me. The
 basic
 problem here, is that I have tons of rules that count facts
 (PortfolioProducts) and use the result as rule conditions.
 Some conditions could look like this: count(PortfolioProduct(A)) +
 count(PortfolioProduct(B)) = ( count(PortfolioProduct(C)) -
 count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
 and so on...

 All rules look like the rule I've posted: I first calculate all relevant
 fact counts to be used by the rule (accumulates), and then perform the
 logic/arithmetic evaluation using evals(). Some rules end up having 15
 accumulates and 2 evals as conditions...
 My question is if using accumulate and eval() is the only choice I have
 to
 write these kind of rules.

 Regards,
 Tiago Lopes

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp3823232p3824958.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] drools arithmetics without eval()

2012-03-14 Thread Wolfgang Laun
Oh yes, indeed.
-W

On 14/03/2012, rou...@mm.di.uoa.gr rou...@mm.di.uoa.gr wrote:
 Wolfgang Laun wrote:
 accumulate is not the way to go.

 If you need accumlated counts for certain facts, by type or, within
 some type, by attribute value, then you should set up secondary facts
 and maintain these during the element insertion process or by separate
 (static) rules.

 class ProductCounter {
 String id;
 int  count; }

 rule count
 when
 $pp: PortfolioProduct($pid: productId, prodCounted == false )
 $pc: ProductCounter( id == $pid )
 then
 modify( $pc ){ setCount( $pc.getCount() + 1 ) }
 end

 Shouldn't then be

  then
  modify( $pc ){ setCount( $pc.getCount() + 1 ) }
  modify ($pp ){ setProdCounted( true ) }
  end

 I'm only asking to validate my understanding of the situation.

 -Stathis


 And now you can generate the rules accessing the completed counts.
 -W





 On 14/03/2012, fx242 dro...@fx242.com wrote:
 Hi,

 These rules are all auto-generated every day, and I don't control what
 is
 going into them, so this kind of optimizations won't work for me. The
 basic
 problem here, is that I have tons of rules that count facts
 (PortfolioProducts) and use the result as rule conditions.
 Some conditions could look like this: count(PortfolioProduct(A)) +
 count(PortfolioProduct(B)) = ( count(PortfolioProduct(C)) -
 count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
 and so on...

 All rules look like the rule I've posted: I first calculate all relevant
 fact counts to be used by the rule (accumulates), and then perform the
 logic/arithmetic evaluation using evals(). Some rules end up having 15
 accumulates and 2 evals as conditions...
 My question is if using accumulate and eval() is the only choice I have
 to
 write these kind of rules.

 Regards,
 Tiago Lopes

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp3823232p3824958.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


Re: [rules-users] drools arithmetics without eval()

2012-03-14 Thread Vincent LEGENDRE
Yes, it should

But this kind of rule implies that a PortfolioProduct has a unique contribution 
in a unique counter (when prodCounted becomes true, the PortfolioProduct won't 
be counted anymore).

And I am not sure whether this kind of rule is more efficient than an 
accumulate or a query (it implies a lot of updates, and to me this is 
equivalent to an accumulate).

My way of doing such things is to count in a counter object (like the 
ProductCounter here), but don't call modify (or update) to avoid loop and to 
avoid adding some too technical stuff in rules.
Once all counting rules fired, I exec another rule (in a separate 
ruleflow-group or agenda-group) that updates the counters.
Then I give the focus to decision rules ...


- Mail original -
De: rou...@mm.di.uoa.gr
À: rules-users@lists.jboss.org
Envoyé: Mercredi 14 Mars 2012 13:25:51
Objet: Re: [rules-users] drools arithmetics without eval()

Wolfgang Laun wrote:
 accumulate is not the way to go.

 If you need accumlated counts for certain facts, by type or, within
 some type, by attribute value, then you should set up secondary facts
 and maintain these during the element insertion process or by separate
 (static) rules.

 class ProductCounter {
 String id;
 int  count; }

 rule count
 when
 $pp: PortfolioProduct($pid: productId, prodCounted == false )
 $pc: ProductCounter( id == $pid )
 then
 modify( $pc ){ setCount( $pc.getCount() + 1 ) }
 end

Shouldn't then be

 then
 modify( $pc ){ setCount( $pc.getCount() + 1 ) }
 modify ($pp ){ setProdCounted( true ) }
 end

I'm only asking to validate my understanding of the situation.

-Stathis


 And now you can generate the rules accessing the completed counts.
 -W





 On 14/03/2012, fx242 dro...@fx242.com wrote:
 Hi,

 These rules are all auto-generated every day, and I don't control what
 is
 going into them, so this kind of optimizations won't work for me. The
 basic
 problem here, is that I have tons of rules that count facts
 (PortfolioProducts) and use the result as rule conditions.
 Some conditions could look like this: count(PortfolioProduct(A)) +
 count(PortfolioProduct(B)) = ( count(PortfolioProduct(C)) -
 count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
 and so on...

 All rules look like the rule I've posted: I first calculate all relevant
 fact counts to be used by the rule (accumulates), and then perform the
 logic/arithmetic evaluation using evals(). Some rules end up having 15
 accumulates and 2 evals as conditions...
 My question is if using accumulate and eval() is the only choice I have
 to
 write these kind of rules.

 Regards,
 Tiago Lopes

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp3823232p3824958.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


Re: [rules-users] Persistence in fireUntilHalt() loop

2012-03-14 Thread Marco Rietveld

  
  

Hi Alberto, 

This is a bug that has been fixed in jBPM. It had to do with lazy
initialization of a JPAProcessInstanceManager
field. 

We'll be releasing a new jBPM version sometime soon (synchronous
with Drools, I think). The bug is fixed in there. 

Regards,
Marco

03/08/2012 11:32 AM, Alberto R. Galdo:

Hi,


 We're running an application that uses Drools + JBPM 5 +
  Drools integration our set-up can be seen as:

  

 Some rule fires and creates a JBPM process ( a fact gets
  inserted into drools using
  "kcontext.getKnowledgeRuntime().startProcess("testProcess")"
  ). We have a problem with the persistence of this processes.
  Persistence is implemented with JPA and JTA. Our application
  runs with fireUntilHalt() and when a process is launched from
  the consequence of any of the rules the persistence of the
  process fails. If the application runs with fireAllRules(),
  the persistence works like a charm.

 The error shown is as follow:

 Exception in thread "Thread-5" Exception executing
  consequence for rule "Run Process" in com.sample:
  java.lang.NullPointerException
 at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
 at
  org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
  org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
 at
  org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:754)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:730)
 at
org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
 at
  java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
 at
org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:44)
 at
org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)
 at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182)
 at
org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154)
 at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135)
 at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)
 at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1074)
 at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301)
 at
  com.sample.Rule_Run_Process.defaultConsequence(Rule_Run_Process.java:9)
 at
  com.sample.Rule_Run_ProcessDefaultConsequenceInvoker.evaluate(Unknown
  Source)
 at
  org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
 ... 6 more
 
 The problem is
  in this function:
 
 public void
  addProcessInstance(ProcessInstance processInstance) {
ProcessInstanceInfo processInstanceInfo = new
  ProcessInstanceInfo( processInstance,
  this.kruntime.getEnvironment() );
ProcessPersistenceContext context
  = ((ProcessPersistenceContextManager)
  this.kruntime.getEnvironment()
  .get(
  EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))
  .getProcessPersistenceContext();
// @PrePersist added to ProcessInstanceInfo because
  of this
context.persist( processInstanceInfo );
((org.jbpm.process.instance.ProcessInstance)
  processInstance).setId( processInstanceInfo.getId() );
processInstanceInfo.updateLastReadDate();
internalAddProcessInstance(processInstance);
  }
 
 We think after
  that persist sentence, the entity manager would have to run a
  flush sentence for the process instance is inserted into
  database and get the ID.
 
 Greets.
  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




-- 
jBPM/Drools developer
Utrecht, the Netherlands
  

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


Re: [rules-users] Persistence in fireUntilHalt() loop

2012-03-14 Thread Alberto R. Galdo
Great news!

We were in the process of debugging JBPM trying to find the source of the
bug ... and maybe days away from the solution ...

Is there any bug report in Jira and/or a patch we can apply without having
to wait for the next release so we can quick-patch our systems?


Alberto R. Galdo
arga...@gmail.com


On Wed, Mar 14, 2012 at 13:09, Marco Rietveld mriet...@redhat.com wrote:


 Hi Alberto,

 This is a bug that has been fixed in jBPM. It had to do with lazy
 initialization of a JPAProcessInstanceManager field.

 We'll be releasing a new jBPM version sometime soon (synchronous with
 Drools, I think). The bug is fixed in there.

 Regards,
 Marco

 03/08/2012 11:32 AM, Alberto R. Galdo:

 Hi,

We're running an application that uses Drools + JBPM 5 + Drools
 integration our set-up can be seen as:

Some rule fires and creates a JBPM process ( a fact gets inserted into
 drools using kcontext.getKnowledgeRuntime().startProcess(testProcess)
 ). We have a problem with the persistence of this processes. Persistence is
 implemented with JPA and JTA. Our application runs with fireUntilHalt() and
 when a process is launched from the consequence of any of the rules the
 persistence of the process fails. If the application runs with
 fireAllRules(), the persistence works like a charm.

   The error shown is as follow:

   Exception in thread Thread-5 Exception executing consequence for rule
 Run Process in com.sample: java.lang.NullPointerException
  at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
  at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)
  at
 org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:754)
  at
 org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:730)
  at
 org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
  at java.lang.Thread.run(Thread.java:662)
 Caused by: java.lang.NullPointerException
  at
 org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:44)
  at
 org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)
  at
 org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182)
  at
 org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154)
  at
 org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135)
  at
 org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)
  at
 org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1074)
  at
 org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301)
  at
 com.sample.Rule_Run_Process.defaultConsequence(Rule_Run_Process.java:9)
  at com.sample.Rule_Run_ProcessDefaultConsequenceInvoker.evaluate(Unknown
 Source)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
  ... 6 more
   The problem is in this function:
   public void addProcessInstance(ProcessInstance processInstance) {
 ProcessInstanceInfo processInstanceInfo = new ProcessInstanceInfo(
 processInstance, this.kruntime.getEnvironment() );
 ProcessPersistenceContext context
 = ((ProcessPersistenceContextManager)
 this.kruntime.getEnvironment()
 .get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))
 .getProcessPersistenceContext();
 // @PrePersist added to ProcessInstanceInfo because of this
 context.persist( processInstanceInfo );
 ((org.jbpm.process.instance.ProcessInstance)
 processInstance).setId( processInstanceInfo.getId() );
 processInstanceInfo.updateLastReadDate();
 internalAddProcessInstance(processInstance);
 }
   We think after that persist sentence, the entity manager would have to
 run a flush sentence for the process instance is inserted into database and
 get the ID.
   Greets.


 ___
 rules-users mailing 
 listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users



 --
 jBPM/Drools developer
 Utrecht, the Netherlands


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


[rules-users] Drools and Jersey

2012-03-14 Thread mike
Hi there,

I am trying to make rest calls from Drools. For that I am using Jersey
http://jersey.java.net/. I cannot no get it to work if I use mvel,
otherwise it works fine.

Here is a sample rule:
--
import com.sun.jersey.api.client.Client;

dialect  mvel

rule create Rest Client
then new Client();
end
--

I would love to be able to use mvel since it curves java syntax :)

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


Re: [rules-users] Drools and Jersey

2012-03-14 Thread Mauricio Salatino
Hi Mike, I've never tried that before (a rule without the when part..) is
good to know that it works :)
Humm that's sounds weird.. why the dialect is affecting your Client
creation.
It could be that there is something wrong with the expression evaluation.
It looks like MVEL cannot compile the new Client(); expression - at
java.lang.String.init(Unknown Source)
Did you try with something like:
then \n
Client c = new Client();

I'm just guessing here, because it looks strange

2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not really
 needed. I get the exception on the call to new Client(). Please keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
  at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



 2012/3/14 Mauricio Salatino sala...@gmail.com

 what are you trying to do?
 what's the error?

 the rule should look like

 rule create Rest Client
 when
 then new Client();
 end

 2012/3/14 mike mike...@gmail.com

  Hi there,

 I am trying to make rest calls from Drools. For that I am using Jersey
 http://jersey.java.net/. I cannot no get it to work if I use mvel,
 otherwise it works fine.

 Here is a sample rule:
 --
 import com.sun.jersey.api.client.Client;

 dialect  mvel

 rule create Rest Client
 then new Client();
 end
 --

 I would love to be able to use mvel since it curves java syntax :)

 Thank you
 Mike

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




 --
  - MyJourney @ http://salaboy.wordpress.com
  - Co-Founder @ http://www.jugargentina.org
  - Co-Founder @ http://www.jbug.com.ar

  

Re: [rules-users] Drools and Jersey

2012-03-14 Thread mike
Hi Mauricio,

I spent like 2 days debugging, before realizing that mvel was the culprit.
The error is a Null Exception when resolving some service inside Jersey. I
have to check my browser history at home for more details but the exception
was happening inside Jersey.

Please notice I reduced the code to the minimum. I had 'real' code doing
more reasonable things with new Client. Client c = new Client() fails too.

Thank you very much
Mike

2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..) is
 good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not really
 needed. I get the exception on the call to new Client(). Please keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
  at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



 2012/3/14 Mauricio Salatino sala...@gmail.com

 what are you trying to do?
 what's the error?

 the rule should look like

 rule create Rest Client
 when
 then new Client();
 end

 2012/3/14 mike mike...@gmail.com

  Hi there,

 I am trying to make rest calls from Drools. For that I am using Jersey
 http://jersey.java.net/. I cannot no get it to work if I use mvel,
 otherwise it works fine.

 Here is a sample rule:
 --
 import com.sun.jersey.api.client.Client;

 dialect  

Re: [rules-users] Drools and Jersey

2012-03-14 Thread Mauricio Salatino
Cool that you find that :)
Cheers

2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the culprit.
 The error is a Null Exception when resolving some service inside Jersey. I
 have to check my browser history at home for more details but the exception
 was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code doing
 more reasonable things with new Client. Client c = new Client() fails too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..) is
 good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not really
 needed. I get the exception on the call to new Client(). Please keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
  at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



 2012/3/14 Mauricio Salatino sala...@gmail.com

 what are you trying to do?
 what's the error?

 the rule should look like

 rule create Rest Client
 when
 then new Client();
 end

 2012/3/14 mike mike...@gmail.com

  Hi there,

 I am trying to make rest calls from Drools. For that I am using Jersey
 http://jersey.java.net/. I cannot no get it to work if I use mvel,
 otherwise it works fine.

 Here is a sample rule:
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread mike
Wait ... I haven't solved the problem ... I mean, as of now I cannot use
mvel if I want to use Jersey ... and I don't think it's Jersey's fault
because it works in any condition except when using mvel. I thought that
the Drools team follows this list and might be interested in that bug.

Thank you very much
Mike

2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code doing
 more reasonable things with new Client. Client c = new Client() fails too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..)
 is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not really
 needed. I get the exception on the call to new Client(). Please keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
  at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



 2012/3/14 Mauricio Salatino sala...@gmail.com

 what are you trying to do?
 what's the error?

Re: [rules-users] Drools and Jersey

2012-03-14 Thread Wolfgang Laun
Do you mean that the NPE deep inside Jersey only happens when you use
dialect mvel?!?

Disaster strikes in MVEL when it tries to report the exception thrown
while the rule executes.

Which Drools version are you using?
-W



On 14/03/2012, mike mike...@gmail.com wrote:
 Wait ... I haven't solved the problem ... I mean, as of now I cannot use
 mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but
 the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code doing
 more reasonable things with new Client. Client c = new Client() fails
 too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..)
 is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not
 really
 needed. I get the exception on the call to new Client(). Please keep
 in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range:
 -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
  at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread Mauricio Salatino
Sure.. we are interested in finding out what is happening. So, you find
that when you are using mvel something inside Jersey fails?
Did you find what exactly is happening inside Jersey? Probably it's
something related with the class loaders, but I never seen an error like
that when you specify the mvel dialect.
By the way, what exactly are you trying to do with mvel? did you try using
the mvel syntax without explicitly specifying the dialect?

Cheers


2012/3/14 mike mike...@gmail.com

 Wait ... I haven't solved the problem ... I mean, as of now I cannot use
 mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code doing
 more reasonable things with new Client. Client c = new Client() fails too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..)
 is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not really
 needed. I get the exception on the call to new Client(). Please keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range:
 -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
  at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread mike
Wolfgang,

I am using

dependency
groupIdorg.drools/groupId
artifactIddrools-core/artifactId
version5.3.1.Final/version
typejar/type
/dependency

Mauricio:

It is something related to loading classes inside Jersey that brakes if I
am using mvel. I use mvel always, because java syntax hurts me.

Drools Team:

I think the easier way would be to try this scenario yourself. This is a
pom for Jersey.

dependency
groupIdcom.sun.jersey/groupId
artifactIdjersey-client/artifactId
version1.12/version
/dependency

Thank you very much
Cheers
Mike

2012/3/14 Mauricio Salatino sala...@gmail.com

 Sure.. we are interested in finding out what is happening. So, you find
 that when you are using mvel something inside Jersey fails?
 Did you find what exactly is happening inside Jersey? Probably it's
 something related with the class loaders, but I never seen an error like
 that when you specify the mvel dialect.
 By the way, what exactly are you trying to do with mvel? did you try using
 the mvel syntax without explicitly specifying the dialect?

 Cheers



 2012/3/14 mike mike...@gmail.com

 Wait ... I haven't solved the problem ... I mean, as of now I cannot use
 mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code
 doing more reasonable things with new Client. Client c = new Client() fails
 too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..)
 is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not really
 needed. I get the exception on the call to new Client(). Please keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range:
 -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
 at
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread Wolfgang Laun
You could help and narrow this down and use this custom exception
handler. It should provide better diagnostics of what happens instead
of running into the weird MVEL index bound error.

http://members.inode.at/w.laun/drools/CustomConsequenceExceptionHandlingHowTo.html

If you need any help with this, I'll be online again from now+1hr
-W

On 14/03/2012, mike mike...@gmail.com wrote:
 Wolfgang,

 I am using

 dependency
 groupIdorg.drools/groupId
 artifactIddrools-core/artifactId
 version5.3.1.Final/version
 typejar/type
 /dependency

 Mauricio:

 It is something related to loading classes inside Jersey that brakes if I
 am using mvel. I use mvel always, because java syntax hurts me.

 Drools Team:

 I think the easier way would be to try this scenario yourself. This is a
 pom for Jersey.

 dependency
 groupIdcom.sun.jersey/groupId
 artifactIdjersey-client/artifactId
 version1.12/version
 /dependency

 Thank you very much
 Cheers
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Sure.. we are interested in finding out what is happening. So, you find
 that when you are using mvel something inside Jersey fails?
 Did you find what exactly is happening inside Jersey? Probably it's
 something related with the class loaders, but I never seen an error like
 that when you specify the mvel dialect.
 By the way, what exactly are you trying to do with mvel? did you try using
 the mvel syntax without explicitly specifying the dialect?

 Cheers



 2012/3/14 mike mike...@gmail.com

 Wait ... I haven't solved the problem ... I mean, as of now I cannot use
 mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service
 inside
 Jersey. I have to check my browser history at home for more details but
 the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code
 doing more reasonable things with new Client. Client c = new Client()
 fails
 too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when part..)
 is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web services
 using jersey. I simplified the rule to the max. The 'when' is not
 really
 needed. I get the exception on the call to new Client(). Please
 keep in
 mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of range:
 -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread mike
Drools Team,

I am doing this for my company so if you have some sort of paid support
channel I think my company would be willing to pay (I'll have to ask to my
managers first).

Cheers
Mike

On Wed, Mar 14, 2012 at 12:45 PM, mike mike...@gmail.com wrote:

 Wolfgang,

 I am using

 dependency
 groupIdorg.drools/groupId
  artifactIddrools-core/artifactId
 version5.3.1.Final/version
  typejar/type
 /dependency

 Mauricio:

 It is something related to loading classes inside Jersey that brakes if I
 am using mvel. I use mvel always, because java syntax hurts me.

 Drools Team:

 I think the easier way would be to try this scenario yourself. This is a
 pom for Jersey.

 dependency
 groupIdcom.sun.jersey/groupId
  artifactIdjersey-client/artifactId
 version1.12/version
  /dependency

 Thank you very much
 Cheers
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Sure.. we are interested in finding out what is happening. So, you find
 that when you are using mvel something inside Jersey fails?
 Did you find what exactly is happening inside Jersey? Probably it's
 something related with the class loaders, but I never seen an error like
 that when you specify the mvel dialect.
 By the way, what exactly are you trying to do with mvel? did you try
 using the mvel syntax without explicitly specifying the dialect?

 Cheers



 2012/3/14 mike mike...@gmail.com

 Wait ... I haven't solved the problem ... I mean, as of now I cannot use
 mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but 
 the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code
 doing more reasonable things with new Client. Client c = new Client() 
 fails
 too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when
 part..) is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web
 services using jersey. I simplified the rule to the max. The 'when' is 
 not
 really needed. I get the exception on the call to new Client(). Please
 keep in mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of
 range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread Mauricio Salatino
If you create an isolated test you can also create a new Jira issue, so
it's easier for every one to reproduce, test and fix the problem.
Cheers

2012/3/14 mike mike...@gmail.com

 Wolfgang,

 I am using

 dependency
  groupIdorg.drools/groupId
  artifactIddrools-core/artifactId
 version5.3.1.Final/version
  typejar/type
 /dependency

 Mauricio:

 It is something related to loading classes inside Jersey that brakes if I
 am using mvel. I use mvel always, because java syntax hurts me.

 Drools Team:

 I think the easier way would be to try this scenario yourself. This is a
 pom for Jersey.

 dependency
 groupIdcom.sun.jersey/groupId
  artifactIdjersey-client/artifactId
 version1.12/version
  /dependency

 Thank you very much
 Cheers
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Sure.. we are interested in finding out what is happening. So, you find
 that when you are using mvel something inside Jersey fails?
 Did you find what exactly is happening inside Jersey? Probably it's
 something related with the class loaders, but I never seen an error like
 that when you specify the mvel dialect.
 By the way, what exactly are you trying to do with mvel? did you try
 using the mvel syntax without explicitly specifying the dialect?

 Cheers



 2012/3/14 mike mike...@gmail.com

 Wait ... I haven't solved the problem ... I mean, as of now I cannot use
 mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but 
 the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code
 doing more reasonable things with new Client. Client c = new Client() 
 fails
 too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when
 part..) is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web
 services using jersey. I simplified the rule to the max. The 'when' is 
 not
 really needed. I get the exception on the call to new Client(). Please
 keep in mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of
 range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
  at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
  at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
  at
 com.ultimatesoftware.engine.tests.Wip.drools_new_client(Wip.java:32)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 

Re: [rules-users] Drools and Jersey

2012-03-14 Thread mike
Wolfgang,

I am able to find the place where the NPE happens. It is
in com.sun.jersey.spi.service.ServiceFinder on the method

private static EnumerationURL getResources(ClassLoader loader, String
name) throws IOException {
if (loader == null) {
return getResources(name);
} else {
final EnumerationURL resources = loader.getResources(name);
if (resources.hasMoreElements()) {
return resources;
} else {
return getResources(name);
}
}
}

In there, the call to loader.getResources(name) returns null
causing resources.hasMoreElements() to throw the NPE. That is a bug in
Jersey. But the same code works just fine without MVEL. So MVEL is doing
something that is causing Jersey not to find some classes.

Mauricio,

The test is simple, try running this drl

import com.sun.jersey.api.client.Client;

dialect  mvel

rule create Rest Client
then new Client();
end

OTOH this works just fine

import com.sun.jersey.api.client.Client;

rule create Rest Client
then new Client();
end

Thank you very much for your help
Cheers
Mike


2012/3/14 Mauricio Salatino sala...@gmail.com

 If you create an isolated test you can also create a new Jira issue, so
 it's easier for every one to reproduce, test and fix the problem.
 Cheers


 2012/3/14 mike mike...@gmail.com

 Wolfgang,

 I am using

 dependency
  groupIdorg.drools/groupId
  artifactIddrools-core/artifactId
 version5.3.1.Final/version
  typejar/type
 /dependency

 Mauricio:

 It is something related to loading classes inside Jersey that brakes if I
 am using mvel. I use mvel always, because java syntax hurts me.

 Drools Team:

 I think the easier way would be to try this scenario yourself. This is a
 pom for Jersey.

 dependency
 groupIdcom.sun.jersey/groupId
  artifactIdjersey-client/artifactId
 version1.12/version
  /dependency

 Thank you very much
 Cheers
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Sure.. we are interested in finding out what is happening. So, you find
 that when you are using mvel something inside Jersey fails?
 Did you find what exactly is happening inside Jersey? Probably it's
 something related with the class loaders, but I never seen an error like
 that when you specify the mvel dialect.
 By the way, what exactly are you trying to do with mvel? did you try
 using the mvel syntax without explicitly specifying the dialect?

 Cheers



 2012/3/14 mike mike...@gmail.com

 Wait ... I haven't solved the problem ... I mean, as of now I cannot
 use mvel if I want to use Jersey ... and I don't think it's Jersey's fault
 because it works in any condition except when using mvel. I thought that
 the Drools team follows this list and might be interested in that bug.

 Thank you very much
 Mike

 2012/3/14 Mauricio Salatino sala...@gmail.com

 Cool that you find that :)
 Cheers


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 I spent like 2 days debugging, before realizing that mvel was the
 culprit. The error is a Null Exception when resolving some service inside
 Jersey. I have to check my browser history at home for more details but 
 the
 exception was happening inside Jersey.

 Please notice I reduced the code to the minimum. I had 'real' code
 doing more reasonable things with new Client. Client c = new Client() 
 fails
 too.

 Thank you very much
  Mike


 2012/3/14 Mauricio Salatino sala...@gmail.com

 Hi Mike, I've never tried that before (a rule without the when
 part..) is good to know that it works :)
 Humm that's sounds weird.. why the dialect is affecting your Client
 creation.
 It could be that there is something wrong with the expression
 evaluation.
 It looks like MVEL cannot compile the new Client(); expression - at
 java.lang.String.init(Unknown Source)
 Did you try with something like:
 then \n
 Client c = new Client();

 I'm just guessing here, because it looks strange


 2012/3/14 mike mike...@gmail.com

 Hi Mauricio,

 Thank you for the speedy reply. Ia m making rest call to web
 services using jersey. I simplified the rule to the max. The 'when' is 
 not
 really needed. I get the exception on the call to new Client(). 
 Please
 keep in mind it works without dialect mvel.

 Thank you very much
 Mike

 Here's the stack trace .
 java.lang.StringIndexOutOfBoundsException: String index out of
 range: -1
 at java.lang.String.init(Unknown Source)
  at
 org.mvel2.CompileException.showCodeNearError(CompileException.java:149)
 at
 org.mvel2.CompileException.generateErrorMessage(CompileException.java:219)
  at org.mvel2.CompileException.toString(CompileException.java:62)
 at java.lang.Throwable.init(Throwable.java:242)
  at java.lang.Exception.init(Unknown Source)
 at java.lang.RuntimeException.init(Unknown Source)
  at
 org.drools.runtime.rule.ConsequenceException.init(ConsequenceException.java:31)
 at
 

[rules-users] Future events

2012-03-14 Thread lexsoto
Hello:

I have this rule:



An event is inserted that has a timestamp in the future, the rule is fired.
This looks like a bug, because the sliding time window has not yet met the
timestamp of the event.
I expect the rule to fire not immediately but only when the time reaches the
event time.

Is my assumption/understanding correct?


--
View this message in context: 
http://drools.46999.n3.nabble.com/Future-events-tp3826236p3826236.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] Future events

2012-03-14 Thread Edson Tirelli
   An event represents something that already happened (past), so there is
no such thing as a future event. You can have a fact that represents
something that is scheduled to happen in the future, but that is not an
event, and it can change as it is just data. Events are immutable.

   For instance: airport. You can have a flight scheduled to leave tomorrow
at 08:00am, from gate B1. That schedule might change, because the flight
can be delayed, cancelled, change gates, etc. It is just a fact in your
system (e.g. ScheduledFlight). But when the flight actually departs the
gate, then the system can have an event like FlightDepartedFromGate() that
says the flight left the gate B1 at 08:02am. This is immutable, because it
registers something that happened.

   Edson

On Wed, Mar 14, 2012 at 1:44 PM, lexsoto lexs...@gmail.com wrote:

 Hello:

 I have this rule:



 An event is inserted that has a timestamp in the future, the rule is fired.
 This looks like a bug, because the sliding time window has not yet met the
 timestamp of the event.
 I expect the rule to fire not immediately but only when the time reaches
 the
 event time.

 Is my assumption/understanding correct?


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Future-events-tp3826236p3826236.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Future events

2012-03-14 Thread Edson Tirelli
   The reason is because the engine will not queue up events and wait for
the correct time to deal with them. The engine assumes events always
represent past times. But for past events, I am sure the window is
respected. If you have a rule that counts the number of events in the last
5 hours, an event that happened 5 hours and 1 minute ago will not be in the
total count.

   Edson

On Wed, Mar 14, 2012 at 4:58 PM, lexsoto lexs...@gmail.com wrote:

 Thanks Edson for your reply, however I am still not clear about why the
 rule
 is firing if the time stamp of the event falls outside the time window.
 This can happen, for example, if the event originates in a machine with
 clock slightly ahead. I think the problem also occurs if the time is in the
 past; I would not want  to take action on a future or old event.

 I understand that events are immutable, and I am not changing the event in
 any way.  However, I expect the sliding time window to be changing along
 with the system clock until it reaches the timestamp of the event.
 My question still unanswered, why is the rule firing outside its time
 window? Is there a way to make this work?  Any advice about how to address
 this use case?

 Thanks

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Future-events-tp3826236p3826759.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Nesting prefix-or and prefix-and causing parsing problem

2012-03-14 Thread Patrik Dufresne
Hi,

I have a problem with nesting prefix-and and prefix-or. I found a bug in
JIRA but it been fixed in drools expert 5.0. Here is snippet to reproduce
the problem (based on the original rule). I get the following error :
java.lang.RuntimeException: [48,5]: [ERR 102] Line 48:5 mismatched input
'EmployeePreferredShift' in rule assign-preferred-position

declare EntityA
   number : int
end

declare EntityB
   number : int
end

declare EntityC
   number : int
end

rule and-or-snippet
dialect java
when
EntityA(
$number : number)
not ( and
EntityB (
number == $number )
( or
( and
EntityC (
number  $number)
not EntityB (
number == 4)
)
not EntityC (
number == 10 )
)
EntityA (
number = $number )
( or
not EntityC (
number = $number)
( and
EntityC (
number == 4 || number =10 )
not EntityB (
number == -3)
not EntityB (
number == -10 )
)
)
not EntityB(
number == 0)
)
then
System.out.println(Working);
end


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


Re: [rules-users] Future events

2012-03-14 Thread lexsoto
Well, yes that is how the engine works.  But should it work this way? Why
fire the rule if not in the appropriate time window? This still looks wrong
to me, as the intention of the rule is not observed.  On the per hand,  the
engine does queue events in other scenarios, so it seems arbritrary.  Too
bad because this would be a ver nice way to model scheduled events using the
temporal operators.  

Thanks Edson  

--
View this message in context: 
http://drools.46999.n3.nabble.com/Future-events-tp3826236p3827065.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] Auto generating Schedule(curriculum) in drools-planner

2012-03-14 Thread Nurlan
Hi, guys!

Approximately how many *time* takes generation of school-schedule in
drools-planner

if i have:
40 rooms and 42 periods(*period* contains /day of week/ and /time/(or lesson
order))

*Planning entity:* Lesson(id,course,room,period)
and facts...


this important for me...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Auto-generating-Schedule-curriculum-in-drools-planner-tp3827828p3827828.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] [rule-users]Drools Fact Management with Large Dataset in RDBMS

2012-03-14 Thread CW
Thank you in advance for your time reading this post first.

I have to make my rules work with databases with TB of data, so fact
management become a major issue when I design my system. Currently I have
several main programs which use both stateful and stateless sessions. I
would like to collect some good practices to manage the insertion and
disposal of facts so that I can keep my working memory healthy. Below are
some of my findings in this forum:

1. Insert only relevant facts into working memory with the use of data
preparation rule together with Drools pipeline (hibernate, mybatis, etc).
An excellent example from manstis in the post
http://drools.46999.n3.nabble.com/Applying-rules-on-the-data-in-an-RDBMS-td2468317.html#a2491888
-
rule bootstrap
salience -100
when
$list : List( ) from placeHolder.namedQuery(Smurfs)
then
for(ExternalObject o : $list ) {
insert( o );
}
end


2. Use insertlogical instead of insert when inserting facts in rule

3. Implement garbage collection rule to clean up unwanted facts



I would like to ask:

1. if there are any other suggestion on optimizing fact management?
2. is there a way for the rule engine to directly operate on data in
database (perhaps with some other plugin?)

Thanks again!

--
View this message in context: 
http://drools.46999.n3.nabble.com/rule-users-Drools-Fact-Management-with-Large-Dataset-in-RDBMS-tp3827838p3827838.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