[rules-users] Rule using accumulate

Andres Corvetto acorvetto at gmail.com
Tue Apr 27 09:56:39 EDT 2010


Offers already have a creationTimestamp, that could be used for this.
However, it's not clear to me how to write a rule that matches only the
Offer with the minimum creationTimestamp.

Something like:

rule "Match Offer" 
	when 
		$b : PartiallyCoveredBid(uncoveredSize>0, $p:price) 
		$o : Offer(price<$p, alreadyUsed==false, creationTimestamp<[all other
matching Offer creationTimestamps ]) 
	then 
		[ add Offer $o to Bid $b] 
end 

is that possible?

- Andres

Wolfgang Laun-2 wrote:
> 
> If the age of Offers is so important it ought to be represented as
> fact data. If it cannot be added to the Offer itself, a proxy fact
> could be created, combining a counter with an Offer reference. A high
> salience rule for an Offer without OfferProxy would create this.
> 
> -W
> 
> On Mon, Apr 26, 2010 at 9:43 PM, Andres Corvetto <acorvetto at gmail.com>
> wrote:
>>
>> Thank you for your reply!
>> I understand your approach, and I think it could work if Offers were
>> inserted into the working memory after the Bid.
>> However, to implement your approach for already inserted Offers I think I
>> would need some way of forcing the matching Offer to be the oldest in
>> memory, is that possible?
>> The rule would be something like:
>>
>> rule "Match Offer"
>>        when
>>                $b : PartiallyCoveredBid(uncoveredSize>0, $p:price)
>>                $o : Offer(price<$p. alreadyUsed==false, [this is the
>> oldest Offer in
>> memory with these conditions])
>>        then
>>            [ add Offer $o to Bid $b]
>> end
>>
>> Thanks again
>>       Andrés
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/Rule-using-accumulate-tp757311p757703.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
>>
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rule-using-accumulate-tp757311p759323.html
Sent from the Drools - User mailing list archive at Nabble.com.




More information about the rules-users mailing list