You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by GATE User <ga...@ymail.com> on 2013/07/10 23:28:44 UTC

Iterator through the Annotations in a CAS

I am writing the EntityProcessComplete(CAS, EntityProcessStatus) part of the callback listener to be fed to a UIMA client.  I want to interate through all the view, sofas, and annotations in the CAS that is returned.

I use cas.getViewIterator() and interate through all the views.  For each few, I extract the sofafs with view.getSofa().  How would I get all annotations associated with that view and iterate over them?  Do I use cas.getAnnotationIndex().iterator and cast each AnnotationFS as an Annotation?  With this method, am I only accessing the annotations associated with a view?  Thanks in advance.

Re: Iterator through the Annotations in a CAS

Posted by Marshall Schor <ms...@schor.com>.
On 7/10/2013 5:28 PM, GATE User wrote:
> I am writing the EntityProcessComplete(CAS, EntityProcessStatus) part of the callback listener to be fed to a UIMA client.  I want to interate through all the view, sofas, and annotations in the CAS that is returned.
>
> I use cas.getViewIterator() and interate through all the views.  For each few, I extract the sofafs with view.getSofa().  How would I get all annotations associated with that view and iterate over them?  Do I use cas.getAnnotationIndex().iterator and cast each AnnotationFS as an Annotation?  
Yes.
> With this method, am I only accessing the annotations associated with a view?
Yes.
>   Thanks in advance.
There is also a method on the index repository to get an iterator over all
indexed Feature Structures - see getAllIndexedFS.  This would pick up indexed
FS's that were not subtypes of Annotation.  This is also specific to one view.

HTH.  -Marshall