Child pages
  • UV3 Iterator support
Skip to end of metadata
Go to start of metadata

This page describes additional UIMA Version 3 iterator support for accessing Feature Structures.  It draws on the uimaFIT design, with these goals:

  • uniformity (ease of learning)
  • conciseness (in expression)
  • alignment with / exploitation of Java 8 styles, including streams
  • hiding implementation internals

PDF of chapter on select documentation for review

This is the version 2 after incorporating most of Richard's suggestions on version 1, uploaded Monday 17 Oct at 3:45 EDT.

Here: uima_v3_users_guide.pdf

Conceptual overview MS

uv3 fs iteration design

Translations of uimaFIT select methods to the new API

Format: the samples not in a box are uimaFIT styles; in the boxes are possible new API styles (sometimes multiples), with some commentary.

select

Convenience method to iterator over all features structures of a given type.

select(JCas, Class<T>)
select(FSArray, Class<T>)
select(FSList, Class<T>
myIndex.select(FSList, Class<T>
selectAll

Convenience method to iterate over all features structures indexed in a particular index in a particular view. 
(.allViews()) not part of uimaFIT). 

selectAll(JCas)
selectAt

Get all annotations of the given type at the specified offsets, i.e. all annotations with exactly the given start and end offset.

MS: Does this mean covered-by (limit the FSs returned) or startAt - no limit?

REC: It does not mean covered-by because only annotations at the exact specified offset are returned. If there are multiple annotations at the given offset, then all of the specified type are returned.

selectAt(JCas, Class<T>, int, int)
selectBetween

Get a list of annotations of the given annotation type located between two annotations. Does not use subiterators and does not respect type priorities. Zero-width annotations what lie on the borders are included in the result, e.g. if the boundary annotations are [1..2] and [2..3] then an annotation [2..2] is returned. If there is a non-zero overlap between the boundary annotations, the result is empty. The method properly handles cases where the second boundary annotations occurs before the first boundary annotation by switching their roles.

selectBetween(Class<T>, AnnotationFS, AnnotationFS)

Example same as selectBetween(JCas, Class<T>, AnnotationFS, AnnotationFS) below unless we introduce a static method.

selectBetween(JCas, Class<T>, AnnotationFS, AnnotationFS)
selectByIndex
selectByIndex(JCas, Class<T>, int)
selectCovered

Get a list of annotations of the given annotation type constrained by a 'covering' annotation. Iterates over all annotations of the given type to find the covered annotations. Does not use subiterators.

The covering annotation is never returned itself, even if it is of the queried-for type or a subtype of that type.
 

MS: Not sure why this is special-cased?

REC: Because the covering annotation itself would always be included in the result and it is almost never needed. So handling it specifically (since we already know it) is easier than tediously filtering it out from the result in 99.9% of the cases.

MS: Good point.  Just for completeness, I'll point out a somewhat surprising fact that the covering annotation is not always included; it is only returned if

  • it is in the index 
  • it's type is the index's type or subtype.
  • You can make annotations that don't fit these criteria, and use them as "covering" spec.
selectCovered(Class<T>, AnnotationFS)

Same as selectCovered(JCas, Class<T>, AnnotationFS) below unless we introduce a static method.

selectCovered(JCas, Class<T>, AnnotationFS)
selectCovered(JCas, Class<T>, int, int)
selectCovering

Get a list of annotations of the given annotation type constraint by a certain annotation. Iterates over all annotations to find the covering annotations.

selectCovering(Class<T>, AnnotationFS)

Same as selectCovering(JCas, Class<T>, AnnotationFS) below unless we introduce a static method.

selectCovering(JCas, Class<T>, AnnotationFS)
selectCovering(JCas, Class<T>, int, int)
selectFollowing

Returns the n annotations following the given annotation.

selectFollowing(Class<T>, AnnotationFS, int)

Same as selectFollowing(JCas, Class<T>, AnnotationFS, int) below unless we introduce a static method.

selectFollowing(JCas, Class<T>, AnnotationFS, int)

REC: I would put the context to the front and the conditions to the back...

selectPreceding

Returns the n annotations preceding the given annotation.

selectPreceding(Class<T>, AnnotationFS, int)

Same as selectPreceding(JCas, Class<T>, AnnotationFS, int) below unless we introduce a static method.

selectPreceding(JCas, Class<T>, AnnotationFS, int)
selectSingle

Get the single instance of the specified type from the JCas.

selectSingle(JCas, Class<T>)
selectSingleAt

Get a single annotations of the given type at the specified offsets.

selectSingleAt(JCas, Class<T>, int, int)
selectSingleRelative

Return an annotation preceding or following of a given reference annotation.

selectSingleRelative(Class<T>, AnnotationFS, int)

Same as selectSingleRelative(JCas, Class<T>, AnnotationFS, int) below unless we introduce a static method.

selectSingleRelative(JCas, Class<T>, AnnotationFS, int)
  • No labels