org.apache.uima.cas
Interface CAS

All Superinterfaces:
AbstractCas

public interface CAS
extends AbstractCas

Object-oriented CAS (Common Analysis System) API.

A CAS object provides the starting point for working with the CAS. It provides access to the type system, to indexes, iterators and filters (constraints). It also lets you create new annotations and other data structures. You can create a CAS object using static methods on the class CasCreationUtils.

The CAS object is also the container that manages multiple Subjects of Analysis or Sofas. A Sofa represents some form of an unstructured artifact that is processed in a UIMA pipeline. The Java string called the "DocumentText" used in a UIMA text processing pipeline is an example of a Sofa. A Sofa can be analyzed independently using the standard UIMA programming model or analyzed together with other Sofas utilizing the Sofa programming model extensions.

A Sofa is implemented as a built-in CAS type uima.cas.Sofa. Use CAS.createSofa() to instantiate a Sofa feature structure. The SofaFS class provides methods to set and get the features of a SofaFS. Although Sofas are implemented as standard feature structures, generic CAS APIs must never be used to create Sofas or set their features.

Use getView(String) or getView(SofaFS) to obtain a view of a particular Sofa in the CAS. This view will provide access to the Sofa data (for example the document text) as well as the index repository, which contains metadata (annotations and other feature structures) about that Sofa.

Use getTypeSystem() to access the type system. With a TypeSystem object, you can access the Type and Feature objects for the CAS built-in types. Note that this interface also provides constants for the names of the built-in types and features.


Field Summary
static String DEFAULT_LANGUAGE_NAME
           
static String FEATURE_BASE_NAME_BEGIN
          Base name of annotation begin feature.
static String FEATURE_BASE_NAME_END
          Base name of annotation end feature.
static String FEATURE_BASE_NAME_HEAD
          Base name of list head feature.
static String FEATURE_BASE_NAME_LANGUAGE
          Base name of document language feature.
static String FEATURE_BASE_NAME_SOFA
          Sofa ID feature that is the handle to a text Sofa.
static String FEATURE_BASE_NAME_SOFAARRAY
          Base name of Sofa array fs data feature.
static String FEATURE_BASE_NAME_SOFAID
          Base name of Sofa ID feature.
static String FEATURE_BASE_NAME_SOFAMIME
          Base name of Sofa mime type feature.
static String FEATURE_BASE_NAME_SOFANUM
          Base name of Sofa Number feature.
static String FEATURE_BASE_NAME_SOFASTRING
          Base name of Sofa string data feature.
static String FEATURE_BASE_NAME_SOFAURI
          Base name of Sofa URI feature.
static String FEATURE_BASE_NAME_TAIL
          Base name of list tail feature.
static String FEATURE_FULL_NAME_BEGIN
          Fully qualified name of annotation begin feature.
static String FEATURE_FULL_NAME_END
          Fully qualified name of annotation end feature.
static String FEATURE_FULL_NAME_FLOAT_LIST_HEAD
          Qualified name of float list head feature.
static String FEATURE_FULL_NAME_FLOAT_LIST_TAIL
          Qualified name of float list tail feature.
static String FEATURE_FULL_NAME_FS_LIST_HEAD
          Qualified name of fs list head feature.
static String FEATURE_FULL_NAME_FS_LIST_TAIL
          Qualified name of fs list tail feature.
static String FEATURE_FULL_NAME_INTEGER_LIST_HEAD
          Qualified name of integer list head feature.
static String FEATURE_FULL_NAME_INTEGER_LIST_TAIL
          Qualified name of integer list tail feature.
static String FEATURE_FULL_NAME_LANGUAGE
          Fully qualified name of document language feature.
static String FEATURE_FULL_NAME_SOFA
          Fully qualified name of annotation sofa feature.
static String FEATURE_FULL_NAME_SOFAARRAY
          Qualified name of Sofa array fs data feature.
static String FEATURE_FULL_NAME_SOFAID
          Qualified name of Sofa id feature.
static String FEATURE_FULL_NAME_SOFAMIME
          Qualified name of Sofa mime type feature.
static String FEATURE_FULL_NAME_SOFANUM
          Qualified name of Sofa number feature.
static String FEATURE_FULL_NAME_SOFASTRING
          Qualified name of Sofa string data feature.
static String FEATURE_FULL_NAME_SOFAURI
          Qualified name of Sofa URI feature.
static String FEATURE_FULL_NAME_STRING_LIST_HEAD
          Qualified name of string list head feature.
static String FEATURE_FULL_NAME_STRING_LIST_TAIL
          Qualified name of string list tail feature.
static String NAME_DEFAULT_SOFA
          Sofa name for the initial view's sofa.
static String NAME_DEFAULT_TEXT_SOFA
          Deprecated. As of v2.0, this is replaced by NAME_DEFAULT_SOFA, and the value has changed. In general, user code should not need to refer to this name.
static String NAME_SPACE_UIMA_CAS
          UIMA CAS name space.
static String NAME_SPACE_UIMA_TCAS
          Name of Text CAS name space.
static String SOFA_INDEX_NAME
          Sofa Index name.
static String STD_ANNOTATION_INDEX
          Name of the built-in index on annotations.
static String TYPE_NAME_ANNOTATION
          Name of annotation type.
static String TYPE_NAME_ANNOTATION_BASE
          Name of annotation base type.
static String TYPE_NAME_ARRAY_BASE
          ArrayBase type.
static String TYPE_NAME_BOOLEAN
          Boolean type.
static String TYPE_NAME_BOOLEAN_ARRAY
          Boolean array type.
static String TYPE_NAME_BYTE
          Byte type.
static String TYPE_NAME_BYTE_ARRAY
          Byte array type.
static String TYPE_NAME_DOCUMENT_ANNOTATION
          Name of document annotation type.
static String TYPE_NAME_DOUBLE
          Double type.
static String TYPE_NAME_DOUBLE_ARRAY
          Double array type.
static String TYPE_NAME_EMPTY_FLOAT_LIST
          Empty float type.
static String TYPE_NAME_EMPTY_FS_LIST
          Empty feature structure list type.
static String TYPE_NAME_EMPTY_INTEGER_LIST
          Empty integer list type.
static String TYPE_NAME_EMPTY_STRING_LIST
          Empty string list type.
static String TYPE_NAME_FLOAT
          Float type.
static String TYPE_NAME_FLOAT_ARRAY
          Float array type.
static String TYPE_NAME_FLOAT_LIST
          Float list type.
static String TYPE_NAME_FS_ARRAY
          Feature structure array type.
static String TYPE_NAME_FS_LIST
          Feature structure list type.
static String TYPE_NAME_INTEGER
          Integer type.
static String TYPE_NAME_INTEGER_ARRAY
          Integer array type.
static String TYPE_NAME_INTEGER_LIST
          Integer list type.
static String TYPE_NAME_LIST_BASE
          Abstract list base type.
static String TYPE_NAME_LONG
          Long type.
static String TYPE_NAME_LONG_ARRAY
          Long array type.
static String TYPE_NAME_NON_EMPTY_FLOAT_LIST
          Non-empty float list type.
static String TYPE_NAME_NON_EMPTY_FS_LIST
          Non-empty feature structure list type.
static String TYPE_NAME_NON_EMPTY_INTEGER_LIST
          Non-empty integer list type.
static String TYPE_NAME_NON_EMPTY_STRING_LIST
          Non-empty string list type.
static String TYPE_NAME_SHORT
          Short type.
static String TYPE_NAME_SHORT_ARRAY
          Short array type.
static String TYPE_NAME_SOFA
          Sofa type.
static String TYPE_NAME_STRING
          String type.
static String TYPE_NAME_STRING_ARRAY
          String array type.
static String TYPE_NAME_STRING_LIST
          String list type.
static String TYPE_NAME_TOP
          Top type.
static String UIMA_CAS_PREFIX
          UIMA CAS name space prefix to prepend to type names (adds an extra period to the name space proper.
 
Method Summary
 void addFsToIndexes(FeatureStructure fs)
          Add a feature structure to all appropriate indexes in the repository associated with this CAS View.
 AnnotationFS createAnnotation(Type type, int begin, int end)
          Create a new annotation.
 ArrayFS createArrayFS(int length)
          Create a new feature structure array.
 BooleanArrayFS createBooleanArrayFS(int length)
          Create a new Boolean array.
 ByteArrayFS createByteArrayFS(int length)
          Create a new Byte array.
 DoubleArrayFS createDoubleArrayFS(int length)
          Create a new Double array.
 FeaturePath createFeaturePath()
          Create a feature path.
 FeatureValuePath createFeatureValuePath(String featureValuePath)
          Create a feature-value path from a string.
<T extends FeatureStructure>
FSIterator<T>
createFilteredIterator(FSIterator<T> it, FSMatchConstraint cons)
          Create an iterator over structures satisfying a given constraint.
 FloatArrayFS createFloatArrayFS(int length)
          Create a new int array.
 FeatureStructure createFS(Type type)
          Create a new FeatureStructure.
 IntArrayFS createIntArrayFS(int length)
          Create a new int array.
 LongArrayFS createLongArrayFS(int length)
          Create a new Long array.
 Marker createMarker()
          Sets a mark and returns the marker object set with the current mark which can be used to query when certain FSs were created.
 ShortArrayFS createShortArrayFS(int length)
          Create a new Short array.
 SofaFS createSofa(SofaID sofaID, String mimeType)
          Deprecated. As of v2.0, use createView(String) instead.
 StringArrayFS createStringArrayFS(int length)
          Create a new String array.
 CAS createView(String localViewName)
          Create a view and its underlying Sofa (subject of analysis).
<T extends FeatureStructure>
ListIterator<T>
fs2listIterator(FSIterator<T> it)
          Wrap a standard Java ListIterator around an FSListIterator.
 AnnotationIndex<AnnotationFS> getAnnotationIndex()
          Get the standard annotation index.
 AnnotationIndex<AnnotationFS> getAnnotationIndex(Type type)
          Get the standard annotation index restricted to a specific annotation type.
 Type getAnnotationType()
          Get the type object for the annotation type.
 Feature getBeginFeature()
          Get the feature object for the annotation begin feature.
 ConstraintFactory getConstraintFactory()
          Get a constraint factory.
 CAS getCurrentView()
          Get the Cas view that the current component should use.
 AnnotationFS getDocumentAnnotation()
          Get the document annotation.
 String getDocumentLanguage()
          Gets the language code for this document from the language feature of the special instance of the DocumentationAnnotation associated with this CAS.
 String getDocumentText()
          Get the document text.
 Feature getEndFeature()
          Get the feature object for the annotation end feature.
 FSIndexRepository getIndexRepository()
          Get the index repository.
 JCas getJCas()
          Get the JCas for this CAS.
 JCas getJCas(SofaFS aSofa)
          Create a JCas view for a Sofa.
 JCas getJCas(SofaID aSofaID)
          Deprecated. As of v2.0, use getView(String) followed by getJCas().
 org.apache.uima.cas.impl.LowLevelCAS getLowLevelCAS()
          Get an instance of the low-level CAS.
 SofaFS getSofa()
          Get the Sofa feature structure associated with this CAS view.
 SofaFS getSofa(SofaID sofaID)
          Deprecated. As of v2.0, use {#getView(String)}. From the view you can access the Sofa data, or call getSofa() if you truly need to access the SofaFS object.
 FeatureStructure getSofaDataArray()
          Get the Sofa data array.
 InputStream getSofaDataStream()
          Get the Sofa data as a byte stream.
 String getSofaDataString()
          Get the Sofa Data String (a.k.a.
 String getSofaDataURI()
          Get the Sofa data array.
 FSIterator<SofaFS> getSofaIterator()
          Get iterator for all SofaFS in the CAS.
 String getSofaMimeType()
          Get the mime type of the Sofa data being analyzed.
 TypeSystem getTypeSystem()
          Return the type system of this CAS instance.
 CAS getView(SofaFS aSofa)
          Get the view for a Sofa (subject of analysis).
 CAS getView(String localViewName)
          Get the view for a Sofa (subject of analysis).
 Iterator<CAS> getViewIterator()
          Get iterator over all views in this CAS.
 Iterator<CAS> getViewIterator(String localViewNamePrefix)
          Get iterator over all views with the given name prefix.
 String getViewName()
          Get the view name.
 void removeFsFromIndexes(FeatureStructure fs)
          Remove a feature structure from all indexes in the repository associated with this CAS View.
 void reset()
          Reset the CAS, emptying it of all content.
 void setCurrentComponentInfo(ComponentInfo info)
          Informs the CAS of relevant information about the component that is currently procesing it.
 void setDocumentLanguage(String languageCode)
          Sets the language for this document.
 void setDocumentText(String text)
          Set the document text.
 void setSofaDataArray(FeatureStructure array, String mime)
          Set the Sofa data as an ArrayFS.
 void setSofaDataString(String text, String mimetype)
          Set the document text.
 void setSofaDataURI(String uri, String mime)
          Set the Sofa data as a URI.
 int size()
          Estimate the memory consumption of this CAS instance (in bytes).
 
Methods inherited from interface org.apache.uima.cas.AbstractCas
release
 

Field Detail

NAME_SPACE_UIMA_CAS

static final String NAME_SPACE_UIMA_CAS
UIMA CAS name space.

See Also:
Constant Field Values

UIMA_CAS_PREFIX

static final String UIMA_CAS_PREFIX
UIMA CAS name space prefix to prepend to type names (adds an extra period to the name space proper.

See Also:
Constant Field Values

TYPE_NAME_TOP

static final String TYPE_NAME_TOP
Top type.

See Also:
Constant Field Values

TYPE_NAME_INTEGER

static final String TYPE_NAME_INTEGER
Integer type.

See Also:
Constant Field Values

TYPE_NAME_FLOAT

static final String TYPE_NAME_FLOAT
Float type.

See Also:
Constant Field Values

TYPE_NAME_STRING

static final String TYPE_NAME_STRING
String type.

See Also:
Constant Field Values

TYPE_NAME_BOOLEAN

static final String TYPE_NAME_BOOLEAN
Boolean type.

See Also:
Constant Field Values

TYPE_NAME_BYTE

static final String TYPE_NAME_BYTE
Byte type.

See Also:
Constant Field Values

TYPE_NAME_SHORT

static final String TYPE_NAME_SHORT
Short type.

See Also:
Constant Field Values

TYPE_NAME_LONG

static final String TYPE_NAME_LONG
Long type.

See Also:
Constant Field Values

TYPE_NAME_DOUBLE

static final String TYPE_NAME_DOUBLE
Double type.

See Also:
Constant Field Values

TYPE_NAME_ARRAY_BASE

static final String TYPE_NAME_ARRAY_BASE
ArrayBase type.

See Also:
Constant Field Values

TYPE_NAME_FS_ARRAY

static final String TYPE_NAME_FS_ARRAY
Feature structure array type.

See Also:
Constant Field Values

TYPE_NAME_INTEGER_ARRAY

static final String TYPE_NAME_INTEGER_ARRAY
Integer array type.

See Also:
Constant Field Values

TYPE_NAME_FLOAT_ARRAY

static final String TYPE_NAME_FLOAT_ARRAY
Float array type.

See Also:
Constant Field Values

TYPE_NAME_STRING_ARRAY

static final String TYPE_NAME_STRING_ARRAY
String array type.

See Also:
Constant Field Values

TYPE_NAME_BOOLEAN_ARRAY

static final String TYPE_NAME_BOOLEAN_ARRAY
Boolean array type.

See Also:
Constant Field Values

TYPE_NAME_BYTE_ARRAY

static final String TYPE_NAME_BYTE_ARRAY
Byte array type.

See Also:
Constant Field Values

TYPE_NAME_SHORT_ARRAY

static final String TYPE_NAME_SHORT_ARRAY
Short array type.

See Also:
Constant Field Values

TYPE_NAME_LONG_ARRAY

static final String TYPE_NAME_LONG_ARRAY
Long array type.

See Also:
Constant Field Values

TYPE_NAME_DOUBLE_ARRAY

static final String TYPE_NAME_DOUBLE_ARRAY
Double array type.

See Also:
Constant Field Values

TYPE_NAME_SOFA

static final String TYPE_NAME_SOFA
Sofa type.

See Also:
Constant Field Values

TYPE_NAME_ANNOTATION_BASE

static final String TYPE_NAME_ANNOTATION_BASE
Name of annotation base type.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFANUM

static final String FEATURE_BASE_NAME_SOFANUM
Base name of Sofa Number feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFAID

static final String FEATURE_BASE_NAME_SOFAID
Base name of Sofa ID feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFAMIME

static final String FEATURE_BASE_NAME_SOFAMIME
Base name of Sofa mime type feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFAURI

static final String FEATURE_BASE_NAME_SOFAURI
Base name of Sofa URI feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFASTRING

static final String FEATURE_BASE_NAME_SOFASTRING
Base name of Sofa string data feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFAARRAY

static final String FEATURE_BASE_NAME_SOFAARRAY
Base name of Sofa array fs data feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFANUM

static final String FEATURE_FULL_NAME_SOFANUM
Qualified name of Sofa number feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFAID

static final String FEATURE_FULL_NAME_SOFAID
Qualified name of Sofa id feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFAMIME

static final String FEATURE_FULL_NAME_SOFAMIME
Qualified name of Sofa mime type feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFAURI

static final String FEATURE_FULL_NAME_SOFAURI
Qualified name of Sofa URI feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFASTRING

static final String FEATURE_FULL_NAME_SOFASTRING
Qualified name of Sofa string data feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFAARRAY

static final String FEATURE_FULL_NAME_SOFAARRAY
Qualified name of Sofa array fs data feature.

See Also:
Constant Field Values

SOFA_INDEX_NAME

static final String SOFA_INDEX_NAME
Sofa Index name.

See Also:
Constant Field Values

NAME_DEFAULT_TEXT_SOFA

@Deprecated
static final String NAME_DEFAULT_TEXT_SOFA
Deprecated. As of v2.0, this is replaced by NAME_DEFAULT_SOFA, and the value has changed. In general, user code should not need to refer to this name.
Sofa name for the default text sofa.

See Also:
Constant Field Values

NAME_DEFAULT_SOFA

static final String NAME_DEFAULT_SOFA
Sofa name for the initial view's sofa.

See Also:
Constant Field Values

TYPE_NAME_LIST_BASE

static final String TYPE_NAME_LIST_BASE
Abstract list base type.

See Also:
Constant Field Values

TYPE_NAME_FS_LIST

static final String TYPE_NAME_FS_LIST
Feature structure list type.

See Also:
Constant Field Values

TYPE_NAME_NON_EMPTY_FS_LIST

static final String TYPE_NAME_NON_EMPTY_FS_LIST
Non-empty feature structure list type.

See Also:
Constant Field Values

TYPE_NAME_EMPTY_FS_LIST

static final String TYPE_NAME_EMPTY_FS_LIST
Empty feature structure list type.

See Also:
Constant Field Values

TYPE_NAME_INTEGER_LIST

static final String TYPE_NAME_INTEGER_LIST
Integer list type.

See Also:
Constant Field Values

TYPE_NAME_NON_EMPTY_INTEGER_LIST

static final String TYPE_NAME_NON_EMPTY_INTEGER_LIST
Non-empty integer list type.

See Also:
Constant Field Values

TYPE_NAME_EMPTY_INTEGER_LIST

static final String TYPE_NAME_EMPTY_INTEGER_LIST
Empty integer list type.

See Also:
Constant Field Values

TYPE_NAME_FLOAT_LIST

static final String TYPE_NAME_FLOAT_LIST
Float list type.

See Also:
Constant Field Values

TYPE_NAME_NON_EMPTY_FLOAT_LIST

static final String TYPE_NAME_NON_EMPTY_FLOAT_LIST
Non-empty float list type.

See Also:
Constant Field Values

TYPE_NAME_EMPTY_FLOAT_LIST

static final String TYPE_NAME_EMPTY_FLOAT_LIST
Empty float type.

See Also:
Constant Field Values

TYPE_NAME_STRING_LIST

static final String TYPE_NAME_STRING_LIST
String list type.

See Also:
Constant Field Values

TYPE_NAME_NON_EMPTY_STRING_LIST

static final String TYPE_NAME_NON_EMPTY_STRING_LIST
Non-empty string list type.

See Also:
Constant Field Values

TYPE_NAME_EMPTY_STRING_LIST

static final String TYPE_NAME_EMPTY_STRING_LIST
Empty string list type.

See Also:
Constant Field Values

FEATURE_BASE_NAME_HEAD

static final String FEATURE_BASE_NAME_HEAD
Base name of list head feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_TAIL

static final String FEATURE_BASE_NAME_TAIL
Base name of list tail feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_FS_LIST_HEAD

static final String FEATURE_FULL_NAME_FS_LIST_HEAD
Qualified name of fs list head feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_INTEGER_LIST_HEAD

static final String FEATURE_FULL_NAME_INTEGER_LIST_HEAD
Qualified name of integer list head feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_FLOAT_LIST_HEAD

static final String FEATURE_FULL_NAME_FLOAT_LIST_HEAD
Qualified name of float list head feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_STRING_LIST_HEAD

static final String FEATURE_FULL_NAME_STRING_LIST_HEAD
Qualified name of string list head feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_FS_LIST_TAIL

static final String FEATURE_FULL_NAME_FS_LIST_TAIL
Qualified name of fs list tail feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_INTEGER_LIST_TAIL

static final String FEATURE_FULL_NAME_INTEGER_LIST_TAIL
Qualified name of integer list tail feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_FLOAT_LIST_TAIL

static final String FEATURE_FULL_NAME_FLOAT_LIST_TAIL
Qualified name of float list tail feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_STRING_LIST_TAIL

static final String FEATURE_FULL_NAME_STRING_LIST_TAIL
Qualified name of string list tail feature.

See Also:
Constant Field Values

NAME_SPACE_UIMA_TCAS

static final String NAME_SPACE_UIMA_TCAS
Name of Text CAS name space.

See Also:
Constant Field Values

TYPE_NAME_ANNOTATION

static final String TYPE_NAME_ANNOTATION
Name of annotation type.

See Also:
Constant Field Values

TYPE_NAME_DOCUMENT_ANNOTATION

static final String TYPE_NAME_DOCUMENT_ANNOTATION
Name of document annotation type.

See Also:
Constant Field Values

FEATURE_BASE_NAME_SOFA

static final String FEATURE_BASE_NAME_SOFA
Sofa ID feature that is the handle to a text Sofa.

See Also:
Constant Field Values

FEATURE_BASE_NAME_BEGIN

static final String FEATURE_BASE_NAME_BEGIN
Base name of annotation begin feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_END

static final String FEATURE_BASE_NAME_END
Base name of annotation end feature.

See Also:
Constant Field Values

FEATURE_BASE_NAME_LANGUAGE

static final String FEATURE_BASE_NAME_LANGUAGE
Base name of document language feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_BEGIN

static final String FEATURE_FULL_NAME_BEGIN
Fully qualified name of annotation begin feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_SOFA

static final String FEATURE_FULL_NAME_SOFA
Fully qualified name of annotation sofa feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_END

static final String FEATURE_FULL_NAME_END
Fully qualified name of annotation end feature.

See Also:
Constant Field Values

FEATURE_FULL_NAME_LANGUAGE

static final String FEATURE_FULL_NAME_LANGUAGE
Fully qualified name of document language feature.

See Also:
Constant Field Values

STD_ANNOTATION_INDEX

static final String STD_ANNOTATION_INDEX
Name of the built-in index on annotations.

See Also:
Constant Field Values

DEFAULT_LANGUAGE_NAME

static final String DEFAULT_LANGUAGE_NAME
See Also:
Constant Field Values
Method Detail

createFS

FeatureStructure createFS(Type type)
                          throws CASRuntimeException
Create a new FeatureStructure.

Parameters:
type - The type of the FS.
Returns:
The new FS.
Throws:
CASRuntimeException

createArrayFS

ArrayFS createArrayFS(int length)
                      throws CASRuntimeException
Create a new feature structure array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createIntArrayFS

IntArrayFS createIntArrayFS(int length)
                            throws CASRuntimeException
Create a new int array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createFloatArrayFS

FloatArrayFS createFloatArrayFS(int length)
                                throws CASRuntimeException
Create a new int array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createStringArrayFS

StringArrayFS createStringArrayFS(int length)
                                  throws CASRuntimeException
Create a new String array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createByteArrayFS

ByteArrayFS createByteArrayFS(int length)
                              throws CASRuntimeException
Create a new Byte array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createBooleanArrayFS

BooleanArrayFS createBooleanArrayFS(int length)
                                    throws CASRuntimeException
Create a new Boolean array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createShortArrayFS

ShortArrayFS createShortArrayFS(int length)
                                throws CASRuntimeException
Create a new Short array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createLongArrayFS

LongArrayFS createLongArrayFS(int length)
                              throws CASRuntimeException
Create a new Long array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

createDoubleArrayFS

DoubleArrayFS createDoubleArrayFS(int length)
                                  throws CASRuntimeException
Create a new Double array.

Parameters:
length - The length of the array.
Returns:
The new array.
Throws:
CASRuntimeException

getJCas

JCas getJCas()
             throws CASException
Get the JCas for this CAS.

Returns:
The JCas for this CAS.
Throws:
CASException

getCurrentView

CAS getCurrentView()
Get the Cas view that the current component should use. This should only be used by single-view components.

Returns:
the Cas view specified for the current component by Sofa mapping. Defaults to _InitialView if there is no Sofa mapping.

getSofa

@Deprecated
SofaFS getSofa(SofaID sofaID)
Deprecated. As of v2.0, use {#getView(String)}. From the view you can access the Sofa data, or call getSofa() if you truly need to access the SofaFS object.

Get sofaFS for given Subject of Analysis ID.

Returns:
The sofaFS.

getSofa

SofaFS getSofa()
Get the Sofa feature structure associated with this CAS view.

Returns:
The SofaFS associated with this CAS view.

createView

CAS createView(String localViewName)
Create a view and its underlying Sofa (subject of analysis). The view provides access to the Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

This method creates the underlying Sofa feature structure, but does not set the Sofa data. Setting ths Sofa data must be done by calling setSofaDataArray(FeatureStructure, String), setSofaDataString(String, String) or setSofaDataURI(String, String) on the CAS view returned by this method.

Parameters:
localViewName - the local name, before any sofa name mapping is done, for this view (note: this is the same as the associated Sofa name).
Returns:
The view corresponding to this local name.
Throws:
CASRuntimeException - if a View with this name already exists in this CAS

getJCas

JCas getJCas(SofaFS aSofa)
             throws CASException
Create a JCas view for a Sofa. Note: as of UIMA v2.0, can be replaced with getView(sofaFS).getJCas().

Parameters:
aSofa - a Sofa feature structure in this CAS.
Returns:
The JCas view for the given Sofa.
Throws:
CASException

getJCas

@Deprecated
JCas getJCas(SofaID aSofaID)
             throws CASException
Deprecated. As of v2.0, use getView(String) followed by getJCas().

Create a JCas view for a Sofa. Note: this is provided for convenience. It is equivalent to getView(aSofaID).getJCas().

Parameters:
aSofaID - the ID of a Sofa defined in this CAS
Returns:
The view for the Sofa with ID aSofaID.
Throws:
CASRuntimeException - if no Sofa with the given ID exists in this CAS
CASException

getView

CAS getView(String localViewName)
Get the view for a Sofa (subject of analysis). The view provides access to the Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

Parameters:
localViewName - the local name, before any sofa name mapping is done, for this view (note: this is the same as the associated Sofa name).
Returns:
The view corresponding to this local name.
Throws:
CASRuntimeException - if no View with this name exists in this CAS

getView

CAS getView(SofaFS aSofa)
Get the view for a Sofa (subject of analysis). The view provides access to the Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

Parameters:
aSofa - a Sofa feature structure in the CAS
Returns:
The view for the given Sofa

getLowLevelCAS

org.apache.uima.cas.impl.LowLevelCAS getLowLevelCAS()
Get an instance of the low-level CAS. Low-level and regular CAS can be used in parallel, all data is always contained in both.

Note: This is for internal use.

Returns:
A low-level CAS.
See Also:
LowLevelCAS

getAnnotationType

Type getAnnotationType()
Get the type object for the annotation type.

Returns:
The annotation type.

getBeginFeature

Feature getBeginFeature()
Get the feature object for the annotation begin feature.

Returns:
The annotation begin feature.

getEndFeature

Feature getEndFeature()
Get the feature object for the annotation end feature.

Returns:
The annotation end feature.

getAnnotationIndex

AnnotationIndex<AnnotationFS> getAnnotationIndex()
Get the standard annotation index.

Returns:
The standard annotation index.

getAnnotationIndex

AnnotationIndex<AnnotationFS> getAnnotationIndex(Type type)
                                                 throws CASRuntimeException
Get the standard annotation index restricted to a specific annotation type.

Parameters:
type - The annotation type the index is restricted to.
Returns:
The standard annotation index, restricted to type.
Throws:
CASRuntimeException - When type is not an annotation type.

createAnnotation

AnnotationFS createAnnotation(Type type,
                              int begin,
                              int end)
Create a new annotation. Note that you still need to insert the annotation into the index repository yourself.

Parameters:
type - The type of the annotation.
begin - The start of the annotation.
end - The end of the annotation.
Returns:
A new annotation object.

getDocumentAnnotation

AnnotationFS getDocumentAnnotation()
Get the document annotation. The document has a string-valued feature called "language" where the document language is specified.

Returns:
The document annotation, or null if there is none.

setCurrentComponentInfo

void setCurrentComponentInfo(ComponentInfo info)
Informs the CAS of relevant information about the component that is currently procesing it. This is called by the framework automatically; users do not need to call it.

Parameters:
info - information about the component that is currently processing this CAS.

getTypeSystem

TypeSystem getTypeSystem()
                         throws CASRuntimeException
Return the type system of this CAS instance.

Returns:
The type system, or null if none is available.
Throws:
CASRuntimeException - If the type system has not been committed.

createSofa

@Deprecated
SofaFS createSofa(SofaID sofaID,
                             String mimeType)
Deprecated. As of v2.0, use createView(String) instead.

Create a Subject of Analysis. The new sofaFS is automatically added to the SofaIndex.

Returns:
The sofaFS.

getSofaIterator

FSIterator<SofaFS> getSofaIterator()
Get iterator for all SofaFS in the CAS.

Returns:
an iterator over SofaFS.

createFilteredIterator

<T extends FeatureStructure> FSIterator<T> createFilteredIterator(FSIterator<T> it,
                                                                  FSMatchConstraint cons)
Create an iterator over structures satisfying a given constraint. Constraints are described in the javadocs for ConstraintFactory and related classes.

Parameters:
it - The input iterator.
cons - The constraint specifying what structures should be returned.
Returns:
An iterator over FSs.

getConstraintFactory

ConstraintFactory getConstraintFactory()
Get a constraint factory. A constraint factory is a simple way of creating FSMatchConstraints.

Returns:
A constraint factory to create new FS constraints.

createFeaturePath

FeaturePath createFeaturePath()
Create a feature path. This is mainly useful for creating FSMatchConstraints.

Returns:
A new, empty feature path.

getIndexRepository

FSIndexRepository getIndexRepository()
Get the index repository.

Returns:
The index repository, or null if none is available.

fs2listIterator

<T extends FeatureStructure> ListIterator<T> fs2listIterator(FSIterator<T> it)
Wrap a standard Java ListIterator around an FSListIterator. Use if you feel more comfortable with java style iterators.

Parameters:
it - The FSListIterator to be wrapped.
Returns:
An equivalent ListIterator.

reset

void reset()
           throws CASAdminException
Reset the CAS, emptying it of all content. Feature structures and iterators will no longer be valid. Note: this method may only be called from an application. Calling it from an annotator will trigger a runtime exception.

Throws:
CASRuntimeException - When called out of sequence.
CASAdminException
See Also:
CASMgr

getViewName

String getViewName()
Get the view name. The view name is the same as the name of the view's Sofa, retrieved by getSofa().getSofaID(), except for the initial View before its Sofa has been created.

Returns:
The name of the view

size

int size()
Estimate the memory consumption of this CAS instance (in bytes).

Returns:
The estimated memory used by this CAS instance.

createFeatureValuePath

FeatureValuePath createFeatureValuePath(String featureValuePath)
                                        throws CASRuntimeException
Create a feature-value path from a string.

Parameters:
featureValuePath - String representation of the feature-value path.
Returns:
Feature-value path object.
Throws:
CASRuntimeException - If the input string is not well-formed.

setDocumentText

void setDocumentText(String text)
                     throws CASRuntimeException
Set the document text. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Parameters:
text - The text to be analyzed.
Throws:
CASRuntimeException - If the Sofa data has already been set.

setSofaDataString

void setSofaDataString(String text,
                       String mimetype)
                       throws CASRuntimeException
Set the document text. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Parameters:
text - The text to be analyzed.
mime - The mime type of the data
Throws:
CASRuntimeException - If the Sofa data has already been set.

getDocumentText

String getDocumentText()
Get the document text.

Returns:
The text being analyzed, or null if not set.

getSofaDataString

String getSofaDataString()
Get the Sofa Data String (a.k.a. the document text).

Returns:
The Sofa data string, or null if not set.

setDocumentLanguage

void setDocumentLanguage(String languageCode)
                         throws CASRuntimeException
Sets the language for this document. This value sets the language feature of the special instance of DocumentAnnotation associated with this CAS.

Parameters:
languageCode -
Throws:
CASRuntimeException

getDocumentLanguage

String getDocumentLanguage()
Gets the language code for this document from the language feature of the special instance of the DocumentationAnnotation associated with this CAS.

Returns:
language identifier

setSofaDataArray

void setSofaDataArray(FeatureStructure array,
                      String mime)
                      throws CASRuntimeException
Set the Sofa data as an ArrayFS. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Parameters:
array - The ArrayFS to be analyzed.
mime - The mime type of the data
Throws:
CASRuntimeException - If the Sofa data has already been set.

getSofaDataArray

FeatureStructure getSofaDataArray()
Get the Sofa data array.

Returns:
The Sofa Data being analyzed, or null if not set.

setSofaDataURI

void setSofaDataURI(String uri,
                    String mime)
                    throws CASRuntimeException
Set the Sofa data as a URI. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Parameters:
uri - The URI of the data to be analyzed.
mime - The mime type of the data
Throws:
CASRuntimeException - If the Sofa data has already been set.

getSofaDataURI

String getSofaDataURI()
Get the Sofa data array.

Returns:
The Sofa URI being analyzed, or null if not set.

getSofaDataStream

InputStream getSofaDataStream()
Get the Sofa data as a byte stream.

Returns:
A stream handle to the Sofa Data, or null if not set.

getSofaMimeType

String getSofaMimeType()
Get the mime type of the Sofa data being analyzed.

Returns:
the mime type of the Sofa

addFsToIndexes

void addFsToIndexes(FeatureStructure fs)
Add a feature structure to all appropriate indexes in the repository associated with this CAS View. If no indexes exist for the type of FS that you are adding, then a bag (unsorted) index will be automatically created.

Important: after you have called addFsToIndexes(...) on a FS, do not change the values of any features used for indexing. If you do, the index will become corrupted and may be unusable. If you need to change an index feature value, first call removeFsFromIndexes(...) on the FS, change the feature values, then call addFsToIndexes(...) again.

Parameters:
fs - The Feature Structure to be added.
Throws:
NullPointerException - If the fs parameter is null.

removeFsFromIndexes

void removeFsFromIndexes(FeatureStructure fs)
Remove a feature structure from all indexes in the repository associated with this CAS View.

Parameters:
fs - The Feature Structure to be removed.
Throws:
NullPointerException - If the fs parameter is null.

getViewIterator

Iterator<CAS> getViewIterator()
Get iterator over all views in this CAS. Each view provides access to Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

Returns:
an iterator which returns all views. Each object returned by the iterator is of type CAS.

getViewIterator

Iterator<CAS> getViewIterator(String localViewNamePrefix)
Get iterator over all views with the given name prefix. Each view provides access to Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

When passed the prefix namePrefix, the iterator will return all views who name is either exactly equal to namePrefix or is of the form namePrefix.suffix, where suffix can be any String.

Parameters:
localViewNamePrefix - the local name prefix, before any sofa name mapping is done, for this view (note: this is the same as the associated Sofa name prefix).
Returns:
an iterator which returns all views with the given name prefix. Each object returned by the iterator is of type CAS.

createMarker

Marker createMarker()
Sets a mark and returns the marker object set with the current mark which can be used to query when certain FSs were created. This can then be used to identify FSs as added before or after the mark was set and to identify FSs modified after the mark is set. Note: this method may only be called from an application. Calling it from an annotator will trigger a runtime exception.

Returns:
a marker object.


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.