RE: [rules-users] NPE in RightTuple

2009-01-15 Thread Evans, Jess
Possibly, upon inspection I found an entity class with suspicious looking 
hashCode and equals methods (source generate equals/hashcode is still to hard 
for some people it seems).  I'm trying to recreate a simple test case, to 
reproduce.  What's the simplest rule to generate a RightTupleIndexHashTable?  
Will any attribute constraint do e.g.:

 

BadClass($value : value)

BadClass(value == $value)

 

Thanks,

 

-Jess

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Wednesday, January 14, 2009 4:43 PM
To: Rules Users List
Subject: Re: [rules-users] NPE in RightTuple

 


   Looks like a bug. Can you please open a JIRA with a test case? My guess is 
that your rules are changing a fact attribute that is causing the 
equals()/hashcode() methods of the object to return a different result?
   
[]s
Edson

2009/1/14 Evans, Jess jev...@collegeboard.org

Does anyone know what this would be indicative of?  I've seen it occur 
periodically at which point I have to discard the session.  I flatten and 
assert my data, run the rules, and then retract the handles collected on 
assertion.  I've ensured the fact handle parameter is never null.  I have the 
stateful session wrapped in a synchronized business façade, so I don't think it 
should be a concurrency issue (unless I have a bug of course).  I'm running 
Drools 5 M4.

 

java.lang.NullPointerException

at 
org.drools.util.RightTupleIndexHashTable.remove(RightTupleIndexHashTable.java:224)

at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:204)

at 
org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:210)

at 
org.drools.reteoo.EntryPointNode.retractObject(EntryPointNode.java:190)

at 
org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1078)

at 
org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1045)


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




-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com

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


[rules-users] NPE in RightTuple

2009-01-14 Thread Evans, Jess
Does anyone know what this would be indicative of?  I've seen it occur 
periodically at which point I have to discard the session.  I flatten and 
assert my data, run the rules, and then retract the handles collected on 
assertion.  I've ensured the fact handle parameter is never null.  I have the 
stateful session wrapped in a synchronized business façade, so I don't think it 
should be a concurrency issue (unless I have a bug of course).  I'm running 
Drools 5 M4.

 

java.lang.NullPointerException

at 
org.drools.util.RightTupleIndexHashTable.remove(RightTupleIndexHashTable.java:224)

at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:204)

at 
org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:210)

at 
org.drools.reteoo.EntryPointNode.retractObject(EntryPointNode.java:190)

at 
org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1078)

at 
org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1045)

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


RE: [rules-users] decision tables - no agenda group?

2008-12-05 Thread Evans, Jess
Sorry, would someone validate that there's no agenda group support in
the decision table functionality?

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Evans, Jess
Sent: Monday, December 01, 2008 10:06 PM
To: Rules Users List
Subject: [rules-users] decision tables - no agenda group?

 

It doesn't appear that the decision table parser supports an
agenda-group declaration.  I find this odd since the documentation says
it supports activation and ruleflow.  Can someone validate this?

 

 

thanks,

 

-Jess

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


RE: [rules-users] Inline eval problem!

2008-12-05 Thread Evans, Jess
I don’t know your circumstances, but you might question why rank is a String in 
the first place.  Is the UI unduly influencing your data model?  You could 
always add a synthetic getter to your model itself and evade the eval 
altogether:

 

public  int getRankInt() { … }

 

That’s an ugly hack, but if your rank attribute is really an integer anyway… 

 

In any case, I’d suggest that you add a guard in your conversion utility to 
check for “” and null Strings maybe default to 0 or throw some exception.

 

 

Cheers,

 

-Jess

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of M.DILIP KUMAR
Sent: Tuesday, December 02, 2008 5:40 AM
To: Rules Users List
Subject: Re: [rules-users] Inline eval problem!

 

Hi ,

   i can suggest one more way to solve it. Dont create instance in when part.

Instead of better you convert that helper class method as static methods.

So that u can call that method directly . but before that u should import that 
helper class in drl file.

   Or second way u can directly write a method in ur drl file itself.


Example :

 

 

import com.g2x.agility.leads.workflow.rulesengine.RuleUtilities;

 

 

ruleConvertRule

 

when 

   eval ( RuleUtilities.getStringToInteger( age)  40)

// getStringToInteger(String age) is static method

 

then 

System.out.print(Name);

 

end

 

 

Defeat yourself today!

 

DILIP  KUMAR.M



--- On Tue, 2/12/08, vanshi [EMAIL PROTECTED] wrote:

From: vanshi [EMAIL PROTECTED]
Subject: [rules-users] Inline eval problem!
To: rules-users@lists.jboss.org
Date: Tuesday, 2 December, 2008, 10:38 AM

I need to convert a variable from string to intger in the rule. That variable
here is rank, so, I create a helper class called 'Conversion' with just
one
function/method, which is supposed to convert the string argument passed to
it, to an integer and then I call that method in rule as inline eval.
What's
wrong here because this is not working and I don't want to change
'When'
part too much because it has 10 or so other variable with 
connective,
which I've removed for clarity here. Any input would be appreciated much.
 
package harules;
import com.hibernate.Person;
import com.uhg.utils.Conversion;
 
rule one
salience 10
when
$con: Conversion();
pers: Person(age!= null , age = 18 , eval($con.getInteger(rank)  140))
then
System.out.println(Evaluated true);
end
 
//content of Conversion class
package com.utils;
public class Conversion {
public Integer getInteger(String s)
{
return Integer.parseInt(s);
}
}
-- 
View this message in context:
http://www.nabble.com/Inline-eval-problem%21-tp20786253p20786253.html
Sent from the drools - user mailing list archive at Nabble.com.
 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

 



Add more friends to your messenger and enjoy! Invite them now. 
http://in.rd.yahoo.com/tagline_messenger_6/*http:/messenger.yahoo.com/invite/ 

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


RE: [rules-users] decision tables - no agenda group?

2008-12-05 Thread Evans, Jess
Thanks.  Is it missing because declaring agenda group in decision table
rules is a stupid thing to do because of X, or was it simply overlooked?

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michal Bali
Sent: Friday, December 05, 2008 8:26 PM
To: Rules Users List
Subject: Re: [rules-users] decision tables - no agenda group?

 

I don't think there is.



On Sat, Dec 6, 2008 at 1:00 AM, Evans, Jess [EMAIL PROTECTED]
wrote:

Sorry, would someone validate that there's no agenda group support in
the decision table functionality?

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Evans, Jess
Sent: Monday, December 01, 2008 10:06 PM
To: Rules Users List
Subject: [rules-users] decision tables - no agenda group?

 

It doesn't appear that the decision table parser supports an
agenda-group declaration.  I find this odd since the documentation says
it supports activation and ruleflow.  Can someone validate this?

 

 

thanks,

 

-Jess


___
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] decision tables - no agenda group?

2008-12-01 Thread Evans, Jess
It doesn't appear that the decision table parser supports an
agenda-group declaration.  I find this odd since the documentation says
it supports activation and ruleflow.  Can someone validate this?

 

 

thanks,

 

-Jess

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


[rules-users] 5.0 GA

2008-11-17 Thread Evans, Jess
Is there an ETA for the Drools 5.0 GA release?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] top n - accumulate function parameters

2008-11-11 Thread Evans, Jess
The MVEL trick works.  That was exactly what I was hoping to find.
 
thanks,
 
-Jess



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: Tuesday, November 11, 2008 3:40 PM
To: Rules Users List
Subject: Re: [rules-users] top n - accumulate function parameters



   Accumulate functions support only a single parameter, as they are
defined now, but would be great if someone can come up with a good way
of adding support to variable number of parameters.

   Having said that, you can probably try a quick trick for your rules.
The way accumulate function works now is that it takes an expression as
the parameter, evaluate the expression and sends the result of the
expression to the accumulate function implementation. Example:

... accumulate( Cheese( $price: price ),
   sum( $price * 10 ) )

   So the engine will calculate $price * 10 and will send the result
into the function implementation.
   So, if you are using MVEL dialect, you can use the list creation
simplified syntax to pass multiple parameters to the function. I never
tried, but should work:

rule xyz
dialect mvel
when
...
... accumlate( Cheese( $price : price ),
 averageTop( [10, $price ] ) )
then
  ...
end

The syntax [ ] will create a list in MVEL and will pass it into the
method call:

public void accumulate(Serializable context, Object value) {
  List values = (List) value;
  ...
 }

 Problem is you only have the parameters available in the
accumulate() and reverse() call... you don't have access to them in the
init() and result() call.

 If you want to improve this, you are more than welcome!

[]s
Edson

 


2008/11/11 Evans, Jess [EMAIL PROTECTED]


I'm trying to average top N items.  I can of course collect the
items and do the rest in the consequence, but thought it might be a
scenario applicable to a custom accumulate function.  However, the
accumulate function interface methods only take one parameter.  If I
were to declare a function top(N, things) within an accumulate call
would drools autobox the parameters into some sort of collection?  
 
Maybe this is a naive solution anyway.  I am still learning to
think declaratively.
 
 
cheers,
 

-Jess

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






-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com

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


[rules-users] returning random limited query results

2008-10-24 Thread Evans, Jess
I'm trying to implement some suggestion functionality.  Is there an
efficient way to query for X random facts matching some constraint (e.g.
ten random cheeses that cost less than 3 dollars)?  I'd rather not
generate the complete list if there's a more clever way.  Unfortunately,
the constraints are customer specific; otherwise, I'd just create sort
of a central buffer list and dole out the random goodness to all takers.
 
 
thanks,
 
-Jess
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Dynamic class generation and eclipse rule editor

2008-10-10 Thread Evans, Jess
So, I've whipped together a rudimentary bit of code to parse an excel
and generate java bean fact classes and as well as the facts themselves.
This great article
(http://blog.athico.com/2006/12/dynamically-generated-class-beans-as.htm
l
http://blog.athico.com/2006/12/dynamically-generated-class-beans-as.htm
l ) helped me to resolve the runtime rule compilation problem I had
encountered.  However, my eclipse rule editor shows problems for the
dynamically generated class references which makes me sad.  Is there any
workaround to make these classes available to the rule editor or
otherwise suppress the type checking for these classes?
 
thanks,
 
-Jess
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] fact base storage?

2008-10-09 Thread Evans, Jess
I'm trying to come up to speed on the drools capabilities.  I see that
drools supports loading rules from a decision table in a spreadsheet.  I
have a set of conversion tables that I'd like to represent as facts
asserted when the rule base has been loaded, but before processing user
requests.  I could always model lookup tables in a database, but I'd
rather not have to build the CRUD interface to manage them.  I'd rather
represent them so that each row in a spreadsheet represents a fact
(based upon a predefined java bean).  Of course, I could custom
implement this functionality.  However, I was wondering if drools
supports some OOTB means of loading facts from Excel or other resource?
 
thanks,
 
-Jess
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] RE: fact base storage?

2008-10-09 Thread Evans, Jess
Thanks for the confirmation.  I think it should be straightforward to
implement a parser as you suggest to populate a list of java beans and
assert them to the working memory.  I'm just surprised that this doesn't
already exist.
 
May I ask how you manage the working memory?  It looks like you can't
clone or snapshot a working memory.  So, you must either assert all the
default facts in a new working memory for every user session/request or
use a shared synchronized working memory.  I'm building a web based
wizard calculator with around 10k default immutable facts.  It's taking
almost 800ms to assert and fire to reach an initial state, so I'm
planning on sharing one synchronized session.  Is this a reasonable
approach or am I off my rocker?
 
Cheers,
 
-Jess



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vikrant
Yagnick
Sent: Thursday, October 09, 2008 2:45 PM
To: Rules Users List
Subject: [rules-users] RE: fact base storage?



Hi Jess,

 

I am facing the same problem right now. While, I do not know of any OOTB
ways to do this, I initially implemented an all rule solution.

In my case, I had a lookup table that based on a age or gender got a
rate or some value.

 

Using some Excel Trickery, I got the 2 dimensional table into  one
dimensional columns of the type:

Age Gender   Value

Age and Gender became conditions and Value became the Action.

 

In your case, you could form a column with a dummy LHS(1=1) and keep all
the columns as Action Columns.

In each Action Column you could build up your Fact.

 

For Example you could do the following:

 

Fact{ int a; int b;

}

ConditionActionAction

F: Fact 

f.set($1);f.set($1)

Eval(true)Col A  Col B

Dummy Value values for avalues for b

 

If you generate a rule base out of this, it should load your tables
straight as facts.

 

However, do note, that I did some rather QD benchmarks for this and
soon realized that the rulebase size and memory usage was getting really
large. (Especially the PermGen Size).

 

You may want to have a look at the memory usage, in case you need to
load a large number of tables. Due, to the above(and other reasons), I
just wrote a custom parser using JXL (The same Excel Library Drools uses
for Parsing Excels). It is really neat and would make a simple solution.

 

 

In, case you get another solution do post it to the list.

 

Cheers,

Vikrant 

 

 

 

 

 

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Evans, Jess
Sent: Thursday, October 09, 2008 11:54 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] fact base storage?

 

I'm trying to come up to speed on the drools capabilities.  I see that
drools supports loading rules from a decision table in a spreadsheet.  I
have a set of conversion tables that I'd like to represent as facts
asserted when the rule base has been loaded, but before processing user
requests.  I could always model lookup tables in a database, but I'd
rather not have to build the CRUD interface to manage them.  I'd rather
represent them so that each row in a spreadsheet represents a fact
(based upon a predefined java bean).  Of course, I could custom
implement this functionality.  However, I was wondering if drools
supports some OOTB means of loading facts from Excel or other resource?

 

thanks,

 

-Jess

 



 




MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK


~~
Opinions expressed in this e-mail are those of the individual and not
that of Mastek Limited, unless specifically indicated to that effect.
Mastek Limited does not accept any responsibility or liability for it.
This e-mail and attachments (if any) transmitted with it are
confidential and/or privileged and solely for the use of the intended
person or entity to which it is addressed. Any review, re-transmission,
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility
of the recipient to run the virus check on e-mails and attachments
before opening them. If you have received this e-mail in error, kindly
delete this e-mail from desktop and server.

~~

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


RE: [rules-users] RE: fact base storage?

2008-10-09 Thread Evans, Jess
Thanks.  That's the plan.  However, my assumption is that even if the
data model and rules support partitioning that you still need to
synchronize calls to working memory so that two threads aren't invoking
insert, fire*, retract, etc. at the same time.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Greg Barton
Sent: Thursday, October 09, 2008 6:13 PM
To: Rules Users List
Subject: RE: [rules-users] RE: fact base storage?

That model sounds quite reasonable.  You may also find it useful to
partition your rules by user by having them match on a User object of
some kind and user state that matches up with each User.  

rule
when
  $u : User();
  UserState(user == $u);
  ImmutableFact1(...)
  ImmutableFact2(...)
then
  ...
end

That way you could have multiple users being processed concurrently and
they wouldn't overlap.

--- On Thu, 10/9/08, Evans, Jess [EMAIL PROTECTED] wrote:

 From: Evans, Jess [EMAIL PROTECTED]
 Subject: RE: [rules-users] RE: fact base storage?
 To: Rules Users List rules-users@lists.jboss.org
 Date: Thursday, October 9, 2008, 4:32 PM Thanks for the confirmation.

 I think it should be straightforward to implement a parser as you 
 suggest to populate a list of java beans and assert them to the 
 working memory.  I'm just surprised that this doesn't already exist.
  
 May I ask how you manage the working memory?  It looks like you can't 
 clone or snapshot a working memory.  So, you must either assert all 
 the default facts in a new working memory for every user 
 session/request or use a shared synchronized working memory.  I'm 
 building a web based wizard calculator with around 10k default 
 immutable facts.
 It's taking
 almost 800ms to assert and fire to reach an initial state, so I'm 
 planning on sharing one synchronized session.  Is this a reasonable 
 approach or am I off my rocker?
  
 Cheers,
  
 -Jess
 
 
 
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Vikrant 
 Yagnick
 Sent: Thursday, October 09, 2008 2:45 PM
 To: Rules Users List
 Subject: [rules-users] RE: fact base storage?
 
 
 
 Hi Jess,
 
  
 
 I am facing the same problem right now. While, I do not know of any 
 OOTB ways to do this, I initially implemented an all rule solution.
 
 In my case, I had a lookup table that based on a age or gender got a 
 rate or some value.
 
  
 
 Using some Excel Trickery, I got the 2 dimensional table into  one 
 dimensional columns of the type:
 
 Age Gender   Value
 
 Age and Gender became conditions and Value became the Action.
 
  
 
 In your case, you could form a column with a dummy LHS(1=1) and keep 
 all the columns as Action Columns.
 
 In each Action Column you could build up your Fact.
 
  
 
 For Example you could do the following:
 
  
 
 Fact{ int a; int b;
 
 }
 
 ConditionAction   
 Action
 
 F: Fact
 
 f.set($1); 
   f.set($1)
 
 Eval(true)Col A 
 Col B
 
 Dummy Value values for a   
 values for b
 
  
 
 If you generate a rule base out of this, it should load your tables 
 straight as facts.
 
  
 
 However, do note, that I did some rather QD benchmarks for this and 
 soon realized that the rulebase size and memory usage was getting 
 really large. (Especially the PermGen Size).
 
  
 
 You may want to have a look at the memory usage, in case you need to 
 load a large number of tables. Due, to the above(and other reasons), I

 just wrote a custom parser using JXL (The same Excel Library Drools 
 uses for Parsing Excels). It is really neat and would make a simple 
 solution.
 
  
 
  
 
 In, case you get another solution do post it to the list.
 
  
 
 Cheers,
 
 Vikrant
 
  
 
  
 
  
 
  
 
  
 
  
 
  
 
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Evans, Jess
 Sent: Thursday, October 09, 2008 11:54 PM
 To: rules-users@lists.jboss.org
 Subject: [rules-users] fact base storage?
 
  
 
 I'm trying to come up to speed on the drools capabilities.  I see that

 drools supports loading rules from a decision table in a spreadsheet.

 I have a set of conversion tables that I'd like to represent as facts 
 asserted when the rule base has been loaded, but before processing 
 user requests.  I could always model lookup tables in a database, but 
 I'd rather not have to build the CRUD interface to manage them.
  I'd rather
 represent them so that each row in a spreadsheet represents a fact 
 (based upon a predefined java bean).  Of course, I could custom 
 implement this functionality.  However, I was wondering if drools 
 supports some OOTB means of loading facts from Excel or other 
 resource?
 
  
 
 thanks,
 
  
 
 -Jess
 
  
 
   
 
  
 
 
 
 
 MASTEK LTD.
 Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
 In the US, we're called MAJESCOMASTEK