[rules-dev] allowing self joining combinations

Felipe Piccolini felipe.piccolini at bluesoft.cl
Mon Apr 16 15:58:53 EDT 2007


Terry,

     As I know this very alike as the drools implementation to  
resolve this so teorically this is not necesary as you set the right
configuration on drools.

    You can use System.identityHashCode(obj) to compare to instances  
of the same object, so the rule can be like
this:

   rule "compare"
	when
		$f1: Foo()
		$f2: Foo( $sysId -> ( System.identityHashCode($f1) <  
System.identityHashCode($f2)))
	then

I didnt check this code, so maybe the syntax can be wrong... but thas  
the idea...

Greetings.

On 16-04-2007, at 15:28, Terry Laurenzo wrote:

> This may be a silly question, but I had taken the non-self-joining  
> nature of Drools for granted.  Aside from disabling the option in  
> RuleBaseConfiguration, how would one write a rule that would not  
> self-join (ie. the old behavior)?
>
> (Say I wanted two different facts to match:
> 	when
> 		Foo()
> 		Foo()
> instead of the new default which allows the same fact to match)
>
> Thanks.
> Terry
>
> On Mar 26, 2007, at 12:26 PM, Edson Tirelli wrote:
>
>>    Michael,
>>
>>    In 3.1 the default is now to allow self joins (we need to add BIG
>> warnings to the documentation due to this change) and an option was
>> added to RuleBaseConfiguration to remove self joins.
>>
>>    []s
>>    Edson
>>
>> Michael Neale wrote:
>>
>> > I know that we by default remove self joins, ie:
>> >
>> > when
>> >   Foo()
>> >   Foo()
>> >
>> > will not match for the same instance of Foo - is it possible to  
>> turn
>> > that off? I know we talked about it at one point, not sure what the
>> > latest position is (someone was asking me and I can't recall  
>> what our
>> > final position is). FYI Jess and Jrules both self join by default.
>> >
>> >-------------------------------------------------------------------- 
>> ----
>> >
>> >_______________________________________________
>> >rules-dev mailing list
>> >rules-dev at lists.jboss.org
>> >https://lists.jboss.org/mailman/listinfo/rules-dev
>> >
>> >
>>
>>
>> --
>> Edson Tirelli
>> Software Engineer - JBoss Rules Core Developer
>> Office: +55 11 3124-6000
>> Mobile: +55 11 9218-4151
>> JBoss, a division of Red Hat @ www.jboss.com
>>
>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>>
>>
>> -- 
>>   Edson Tirelli
>>   Software Engineer - JBoss Rules Core Developer
>>   Office: +55 11 3124-6000
>>   Mobile: +55 11 9218-4151
>>   JBoss, a division of Red Hat @ www.jboss.com
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev


Felipe Piccolini M.
felipe.piccolini at bluesoft.cl




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20070416/fd8ffb66/attachment.html 


More information about the rules-dev mailing list