Package org.apache.uima.fit.component
Class ViewCreatorAnnotator
- All Implemented Interfaces:
AnalysisComponent
This annotator can be placed at/near the beginning of a pipeline to ensure that a particular view
is created before it is used further downstream. It will create a view for the view name
specified by the configuration parameter PARAM_VIEW_NAME if it doesn't exist. One place this is
useful is if you are using an annotator that uses the default view and you have mapped the
default view into a different view via a sofa mapping. The default view is created automatically
- but if you have mapped the default view to some other view, then the view provided to your
annotator (when it asks for the default view) will not be created unless you have explicitly
created it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe parameter name for the name of the viewed to be created by this annotator -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.uima.fit.component.JCasAnnotator_ImplBase
initializeMethods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase
getRequiredCasInterface, processMethods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase
getCasInstancesRequired, hasNext, nextMethods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
batchProcessComplete, collectionProcessComplete, destroy, getContext, getLogger, getResultSpecification, reconfigure, setResultSpecification
-
Field Details
-
PARAM_VIEW_NAME
The parameter name for the name of the viewed to be created by this annotator- See Also:
-
-
Constructor Details
-
ViewCreatorAnnotator
public ViewCreatorAnnotator()
-
-
Method Details
-
process
Description copied from class:JCasAnnotator_ImplBaseThis method should be overriden by subclasses. Inputs a JCAS to the AnalysisComponent. The AnalysisComponent "owns" this JCAS until such time asAnnotator_ImplBase.hasNext()is called and returns false (seeAnalysisComponentfor details).- Specified by:
processin classJCasAnnotator_ImplBase- Parameters:
aJCas- a JCAS that this AnalysisComponent should process.- Throws:
AnalysisEngineProcessException- if a problem occurs during processing
-
createViewSafely
public static JCas createViewSafely(JCas aJCas, String aViewName) throws AnalysisEngineProcessException Provides a simple call that allows you to safely create a view if it has not been created yet. If the view already exists, it is ok to call this method anyways without worrying about checking for this yet.- Parameters:
aJCas- theJCasto create the view inaViewName- the name of the new view- Returns:
- true if the view was created as a result of calling this method. false if the view already existed.
- Throws:
AnalysisEngineProcessException- if the view could not be created or if an existing view with the given name could not be accessed
-