Adam Lally wrote:

Hi Sophie,


On 8/10/07, candel <[EMAIL PROTECTED]> wrote:
Hello,
I am working on a UIMA FlowController.
I would like to guide a CAS through one or another AE depending on the
result of a first AE.
I think I have to write something like that:

//running first AE
return SimpleStep(aeKey1);
//testing my condition
If (result=="ok"){ return new SimpleStep(aeKey2)}
Else { return new SimpleStep(aeKey3)}
//closing flow
return FinalStep();


Sort of... but you can only return one Step object per call to the
next() method, so you have to remember where you are in the flow.  A
simple way to do this would be like this:

if (!firstAeCalled) {
 //running first AE
 firstAeCalled = true;
 return SimpleStep(aeKey1);
} else if (!secondAeCalled) {
 secondAeCalled = true
 //TODO: compute "result" by looking at the CAS
 If (result=="ok"){ return new SimpleStep(aeKey2)}
  Else { return new SimpleStep(aeKey3)}
} else {
 //closing flow
 return FinalStep();
}

Also look at the exampleWhiteboardFlowController.java, which keeps a
history of which AEs have been already called during the Flow.

The trouble is that I can't find out how to get the aeKey of a
particular AE...Is it simply the key name given in the AAE descriptor
where we join our own defined flow?



Yes, the aeKey will be the same as the key defined in the Aggregate
Analysis Engine descriptor, but it's preferable to query the framework
for this information rather than hard-coding a particular key value
into your Flow Controller.

In your FlowController, call:
getContext().getAnalysisEngineMetaDataMap()

This returns you a Map from aeKey Strings to AnalysisEngineMetaData
object.  The AnalysisEngineMetaData contains information from that
particular delegate (component) AE's descriptor - such as its name,
inputs,outputs, etc.


Regards,
 -Adam



Hi,

thanks to your help, I wrote my Conditional FlowController.
The thing is that I couldn't find an other way than hard-coding the eaKeys in it. Indeed, nothing can distinguish the annotators AE2 or AE3 except for their internal analysis method. In fact, the analysis method used is only a strategic choice that depends on the results of the first AE.
AE2 and AE3 have the same inputs and outputs requirements, ...

After these explanations, do you still think their is another way to do it?

Regards,
Sophie

Reply via email to