[rules-users] How to use Drool Inference instead of SQL's

JohnSood johnsood at in.com
Mon Mar 30 08:19:51 EDT 2009


Hi,

I am in process of development of an application that uses the DRools 4.0.7
and fires the rules based data returned by some SQL statements.

The problem is when we use SQL functions like MAX(), AVG(), SUM() etc. then
providing facts to the rule engine is easy and DIRECT as these functions
returns only one row generally.

The case when the user is firing the SQL queries without using SQL
functions, then more than one rows will be returned by the DB server, and in
this case how can we use the ReteOO used by Drools to provide the same
inference as provided by DB server using SQL function (like selecting max
value of a particular column from 'n' rows returned by DB server) ?


For example we want to get the most recent hit_date (a column in table
'table_1')

Case 1 : 
SQL : select max(hit_date) from table_1

In this case the DB will return only one row and we can provide that row as
a fact to rule engine.

Case 2:

SQL : select hit_date from table_1

In this case 'n' numbers of rows will be returned, then how can we get the
max(hit_date) from all those rows using Drools from those n rows ?


Moreover the case is not fixed i.e. we are not limited to the use of MAX()
SQL function, this function may be of any type provided by SQL of any DB
Server.

Please respond.
Thanks,
John


-- 
View this message in context: http://www.nabble.com/How-to-use-Drool-Inference-instead-of-SQL%27s-tp22780564p22780564.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list