Package org.apache.uima.fit.factory
Class AggregateBuilder
java.lang.Object
org.apache.uima.fit.factory.AggregateBuilder
This builder makes it easier to create an aggregate analysis engine. A typical use-case would
 involve initializing this builder with your preferred type system and type priorities (the latter
 may be null). This is followed by adding analysis engine descriptions one at a time until done.
 This makes it easy to have runtime decisions determine how the aggregate engine should be built.
 Finally, one of the create methods are called and an AnalysisEngine or AnalysisEngineDescription
 is returned.
 
 
This is an example taken from our test cases:
 
 import static org.apache.uima.fit.factory.AnalysisEngineFactory.createPrimitiveDescription;
 
 AggregateBuilder builder = new AggregateBuilder();
 builder.add(createPrimitiveDescription(Annotator1.class, typeSystemDescription),
     ViewNames.PARENTHESES_VIEW, "A");
 builder.add(createPrimitiveDescription(Annotator2.class, typeSystemDescription),
     ViewNames.SORTED_VIEW, "B",
     ViewNames.SORTED_PARENTHESES_VIEW, "C",
     ViewNames.PARENTHESES_VIEW, "A");
 builder.add(createPrimitiveDescription(Annotator3.class, typeSystemDescription),
     ViewNames.INITIAL_VIEW, "B");
 AnalysisEngine aggregateEngine = builder.createAggregate();
 
 - 
Constructor SummaryConstructorsConstructorDescriptionThe default no-args constructor callsAggregateBuilder(TypeSystemDescription, TypePriorities, FlowControllerDescription)with null-valued args.AggregateBuilder(TypeSystemDescription typeSystemDescription, TypePriorities typePriorities, FlowControllerDescription flowControllerDescription) Instantiate an AggregateBuilder with a given type system, type priorities, and flow controller.
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(String componentName, AnalysisEngineDescription aed, String... viewNames) add(AnalysisEngineDescription aed, String... viewNames) This method simply callsadd(String, AnalysisEngineDescription, String...)using the result ofAnalysisEngineDescription.getAnnotatorImplementationName()for the component namevoidaddSofaMapping(String componentName, String componentViewName, String aggregateViewName) Provide a sofa mapping for a component from the component's view to the aggregate view.This method simply delegates toAnalysisEngineFactory.createEngine(List, TypeSystemDescription, TypePriorities, SofaMapping[], Object...)with the data collected by this builder.This method simply delegates toAnalysisEngineFactory.createEngineDescription(List, TypeSystemDescription, TypePriorities, SofaMapping[], Object...)with the data collected by this builder.voidsetFlowControllerDescription(FlowControllerDescription flowControllerDescription) Set the flow controller description of the aggregate engine created by this builder.
- 
Constructor Details- 
AggregateBuilderpublic AggregateBuilder()The default no-args constructor callsAggregateBuilder(TypeSystemDescription, TypePriorities, FlowControllerDescription)with null-valued args.
- 
AggregateBuilderpublic AggregateBuilder(TypeSystemDescription typeSystemDescription, TypePriorities typePriorities, FlowControllerDescription flowControllerDescription) Instantiate an AggregateBuilder with a given type system, type priorities, and flow controller. Generally, speaking it suffices to use the no arguments constructor- Parameters:
- typeSystemDescription- this can be instantiated using- TypeSystemDescriptionFactory
- typePriorities- this can be instantiated using- TypePrioritiesFactory
- flowControllerDescription- this can be instantiated using- FlowControllerFactory
 
 
- 
- 
Method Details- 
addThis method simply callsadd(String, AnalysisEngineDescription, String...)using the result ofAnalysisEngineDescription.getAnnotatorImplementationName()for the component name- Parameters:
- aed- an analysis engine description to add to the aggregate analysis engine
- viewNames- pairs of view names corresponding to a componentSofaName followed by the aggregateSofaName that it is mapped to. An even number of names must be passed in or else an IllegalArgumentException will be thrown. See- SofaMappingFactory.createSofaMapping(String, String, String)
- Returns:
- the name of the component generated for the AnalysisEngineDescription
 
- 
add- Parameters:
- componentName- the name of the component to add
- aed- an analysis engine description to add to the aggregate analysis engine
- viewNames- pairs of view names corresponding to a componentSofaName followed by the aggregateSofaName that it is mapped to. An even number of names must be passed in or else an IllegalArgumentException will be thrown. See- SofaMappingFactory.createSofaMapping(String, String, String)
 
- 
addSofaMappingpublic void addSofaMapping(String componentName, String componentViewName, String aggregateViewName) Provide a sofa mapping for a component from the component's view to the aggregate view.- Parameters:
- componentName- the name of the component
- componentViewName- the name of the component view
- aggregateViewName- the name of the aggregate view to map the component view to.
 
- 
setFlowControllerDescriptionSet the flow controller description of the aggregate engine created by this builder.- Parameters:
- flowControllerDescription- see- FlowControllerFactory
 
- 
createAggregateThis method simply delegates toAnalysisEngineFactory.createEngine(List, TypeSystemDescription, TypePriorities, SofaMapping[], Object...)with the data collected by this builder.- Returns:
- an aggregate analysis engine
- Throws:
- ResourceInitializationException- if there is a problem during initialization
 
- 
createAggregateDescriptionpublic AnalysisEngineDescription createAggregateDescription() throws ResourceInitializationExceptionThis method simply delegates toAnalysisEngineFactory.createEngineDescription(List, TypeSystemDescription, TypePriorities, SofaMapping[], Object...)with the data collected by this builder.- Returns:
- a description of an aggregate analysis engine
- Throws:
- ResourceInitializationException- if there is a problem during initialization
 
 
-