[rules-users] Events - Determining the Fact Pattern

Mark Proctor mproctor at codehaus.org
Sun Mar 8 11:09:53 EDT 2009


David Boaz wrote:
> Hi all,
>
> Is it possible to determine the Pattern that ‘produced’ a given Fact? For
> example, assuming we have the following rule and event handler:
>
> rule r1
> 	when 
> 		p1:Person(...)
> 		p2:Person(...)
> 	then
> 	...
> end
>
> protected class MyAgendaEventHandler extends
> 	    DefaultAgendaEventListener {
>
> 	@Override
> 	public void
> afterActivationFired(org.drools.event.rule.AfterActivationFiredEvent event)
> {
> 		String ruleName = event.getActivation().getRule().getName();
> 		KnowledgeRuntime knowledgeRuntime = event.getKnowledgeRuntime();
> 		for (FactHandle factHandle : event.getActivation().getFactHandles()) {
> 			Object fact = knowledgeRuntime.getObject(factHandle);
> 			Pattern pattern= ?;
> 		}
> 	}
> }
>
> Is it possible to determine the Pattern that originate a Person object? If
> yes, how the pattern is identified?
>   
no
> Thanks, David
>   





More information about the rules-users mailing list