[rules-users] Missing results with multiple time rules

wendy w.mungovan at yahoo.com
Mon May 9 12:19:09 EDT 2011


Sorry, I've been testing this more and I think that it is with in our code
that I'm doing something wrong that is causing this issue not how I'm
writing the rules.  Probably with updating the psudo-clock time in the wrong
spot.  

Is it ok if I ask a related question?  Is there a way to accumulate multiple
values at once?  The way I've written the rule now we first collect a set of
objects then try to find the min, max and/or average values of some fields
as well as creating a string of all the 'name' components.  Is it possible
to write an accumulate function that can calculate multiple values at the
same time?

This is what I'm doing now.  It seem in efficient....


// ... removed the includes....
dialect "java"

declare SIGINT_track
	@role(event)
	@timestamp(time)
end

rule "Rule_87_0_Find"
	when
		$LaunchpadA: Launchpad  ( 
		)

		$SIGINT_trackA: ArrayList( size >= 3, size <= 5) from collect(
$SIGINT_trackA_list : SIGINT_track  ( 
			 eval(distLess(location, $LaunchpadA.location,2000.0))
			) over window:time(7200000ms)
		)

		$MIN_SIGINT_trackA_time: Number() from accumulate( $i: SIGINT_track() from
$SIGINT_trackA, min($i.time));
		$TEXTLIST_SIGINT_trackA_name: String()
			from accumulate( SIGINT_track($id: name) from $SIGINT_trackA,
				init(ArrayList ids = new ArrayList();),
				action( ids.add($id); ),
				reverse( ids.remove($id);),
				result(converter(ids))
			);
		$MIN_SIGINT_trackA_time: Number() from accumulate( $i: SIGINT_track() from
$SIGINT_trackA, min($i.time));
		$AVERAGE_SIGINT_trackA_time: Number() from accumulate( $i: SIGINT_track()
from $SIGINT_trackA, average($i.time));
	then
		//	debug print statement to see if we are getting here
		System.out.println("Rule 87 " + $TEXTLIST_SIGINT_trackA_name);
		// ... code to do stuff in our system
	end




--
View this message in context: http://drools.46999.n3.nabble.com/Missing-results-with-multiple-time-rules-tp2918309p2919375.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list