[
https://issues.apache.org/jira/browse/UIMA-2830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13639635#comment-13639635
]
Richard Eckart de Castilho commented on UIMA-2830:
--------------------------------------------------
Just to point out why an FSIndex is not available easily when the type to be
selected is not an annotation type:
{code}
if (ts.subsumes(cas.getAnnotationType(), type)) {
// cas.getAnnotationIndex returns an AnnotationIndex
return (AnnotationCollection) create(cas.getAnnotationIndex(type));
} else {
// getAllIndexFS returns an FSIterator over all indexes for that type
// getIndex(name) would require an index name and does not return everything
return create(cas.getIndexRepository().getAllIndexedFS(type));
}
{code}
> Expose FSIterator via (J)CasUtil.select*() methods where applicable
> -------------------------------------------------------------------
>
> Key: UIMA-2830
> URL: https://issues.apache.org/jira/browse/UIMA-2830
> Project: UIMA
> Issue Type: Improvement
> Components: uimaFIT
> Reporter: Richard Eckart de Castilho
> Assignee: Richard Eckart de Castilho
> Priority: Minor
> Fix For: 2.0.0uimaFIT
>
>
> Some of the uimaFIT (J)CasUtil "select" methods work directly on an FSIndex
> or FSIterator. In those cases, it would be nice if the methods didn't just
> return a Collection, but some FSCollection<T> in which the iterator() method
> returns an FSIterator<T>.
> At least in those cases were an AnnotationIndex is used, it would be possible
> to actually return something that implements Collection<T> and FSIndex<T>, so
> it can be used in constructors like new ArrayList(...), in modern-style for
> loops, and for type-save access to the index.
> In those cases were an FSIterator is used because the type searched for is
> not an annotation, the FSIndex<T> interface is not a good choice, because it
> contains several methods that cannot be implemented based only on FSIterator.
> So maybe two interfaces: FSCollection<T> based on FSIterator and
> AnnotationCollection<T> based on FSIndex/AnnotationIndex.
> This mainly exposes more details of UIMA AnnotationIndex via CasUtil.
> JCasUtil's select method doesn't make a different between FSes that inherit
> from AnnotationFS or not. Here, the only benefit is getting access to an
> FSIterator.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira