Utility class for doing deep copies of FeatureStructures from one CAS to another. To handle cases
where the source CAS has multiple references to the same FS, you can create one instance of
CasCopier and use it to copy multiple FeatureStructures. The CasCopier will remember previously
copied FeatureStructures, so if you later copy another FS that has a reference to a previously
copied FS, it will not duplicate the multiply-referenced FS.
public CasCopier(org.apache.uima.cas.CAS aSrcCas,
Creates a new CasCopier that can be used to copy FeatureStructures from one CAS to another.
Note that if you are merging data from multiple CASes, you must create a new CasCopier for
each source CAS.
aSrcCas - the CAS to copy from.
aDestCas - the CAS to copy into.
public static void copyCas(org.apache.uima.cas.CAS aSrcCas,
Does a complete deep copy of one CAS into another CAS. The contents of each view in the
source CAS will be copied to the same-named view in the destination CAS. If the view does not
already exist it will be created. All FeatureStructures that are indexed in a view in the
source CAS will become indexed in the same-named view in the destination CAS.
aSrcCas - the CAS to copy from
aDestCas - the CAS to copy to
aCopySofa - if true, the sofa data and mimeType of each view will be copied. If false they
public void copyCasView(org.apache.uima.cas.CAS aSrcCasView,
Does a deep copy of the contents of one CAS View into another CAS. If a view with the same
name as aSrcCasView exists in the destination CAS, then it will be the target of
the copy. Otherwise, a new view will be created with that name and will become the target of
the copy. All FeatureStructures that are indexed in the source CAS view will become indexed
in the target view.
aSrcCasView - the CAS to copy from
aCopySofa - if true, the sofa data and mimeType will be copied. If false they will not.
public org.apache.uima.cas.FeatureStructure copyFs(org.apache.uima.cas.FeatureStructure aFS)
Copies an FS from the source CAS to the destination CAS. Also copies any referenced FS,
except that previously copied FS will not be copied again.
aFS - the FS to copy. Must be contained within the source CAS.
the copy of aFS in the target CAS.
public boolean alreadyCopied(org.apache.uima.cas.FeatureStructure aFS)
Returns whether the given FS has already been copied using this CasCopier.
aFS - a feature structure.
if the FS has already been copied.
public List<org.apache.uima.jcas.tcas.Annotation> batchCopyAnnotations(List<org.apache.uima.jcas.tcas.Annotation> annoList)
Performs batch-copying of Annotations (could also be generalized to FeatureStructures)
While copying the annotations, the whole batch is held in a class attribute. This way, we can
cope with referenced annotations that have not been copied/recovered yet.
annoList - the list of annotations that is to be batch-copied