Modifier and Type | Field and Description |
---|---|
static String |
UIMA_BUILTIN_JCAS_PREFIX
Package name of JCas wrapper classes built into UIMA.
|
Modifier and Type | Method and Description |
---|---|
static <T extends TOP> |
exists(CAS aCas,
Type aType)
Test if a CAS contains an annotation of the given type.
|
static Type |
getAnnotationType(CAS aCas,
Class<?> aJCasClass)
Get the CAS type for the given JCas wrapper class making sure it is or inherits from
Annotation . |
static Type |
getAnnotationType(CAS aCas,
String aTypeName)
Get the CAS type for the given name making sure it is or inherits from Annotation.
|
static Type |
getType(CAS cas,
Class<?> type)
Get the CAS type for the given JCas wrapper class.
|
static Type |
getType(CAS aCas,
String aTypename)
Get the CAS type for the given name.
|
static CAS |
getView(CAS cas,
String viewName,
boolean create)
Convenience method to get the specified view or create a new view if the requested view does
not exist.
|
static CAS |
getView(CAS cas,
String viewName,
CAS fallback)
Convenience method to get the specified view or a default view if the requested view does not
exist.
|
static Map<AnnotationFS,List<AnnotationFS>> |
indexCovered(CAS cas,
Type type,
Type coveredType)
Create an index for quickly lookup up the annotations covered by a particular annotation.
|
static Map<AnnotationFS,List<AnnotationFS>> |
indexCovering(CAS cas,
Type type,
Type coveringType)
Create an index for quickly lookup up the annotations covering a particular annotation.
|
static boolean |
isAnnotationType(CAS aCas,
Type aType) |
static <T extends AnnotationFS> |
iterator(CAS cas,
Type type)
Get an iterator over the given annotation type.
|
static <T extends FeatureStructure> |
iteratorFS(CAS cas,
Type type)
Deprecated.
Use
cas.select(type).iterator() |
static void |
requireAnnotationType(CAS aCas,
Type aType) |
static List<AnnotationFS> |
select(ArrayFS array,
Type type)
Convenience method to iterator over all annotations of a given type.
|
static Collection<AnnotationFS> |
select(CAS cas,
Type type)
Convenience method to iterator over all annotations of a given type.
|
static Collection<AnnotationFS> |
selectAll(CAS aCas)
Convenience method to iterator over all annotations.
|
static Collection<FeatureStructure> |
selectAllFS(CAS aCas)
Convenience method to iterator over all features structures.
|
static List<AnnotationFS> |
selectAt(CAS aCas,
Type aType,
int aBegin,
int aEnd)
Get all annotations of the given type at the specified offsets.
|
static List<AnnotationFS> |
selectBetween(CAS cas,
Type type,
AnnotationFS ann1,
AnnotationFS ann2)
Get a list of annotations of the given annotation type located between two annotations.
|
static List<AnnotationFS> |
selectBetween(Type type,
AnnotationFS ann1,
AnnotationFS ann2)
Get a list of annotations of the given annotation type located between two annotations.
|
static AnnotationFS |
selectByIndex(CAS cas,
Type type,
int index)
This method exists simply as a convenience method for unit testing.
|
static List<AnnotationFS> |
selectCovered(CAS cas,
Type type,
AnnotationFS coveringAnnotation)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static List<AnnotationFS> |
selectCovered(CAS cas,
Type type,
int begin,
int end)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static List<AnnotationFS> |
selectCovered(Type type,
AnnotationFS coveringAnnotation)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static List<AnnotationFS> |
selectCovering(CAS cas,
Type type,
AnnotationFS coveredAnnotation)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static List<AnnotationFS> |
selectCovering(CAS cas,
Type type,
int begin,
int end)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static List<AnnotationFS> |
selectCovering(Type type,
AnnotationFS coveredAnnotation)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static List<AnnotationFS> |
selectFollowing(CAS cas,
Type type,
AnnotationFS anchor,
int count)
Returns the n annotations following the given annotation
|
static List<FeatureStructure> |
selectFS(ArrayFS array,
Type type)
Convenience method to iterator over all feature structures of a given type.
|
static <T extends FeatureStructure> |
selectFS(CAS cas,
Type type)
Deprecated.
Use
cas.select(type).asList() |
static List<AnnotationFS> |
selectOverlapping(CAS aCas,
Type aType,
AnnotationFS aBoundaryAnnotation)
Get a list of annotations of the given annotation type overlapping the given annotation.
|
static List<AnnotationFS> |
selectOverlapping(CAS aCas,
Type aType,
int aSelBegin,
int aSelEnd)
Get a list of annotations of the given annotation type overlapping the given span.
|
static List<AnnotationFS> |
selectOverlapping(Type aType,
AnnotationFS aBoundaryAnnotation)
Get a list of annotations of the given annotation type overlapping the given annotation.
|
static List<AnnotationFS> |
selectPreceding(CAS cas,
Type type,
AnnotationFS anchor,
int count)
Returns the n annotations preceding the given annotation
|
static AnnotationFS |
selectSingle(CAS cas,
Type type)
Get the single instance of the specified type from the CAS.
|
static AnnotationFS |
selectSingleAt(CAS aCas,
Type aType,
int aBegin,
int aEnd)
Get the single instance of the specified type from the CAS at the given offsets.
|
static FeatureStructure |
selectSingleFS(CAS cas,
Type type)
Get the single instance of the specified type from the CAS.
|
static AnnotationFS |
selectSingleRelative(CAS cas,
Type type,
AnnotationFS aAnchor,
int aPosition)
Return an annotation preceding or following of a given reference annotation.
|
static AnnotationFS |
selectSingleRelative(Type type,
AnnotationFS annotation,
int index)
Return an annotation preceding or following of a given reference annotation.
|
static <T extends AnnotationFS> |
toText(Iterable<T> iterable)
Fetch the text covered by the specified annotations and return it as a list of strings.
|
static <T extends AnnotationFS> |
toText(Iterator<T> iterator)
Fetch the text covered by the specified annotations and return it as a list of strings.
|
public static final String UIMA_BUILTIN_JCAS_PREFIX
@Deprecated public static <T extends FeatureStructure> Iterator<T> iteratorFS(CAS cas, Type type)
cas.select(type).iterator()
T
- the JCas type.cas
- a CAS.type
- a type.public static <T extends AnnotationFS> Iterator<T> iterator(CAS cas, Type type)
T
- the JCas type.cas
- a CAS.type
- a type.public static Type getType(CAS cas, Class<?> type)
cas
- the CAS hosting the type system.type
- the JCas wrapper class.public static Type getType(CAS aCas, String aTypename)
aCas
- the CAS hosting the type system.aTypename
- the fully qualified type name.public static Type getAnnotationType(CAS aCas, Class<?> aJCasClass)
Annotation
.aCas
- the CAS hosting the type system.aJCasClass
- the JCas wrapper class.public static Type getAnnotationType(CAS aCas, String aTypeName)
aCas
- the CAS hosting the type system.aTypeName
- the fully qualified type name.public static List<FeatureStructure> selectFS(ArrayFS array, Type type)
array
- features structure array.type
- the type.public static List<AnnotationFS> select(ArrayFS array, Type type)
array
- features structure array.type
- the type.public static Collection<FeatureStructure> selectAllFS(CAS aCas)
aCas
- the CAS hosting the type system.@Deprecated public static <T extends FeatureStructure> List<T> selectFS(CAS cas, Type type)
cas.select(type).asList()
cas
- the CAS containing the type system.type
- the type.public static Collection<AnnotationFS> selectAll(CAS aCas)
aCas
- the CAS hosting the type system.public static Collection<AnnotationFS> select(CAS cas, Type type)
cas
- the CAS containing the type system.type
- the type.public static List<AnnotationFS> selectAt(CAS aCas, Type aType, int aBegin, int aEnd)
aCas
- the CAS containing the annotations.aType
- the type of annotations to fetch.aBegin
- the begin offset.aEnd
- the end offset.public static AnnotationFS selectSingleAt(CAS aCas, Type aType, int aBegin, int aEnd)
aCas
- the CAS containing the annotations.aType
- the type of annotations to fetch.aBegin
- the begin offset.aEnd
- the end offset.public static List<AnnotationFS> selectBetween(Type type, AnnotationFS ann1, AnnotationFS ann2)
type
- a UIMA type.ann1
- the first boundary annotation.ann2
- the second boundary annotation.Subiterator
,
Order of selected feature structurespublic static List<AnnotationFS> selectBetween(CAS cas, Type type, AnnotationFS ann1, AnnotationFS ann2)
cas
- a CAS.type
- a UIMA type.ann1
- the first boundary annotation.ann2
- the second boundary annotation.Subiterator
,
Order of selected feature structurespublic static List<AnnotationFS> selectCovered(Type type, AnnotationFS coveringAnnotation)
Subiterator
. Uses
the same approach except that type priorities are ignored.
The covering annotation is never returned itself, even if it is of the queried-for type or a subtype of that type.
The method only returns properly covered annotations, that is annotations where the begin/end offsets are equal to the 'covering' annotation or where both the begin/end are included in the span of the 'covering' annotation. Partially overlapping annotations are not returned.
type
- a UIMA type.coveringAnnotation
- the covering annotation.Subiterator
,
Order of selected feature structurespublic static List<AnnotationFS> selectCovered(CAS cas, Type type, AnnotationFS coveringAnnotation)
Subiterator
. Uses
the same approach except that type priorities are ignored.
The covering annotation is never returned itself, even if it is of the queried-for type or a subtype of that type.
The method only returns properly covered annotations, that is annotations where the begin/end offsets are equal to the 'covering' annotation or where both the begin/end are included in the span of the 'covering' annotation. Partially overlapping annotations are not returned.
cas
- a CAS.type
- a UIMA type.coveringAnnotation
- the covering annotation.Subiterator
,
Order of selected feature structurespublic static List<AnnotationFS> selectCovered(CAS cas, Type type, int begin, int end)
Subiterator
. Uses
the same approach except that type priorities are ignored.
Note: this is significantly slower than using
selectCovered(CAS, Type, AnnotationFS)
. It is possible to use
selectCovered(cas, type, new Annotation(jCas, int, int))
, but that will allocate memory
in the jCas for the new annotation. If you do that repeatedly many times, memory may fill up.
The method only returns properly covered annotations, that is annotations where the begin/end offsets are equal to the given begin/end or where both the begin/end are included in the span of the given span. Partially overlapping annotations are not returned.
cas
- a CAS.type
- a UIMA type.begin
- begin offset.end
- end offset.Subiterator
,
Order of selected feature structurespublic static List<AnnotationFS> selectCovering(Type type, AnnotationFS coveredAnnotation)
The method only returns properly covering annotations, that is annotations where the begin/end offsets are equal to the begin/end of the given annotation or where given 'covered' annotation is properly contained within the span of the 'covering' annotation. Partially overlapping annotations are not returned.
Note: this is REALLY SLOW! You don't want to use this. Instead, consider using
indexCovering(CAS, Type, Type)
or a ContainmentIndex
.
type
- a UIMA type.coveredAnnotation
- the covered annotation.public static List<AnnotationFS> selectCovering(CAS cas, Type type, AnnotationFS coveredAnnotation)
The method only returns properly covering annotations, that is annotations where the begin/end offsets are equal to the begin/end of the given annotation or where given 'covered' annotation is properly contained within the span of the 'covering' annotation. Partially overlapping annotations are not returned.
Note: this is REALLY SLOW! You don't want to use this. Instead, consider using
indexCovering(CAS, Type, Type)
or a ContainmentIndex
.
cas
- a CAS.type
- a UIMA type.coveredAnnotation
- the covered annotation.public static List<AnnotationFS> selectCovering(CAS cas, Type type, int begin, int end)
The method only returns properly covering annotations, that is annotations where the begin/end offsets are equal to the given begin/end to or where given span is properly contained within the span of the 'covering' annotation. Partially overlapping annotations are not returned.
Note: this is REALLY SLOW! You don't want to use this. Instead, consider using
indexCovering(CAS, Type, Type)
or a ContainmentIndex
.
cas
- a CAS.type
- a UIMA type.begin
- begin offset.end
- end offset.public static Map<AnnotationFS,List<AnnotationFS>> indexCovering(CAS cas, Type type, Type coveringType)
selectCovering(CAS, Type, int, int)
because the overhead of
scanning the CAS occurs only when the index is build. Subsequent lookups to the index are fast.
The method only returns properly covering annotations, that is annotations where the begin/end offsets are equal to the begin/end of the given annotation or where given 'covered' annotation is properly contained within the span of the 'covering' annotation. Partially overlapping annotations are not returned.
When querying for the annotations covering a given annotation, the given annotation itself is never returned, even if it is of the queried type.
cas
- a CAS.type
- type to create the index for - this is used in lookups.coveringType
- type of covering annotations.public static Map<AnnotationFS,List<AnnotationFS>> indexCovered(CAS cas, Type type, Type coveredType)
selectCovered(CAS, Type, int, int)
because the overhead of
scanning the CAS occurs only when the index is build. Subsequent lookups to the index are fast.
The order of entries in the map is not defined. However, lists of covered annotations in
the map are guaranteed to be in the same order as in the UIMA default annotation index.
The method only returns properly covered annotations, that is annotations where the begin/end offsets are equal to the 'covering' annotation or where both the begin/end are included in the span of the 'covering' annotation. Partially overlapping annotations are not returned.
When querying for the annotations covered by a given annotation, the given annotation itself is never returned, even if it is of the queried type. *
cas
- a CAS.type
- type to create the index for - this is used in lookups.coveredType
- type of covering annotations.public static List<AnnotationFS> selectOverlapping(Type aType, AnnotationFS aBoundaryAnnotation)
aType
- a UIMA type.aBoundaryAnnotation
- the covering annotation.public static List<AnnotationFS> selectOverlapping(CAS aCas, Type aType, AnnotationFS aBoundaryAnnotation)
aCas
- a CAS.aType
- a UIMA type.aBoundaryAnnotation
- the covering annotation.public static List<AnnotationFS> selectOverlapping(CAS aCas, Type aType, int aSelBegin, int aSelEnd)
aCas
- a CAS.aType
- a UIMA type.aSelBegin
- begin offset.aSelEnd
- end offset.public static AnnotationFS selectByIndex(CAS cas, Type type, int index)
cas
- a CAS containing the annotation.type
- a UIMA type.index
- this can be either positive (0 corresponds to the first annotation of a type) or
negative (-1 corresponds to the last annotation of a type.)public static AnnotationFS selectSingle(CAS cas, Type type)
cas
- a CAS containing the annotation.type
- a UIMA type.public static FeatureStructure selectSingleFS(CAS cas, Type type)
cas
- a CAS containing the annotation.type
- a UIMA type.public static AnnotationFS selectSingleRelative(Type type, AnnotationFS annotation, int index)
type
- a type.annotation
- anchor annotationindex
- relative position to access. A negative value selects a preceding annotation while a
positive number selects a following annotation.public static AnnotationFS selectSingleRelative(CAS cas, Type type, AnnotationFS aAnchor, int aPosition)
cas
- a CAS containing the annotation.type
- a type.aAnchor
- anchor annotationaPosition
- relative position to access. A negative value selects a preceding annotation while a
positive number selects a following annotation.IndexOutOfBoundsException
- if the relative position points beyond the type index bounds.IllegalArgumentException
- if the relative position is 0
and the anchor type does not subsume the
selected type.public static List<AnnotationFS> selectPreceding(CAS cas, Type type, AnnotationFS anchor, int count)
cas
- a CAS.type
- a UIMA type.anchor
- anchor annotationcount
- number of annotations to collectpublic static List<AnnotationFS> selectFollowing(CAS cas, Type type, AnnotationFS anchor, int count)
cas
- a CAS.type
- a UIMA type.anchor
- anchor annotationcount
- number of annotations to collectpublic static <T extends TOP> boolean exists(CAS aCas, Type aType)
T
- the annotation type.aCas
- a CAS.aType
- a annotation type.true
if there is at least one annotation of the given type in the CAS.public static CAS getView(CAS cas, String viewName, CAS fallback)
null
.cas
- a CASviewName
- the requested view.fallback
- the default view if the requested view does not exist.public static CAS getView(CAS cas, String viewName, boolean create)
cas
- a CASviewName
- the requested view.create
- the view is created if it does not exist.IllegalArgumentException
- if the view does not exist and is not to be created.public static <T extends AnnotationFS> List<String> toText(Iterable<T> iterable)
T
- UIMA JCas type.iterable
- annotation container.public static <T extends AnnotationFS> List<String> toText(Iterator<T> iterator)
T
- UIMA JCas type.iterator
- annotation iterator.Copyright © 2012–2021 The Apache Software Foundation. All rights reserved.