Package org.apache.uima.flow.impl
Class CapabilityLanguageFlowController
- java.lang.Object
-
- org.apache.uima.flow.FlowController_ImplBase
-
- org.apache.uima.flow.CasFlowController_ImplBase
-
- org.apache.uima.flow.impl.CapabilityLanguageFlowController
-
- All Implemented Interfaces:
FlowController
public class CapabilityLanguageFlowController extends CasFlowController_ImplBase
FlowController for the CapabilityLanguageFlow, which uses a linear flow but may skip some of the AEs in the flow if they do not handle the language of the current document or if their outputs have already been produced by a previous AE in the flow.
-
-
Field Summary
Fields Modifier and Type Field Description private static charLANGUAGE_SEPARATORmain language separator e.g 'en' and 'en-US'private java.util.Map<java.lang.String,ResultSpecification>lastResultSpecForComponentprivate java.util.Map<java.lang.String,AnalysisEngineMetaData>mComponentMetaDataMapprivate java.util.Map<java.lang.String,java.util.List<AnalysisSequenceCapabilityNode>>mFlowTableprivate java.util.List<AnalysisSequenceCapabilityNode>mStaticSequence
-
Constructor Summary
Constructors Constructor Description CapabilityLanguageFlowController()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FlowcomputeFlow(CAS aCAS)This method must be overriden by subclasses.protected java.util.Map<java.lang.String,java.util.List<AnalysisSequenceCapabilityNode>>computeFlowTable(Capability[] aCapabilities)method computeFlowTable create the flow table for faster processing.protected java.util.List<AnalysisSequenceCapabilityNode>computeSequence(java.lang.String language, Capability[] aCapabilities)method computeSequence creates a capabilityLanguageAnalysisSequence for the given languagestatic FlowControllerDescriptiongetDescription()java.util.Map<java.lang.String,ResultSpecification>getLastResultSpecForComponent()voidinitialize(FlowControllerContext aContext)Performs any startup tasks required by this component.-
Methods inherited from class org.apache.uima.flow.CasFlowController_ImplBase
computeFlow, getRequiredCasInterface, typeSystemInit
-
Methods inherited from class org.apache.uima.flow.FlowController_ImplBase
addAnalysisEngines, batchProcessComplete, collectionProcessComplete, destroy, getContext, getLogger, reconfigure, removeAnalysisEngines
-
-
-
-
Field Detail
-
mStaticSequence
private java.util.List<AnalysisSequenceCapabilityNode> mStaticSequence
-
mComponentMetaDataMap
private java.util.Map<java.lang.String,AnalysisEngineMetaData> mComponentMetaDataMap
-
mFlowTable
private java.util.Map<java.lang.String,java.util.List<AnalysisSequenceCapabilityNode>> mFlowTable
-
lastResultSpecForComponent
private final java.util.Map<java.lang.String,ResultSpecification> lastResultSpecForComponent
-
LANGUAGE_SEPARATOR
private static final char LANGUAGE_SEPARATOR
main language separator e.g 'en' and 'en-US'- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(FlowControllerContext aContext) throws ResourceInitializationException
Description copied from interface:FlowControllerPerforms any startup tasks required by this component. The framework calls this method only once, just after the FlowController has been instantiated.The framework supplies this FlowController with a reference to the
FlowControllerContextthat it will use, for example to access configuration settings or resources. This FlowController should store a reference to this Context for later use.- Specified by:
initializein interfaceFlowController- Overrides:
initializein classFlowController_ImplBase- Parameters:
aContext- Provides access to services and resources managed by the framework. This includes configuration parameters, logging, and access to external resources. Also provides the FlowController with the metadata of all of the AnalysisEngines that are possible targets for routing CASes.- Throws:
ResourceInitializationException- if the FlowController cannot initialize successfully.
-
computeFlow
public Flow computeFlow(CAS aCAS) throws AnalysisEngineProcessException
Description copied from class:CasFlowController_ImplBaseThis method must be overriden by subclasses. It takes aCASand returns aFlowobject that is responsible for routing this particular CAS through the components of this Aggregate. TheFlowobject should be given a handle to the CAS, so that it can use information in the CAS to make routing decisions.FlowController implementations will typically define their own class that implements
Flowby extending from the base classCasFlow_ImplBase. This method would then just instantiate the flow object, call itssetCasmethod to provide a handle to the CAS, and return the flow object.- Specified by:
computeFlowin classCasFlowController_ImplBase- Parameters:
aCAS- the CAS to be routed- Returns:
- a Flow object that will be used to route
aCAS - Throws:
AnalysisEngineProcessException- if a problem occurs during processing- See Also:
FlowController.computeFlow(AbstractCas)
-
computeFlowTable
protected java.util.Map<java.lang.String,java.util.List<AnalysisSequenceCapabilityNode>> computeFlowTable(Capability[] aCapabilities)
method computeFlowTable create the flow table for faster processing. The flow table includes the corresponding flow sequence for all languages in the capabilities- Parameters:
aCapabilities- aggregate engine capabilities- Returns:
- Map - flow table includes all sequences for all languages
-
computeSequence
protected java.util.List<AnalysisSequenceCapabilityNode> computeSequence(java.lang.String language, Capability[] aCapabilities)
method computeSequence creates a capabilityLanguageAnalysisSequence for the given language- Parameters:
language- current languageaCapabilities- output capabilities of the aggregate engine- Returns:
- List - capabilityLanguageAnalysisSequence for the current language
-
getDescription
public static FlowControllerDescription getDescription()
-
getLastResultSpecForComponent
public java.util.Map<java.lang.String,ResultSpecification> getLastResultSpecForComponent()
-
-