Re: [rules-users] Class loader problem

2009-11-08 Thread Hemanth kumar
Hi swapnil thanx for the reply I think there is no error in url path.for a week i was not active in my project. Im sending my sample project Here is my sample application - main java class http://old.nabble.com/file/p26262304/rul

Re: [rules-users] Help me improve my rules performance.

2009-11-08 Thread Greg Barton
OK, first thing: getBillActCode() creates an empty HashMap that is either not used or replaced in all cases. In general you should avoid object creation in functions called in rule conditions, but especially avoid unnecessary object creation. :) And now for the rules. I'm not sure I've ever s

[rules-users] Help me improve my rules performance.

2009-11-08 Thread ABRA2
Hi, I have an example of two rules we use in our project. Rule CheckStationNumber checks if the station number field is null in BillingRecord Object which is stored as a list in AssertionObject object. Rule AssignBAC gets a value from a static map(we dont want to do database calls eachtime.so w

Re: [rules-users] some pointers for solution

2009-11-08 Thread Greg Barton
Yeah, That condition is just an optimization that prevents comparison of a Query against a Data that has less Criteria than the Query, which by definition cannot then be satisfied. It's not logically necessary, but a pretty easy optimization. --- On Sun, 11/8/09, Wishing Carebear wrote: > F

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Also I hope modifying the statement: *q : Query( size <= d.size )* to *q : Query( )* should be fine. 2009/11/8 Greg Barton > Yep. See attached project. It actually simplifies the java a bit, as now > there doesn't need to be any trickery in the contains method for Query. The > rule now u

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Thanks Greg. I really appreciate your help. Will try it and update you. Regards, cabear 2009/11/8 Greg Barton > Yep. See attached project. It actually simplifies the java a bit, as now > there doesn't need to be any trickery in the contains method for Query. The > rule now uses a from claus

Re: [rules-users] some pointers for solution

2009-11-08 Thread Greg Barton
Yep. See attached project. It actually simplifies the java a bit, as now there doesn't need to be any trickery in the contains method for Query. The rule now uses a from clause to get the Criteria directly from the Query: rule "Match" when d : Data() q : Query( size <= d.size )

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Hi Wolfgang: Thanks for your help. Is it possible to explain little bit more on the Item class and rule C1. Not able to comprehend the complete solution. Thanks, cabear 2009/11/8 Wolfgang Laun > Another proposal, with perhaps more emphasize on "rulishness". > > Given >class Item { T1 s1;.

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Yes Edson, I tried with count and sum. Both seems to be working fine. But with the test case, the Criteria for query also needs to be inserted in addition to the query and data objects like shown below: Query query = *new* Query(1); query.add(*new* Criteria(query, "c2", "bas")); ksession.inser

[rules-users] ResourceChangeScanner not picking up changes deployed to Guvnor

2009-11-08 Thread Peter Butler
We're using Drools 5.0.1.SNAPSHOT 26353:26357M in JBoss 4.2.3. We're still in UAT so we've got our rules in Guvnor so that the business analysts can deploy changes quickly, they create snapshots in Guvnor that are picked up by the application. The problem is that sometimes creating a snapshot i

Re: [rules-users] some pointers for solution

2009-11-08 Thread Greg Barton
Because I keep forgetting the convenience functions exist. :P --- On Sun, 11/8/09, Edson Tirelli wrote: > From: Edson Tirelli > Subject: Re: [rules-users] some pointers for solution > To: "Rules Users List" > Date: Sunday, November 8, 2009, 4:41 PM > >    Why not use count() accumulate functi

Re: [rules-users] some pointers for solution

2009-11-08 Thread Edson Tirelli
Why not use count() accumulate function? ;) from accumulate( Criteria( this memberOf d, this memberOf q ), count(1) ) Edson 2009/11/8 Greg Barton > In this case the accumulate clause is maintaining a counter (total) that's > incremented whenever a Criteria is d

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Thanks Greg, Regards, cabear On Sun, Nov 8, 2009 at 11:00 AM, Greg Barton wrote: > In this case the accumulate clause is maintaining a counter (total) that's > incremented whenever a Criteria is detected that is contained in both the > Data and Query object matched in the rule. So: > > # Find

Re: [rules-users] some pointers for solution

2009-11-08 Thread Greg Barton
In this case the accumulate clause is maintaining a counter (total) that's incremented whenever a Criteria is detected that is contained in both the Data and Query object matched in the rule. So: # Find Criteria that are contained in both the Data and Query from accumulate( Criteria( this membe

Re: [rules-users] MVEL and Maps

2009-11-08 Thread Leonardo Gomes
Wolfgang / Edson, Thank you for the inputs. We're using Drools in another three different subsystems, and in all cases we already use regular java beans in our applications, but to solve this particular problem I'll probably start with regular evals and then migrate to Fact Types. We're actually

Re: [rules-users] rule help

2009-11-08 Thread Wolfgang Laun
In addition to what Nestor has said, you'll also have to make sure your inserted facts objects contain values. You are just calling the default constructors Adattipus ertek = new Adattipus(); Mertadat mertekegyseg = new Mertadat (); Mertadat mozgas = new Mertadat ()

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Hi Greg: I'm trying to understand your first solution. Ran the project and it works fine. If possible could you explain me little bit on : from accumulate( Criteria( this memberOf d, this memberOf q ), *init*( *int* total = 0; ), action( total ++; ), reverse( total --; ), result( total ) )

Re: [rules-users] MVEL and Maps

2009-11-08 Thread Edson Tirelli
Wolfgang, As you know, there are a ton of problems when you go down the "date" route. Probably the reason java never had a decent built-in date framework (fingers crossed for JSR-310). Anyway, back to the point, the syntax sugar for string-based strings is a really simple way for people

Re: [rules-users] MVEL and Maps

2009-11-08 Thread Wolfgang Laun
For the sake of clarification: Are you saying that there is, or should be, some magic which would make a constraint like Map ( this["departureDate"] == "07-Jan-2009" ) behave as a comparison between two java.util.Date values if the LHS Object is of this type? And also if it is a GregorianCalenda

Re: [rules-users] MVEL and Maps

2009-11-08 Thread Edson Tirelli
Ok, without discussing the merits of using (or not) maps, the reason you are having problems with dates is that the "string-based" date is syntax sugar in Drools parser/compiler. Although, when you create expressions using nested accessors or [] for collection/map element access, drools wraps

Re: [rules-users] MVEL and Maps

2009-11-08 Thread Leonardo Gomes
Hi Wolfgang, Here's the context: We're replacing a very basic home-made rule engine with drools. Today, fact data can be added dynamically b/c for all rules our fact is nothing more than a Map and we can register new fact data through an UI where you say what's the key and what's the type of the

Re: [rules-users] rule help

2009-11-08 Thread Nestor Tarin Burriel
Hi, As first look you must add the getters and setters methods into the model classes "Adattipus" and "Mertadat". In your rule you have written "Mertadat(ertek>180, mertekegyseg=="/min",mozgas==true);" but you dont have declared the field "ertek" in the class "Mertadat". And have also care with th

Re: [rules-users] Maintaining DB/Working Memory Synchronization

2009-11-08 Thread Andrew Waterman
I was just referring to facts that we're being placed into your statefulknowledgesession. As I mentioned, I use a mechanism with an EJB to manage my JPA entities before injecting them into the session. I passed on a blog entry with a ruleflow example as that looks to do a similar thing but within

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wishing Carebear
Thanks Greg\Barton. I will try it out and get back to you. Regards, cabear 2009/11/8 Wolfgang Laun > Another proposal, with perhaps more emphasize on "rulishness". > > Given >class Item { T1 s1;... Tn sn;... } > let's add >enum Criterium { C1, C2,... Cn; } >class Request { EnumSet

Re: [rules-users] Maintaining DB/Working Memory Synchronization

2009-11-08 Thread Nestor Tarin Burriel
So, Do you mean that for serializing the state of a StatefulKnowledgeSession we must include our rules into a ruleflow? How do you upgrade your KnowledgeBase without loosing the WM state? Please check this issues: https://jira.jboss.org/jira/browse/JBRULES-1946 https://jira.jboss.org/jira/browse

[rules-users] rule help

2009-11-08 Thread SzA84
Hi I am working on a simple drools project. I have now one rule, but it not works. This is the drl: package orvosi; import orvosi.orvosimeres.Adattipus; import orvosi.orvosimeres.Mertadat; rule "Your First Rule" when Adattipus(ertek="heart_rate");

Re: [rules-users] MVEL and Maps

2009-11-08 Thread Wolfgang Laun
On Sat, Nov 7, 2009 at 6:00 PM, Leonardo Gomes wrote: > Hello, > > I'm feeding my working memory with Maps (unfortunately, this is a > requirement and I can't use beans). > > Before people start racking their brains to overcome all the resulting difficulties: Could you please explain what this req

Re: [rules-users] some pointers for solution

2009-11-08 Thread Wolfgang Laun
Another proposal, with perhaps more emphasize on "rulishness". Given class Item { T1 s1;... Tn sn;... } let's add enum Criterium { C1, C2,... Cn; } class Request { EnumSet criteria; HashSet results; } To launch a request, insert a Request object with an appropriate setting for criteria.

Re: [rules-users] some pointers for solution

2009-11-08 Thread Greg Barton
There are a couple of ways to do this. I'm sure there's a bit more clean way than the example I'm providing, but this should get you in the right direction. It's not 100% rules, because it involves a bit of java collections trickery. (See attached project, collection_DroolsCriteriaMatch.tar.gz