Package org.apache.uima.fit.component
Class ViewCreatorAnnotator
java.lang.Object
org.apache.uima.analysis_component.AnalysisComponent_ImplBase
org.apache.uima.analysis_component.Annotator_ImplBase
org.apache.uima.analysis_component.JCasAnnotator_ImplBase
org.apache.uima.fit.component.JCasAnnotator_ImplBase
org.apache.uima.fit.component.ViewCreatorAnnotator
- All Implemented Interfaces:
org.apache.uima.analysis_component.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
Modifier and TypeFieldDescriptionstatic final String
The parameter name for the name of the viewed to be created by this annotator -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.uima.jcas.JCas
createViewSafely
(org.apache.uima.jcas.JCas aJCas, String aViewName) Provides a simple call that allows you to safely create a view if it has not been created yet.void
process
(org.apache.uima.jcas.JCas aJCas) Methods inherited from class org.apache.uima.fit.component.JCasAnnotator_ImplBase
initialize
Methods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase
getRequiredCasInterface, process
Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase
getCasInstancesRequired, hasNext, next
Methods 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
public void process(org.apache.uima.jcas.JCas aJCas) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException - Specified by:
process
in classorg.apache.uima.analysis_component.JCasAnnotator_ImplBase
- Throws:
org.apache.uima.analysis_engine.AnalysisEngineProcessException
-
createViewSafely
public static org.apache.uima.jcas.JCas createViewSafely(org.apache.uima.jcas.JCas aJCas, String aViewName) throws org.apache.uima.analysis_engine.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
- theJCas
to 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:
org.apache.uima.analysis_engine.AnalysisEngineProcessException
- if the view could not be created or if an existing view with the given name could not be accessed
-