Hi Eddie.

Eddie Epstein wrote:

For a class that just copies from one view to another, you should be able to easily avoid the use of low-level methods.

Great, but how? I tried using the clone() method of the feature structure I wanted to copy, but that creates a feature structure that's associated with the original view, and I can't see how to modify it to be associated with the new one. Say I'm copying from view1 to view2. If call setBegin() and setEnd() on the cloned FeatureStructure, and then call addToIndexes() with no arguments, that adds it to the index of view1, which is not what I want. If I call addToIndexes(view2), I get: org.apache.uima.cas.CASRuntimeException: Error - the Annotation "Token ..." is over view "view1" and cannot be added to indexes associated with the different view "view2".

Note that one of the main features of this method, supporting deep copies with shared FS (FS that are referenced multiple times) may not be needed in your case. An FS in the CAS can be referenced from any view.

Agreed. If CasCopier had worked I would have lived with its behavior, but in fact it would be preferable to share non-Annotation FeatureStructures between views rather than copying them from one to the other.

-Aaron

Reply via email to