Hi Sophie,
On 8/10/07, candel <candel@titus.u-strasbg.fr> 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
|