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

Anstis, Michael (M.) manstis1 at ford.com
Mon Mar 30 08:39:34 EDT 2009


This might be of interest http://www.jboss.org/community/docs/DOC-11909 

-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of JohnSood
Sent: 30 March 2009 13:20
To: rules-users at lists.jboss.org
Subject: [rules-users] How to use Drool Inference instead of SQL's


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-tp22
780564p22780564.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list