[rules-users] Is it possible to implement something similar to a SQL join in Drools ?

Michael Anstis michael.anstis at gmail.com
Wed Jun 13 08:09:49 EDT 2012


Yes, much the same as you would with a RDBMS.

You'll have to insert the individual Lists (either by inserting their
members, or by using "from").

Outer product:-

when
    FactA( )
    FactB( )
then

Inner join:-

when
    FactA( $pk : pk)
    FactB( fk == $pk )
then

left and right joins follow similarly (you'd have to check if the outer key
equals or is null).


On 13 June 2012 13:04, soumya_sd <soumya_sd at yahoo.com> wrote:

> Is it possible to have a rule that creates something similar to a SQL join.
>
> For example, the working memory has the following:
>
> List<Fact_A> and List<Fact_B>.
>
> In the "if" of the drl rule we want to check
>
> if Fact_A.someAttribute (some_condition) Fact_B.someOtherAttribute
> //some_condition could be .equals(), .startsWith(), notEquals() ...
>
> then
>  //somehow Fact_A and Fact_B
>
> Any examples or pointers would be greatly appreciated.
>
> Thanks.
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Is-it-possible-to-implement-something-similar-to-a-SQL-join-in-Drools-tp4017908.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120613/68a58b3d/attachment.html 


More information about the rules-users mailing list