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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

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

 

uv3 fs iteration design

Translations of uimaFIT select methods to the new API

select

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

select(JCas, Class<T>)
jcas.select(Token.class)
jcas.select(Token.type)
jcas.select("my.package.Token")
select(FSArray, Class<T>)
myArray.select(Token.class)
 
select(FSList, Class<T>)
myList.select(Token.class)
selectAll

Convenience method to iterator over all features structures.

selectAll(JCas)
jcas.select()
selectAt

Get all annotations of the given type at the specified offsets.

selectAt(JCas, Class<T>, int, int)
jcas.select(Token.class).at(begin, end)
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)
jcas.select(Token.class).between(fs1, fs2) // might make more sense because we are using offsets, not index positions
jcas.select(Token.class).startAt(fs1).endAt(fs2) // this looks more like index positions...
 
selectByIndex
selectByIndex(JCas, Class<T>, int)
jcas.select(Token.class).at(indexPosition)
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.

selectCovered(Class<T>, AnnotationFS)

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

selectCovered(JCas, Class<T>, AnnotationFS)
jcas.select(Token.class).within(contextAnnotation)
selectCovered(JCas, Class<T>, int, int)
jcas.select(Token.class).within(1,3)
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)
 jcas.select(Token.class).containing(contextAnnotation) 
selectCovering(JCas, Class<T>, int, int)
 jcas.select(Token.class).containing(1,3) 
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)
 jcas.select(Token.class).startAt(contextAnnotation).limit(10)
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)
jcas.select(Token.class).startAt(contextAnnotation).reverse().limit(10)
jcas.select(Token.class).startAt(contextAnnotation).limit(-10)
selectSingle

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

selectSingle(JCas, Class<T>)
jcas.select(DocumentMetaData.class).single()
selectSingleAt

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

selectSingleAt(JCas, Class<T>, int, int)
 jcas.select(Token.class).at(begin end).single()
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)
jcas.select(Token.class).startAt(contextAnnotation).skip(10).single()
jcas.select(Token.class).startAt(contextAnnotation).reverse().skip(10).single()
jcas.select(Token.class).startAt(contextAnnotation).skip(-10).sinple()
  • No labels