[rules-users] Is there a faster way of doing this in Drools ?

soumya_sd soumya_sd at yahoo.com
Wed May 9 13:45:54 EDT 2012


Davide, thanks for your insights and questions. All of these are good
questions. Please see my responses below. 


Davide Sottara wrote
> 
> If the structure of the constraints/filters the user can define remains
> static, and only the values are  changing, then a single rule with
> parametric joins will be enough. E.g.:
> 
> Params( $cat : categorySet, $minPrice : minPrice, $maxPrice : maxPrice,
> .... )
> Product( category in $cat, price >= $minPrice && <= $maxPrice, num_ratings
> ... ) 
> 
> You'd then have to update the "Params" according to what the user e.g.
> selects from a checkbox. 
> A "null" selection would then be converted e.g. categorySet  = all
> categories, minPrice = -infinity, maxPrice = +infinity etc...
> 

This may work but I can see this a limitation in many cases. 


Davide Sottara wrote
> 
> If, on the other hand, the user is completely free to create their own
> rules, this strategy may not be applicable. 
> 
This is closer to what I want to do. 


Davide Sottara wrote
> 
> 
> Wouldn't then the bottleneck be the user writing/picking the rules
> (seconds) rather than their compilation (a few milliseconds)? If so, you
> might have "horizontal" scalability issues - allowing more and more users
> to do this - rather than "vertical" ones - responding faster to a single
> user. 
>  
Why do you think horizontal scalability is an issue ? 


Davide Sottara wrote
> 
> 
> If, instead, the criteria are built automatically by a software agent of
> some sort, then the direct creation might be taken into consideration. You
> can skip the parsing step by creating the Abstract Syntax Tree directly -
> the compiler APIs ("Descrs") have a nice fluent structure.
> 
Is parsing really expensive ? Do you have any idea of how much improvements
one can get by directly putting the rules into as AST. 



Davide Sottara wrote
> 
> btw, what are your rules supposed to do as a consequence? Do you have
> chaining? or actions?
> If all you need is selection and filtering, I wonder if a production rule
> system is the best option
> for your application, or at least this sub-module...
> 
For now I'm just using it for filtering. But in the future I can see how the
system can be extended to support other use cases with complex consequences. 

Do you have any other solution in mind that can help address the use case
I'm trying to implement? 

thanks again ! 


--
View this message in context: http://drools.46999.n3.nabble.com/Is-there-a-faster-way-of-doing-this-in-Drools-tp3973888p3974834.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list