public interface FsVariables
To use, a certain type and index must be declared in the processing pipeline. Use the type system and index declaration that come with this package. There's also an annotator descriptor that shows you how to import the type system and index specification into your own descriptor.
Use FsVariableFactory.newInstance()
to create a
FsVariables
object. On every process call to your annotator (or whenever there's
a new CAS; you can use this in other places than just annotators), you need to call
init(CAS)
to re-initialize the object to the next CAS.
Modifier and Type | Field and Description |
---|---|
static String |
INDEX_NAME |
static String |
NAME_FEATURE_NAME |
static String |
TYPE_FEATURE_NAME |
static String |
TYPE_NAME |
static String |
VALUE_FEATURE_NAME |
Modifier and Type | Method and Description |
---|---|
boolean |
checkCas(org.apache.uima.cas.CAS cas)
Check a CAS for FsVariable type system and index definition.
|
void |
declareFsVariable(String name,
org.apache.uima.cas.Type type)
Declare a new FsVariable.
|
org.apache.uima.cas.Type |
getFsVariableType(String name)
Get the type of an FsVariable.
|
org.apache.uima.cas.FeatureStructure |
getVariableValue(String name)
Get the FeatureStructure value of a variable.
|
void |
init(org.apache.uima.cas.CAS cas)
Initialize
this with current CAS. |
boolean |
isFsVariable(String name)
Check if a variable of that name exists.
|
List |
listFsVariables()
Return a list of all variable names that are currently declared.
|
List |
listFsVariables(org.apache.uima.cas.Type type)
Return a list of all variable names of those variables whose type is a subtype of the type
parameter.
|
void |
setVariable(String name,
org.apache.uima.cas.FeatureStructure fs)
Set the value of an existing variable.
|
static final String INDEX_NAME
static final String TYPE_NAME
static final String NAME_FEATURE_NAME
static final String TYPE_FEATURE_NAME
static final String VALUE_FEATURE_NAME
boolean checkCas(org.apache.uima.cas.CAS cas)
true
,
init(CAS)
will not throw an exception.cas
- The CAS to check.true
iff CAS contains required type and index.void init(org.apache.uima.cas.CAS cas) throws FsVariablesException
this
with current CAS. This needs to be called on every process, before
any other APIs are called!cas
- The current CAS.FsVariablesException
- When the CAS does not contain FsVariable type or index.void declareFsVariable(String name, org.apache.uima.cas.Type type) throws FsVariablesException
isFsVariable(String)
to check if a variable with the same name
already exists.name
- The name of the variable.type
- The type of the variable.FsVariablesException
- When FsVariable name
already exists.boolean isFsVariable(String name)
name
- The name of the variable.true
iff a FsVariable of that name exists.org.apache.uima.cas.Type getFsVariableType(String name) throws FsVariablesException
name
- The name of the variable.FsVariablesException
- If no variable of that name exists, or somehow the name of the
variable's type does not resolve to a type in the type system.List listFsVariables()
List listFsVariables(org.apache.uima.cas.Type type)
type
- The type of variables we want to see.org.apache.uima.cas.FeatureStructure getVariableValue(String name) throws FsVariablesException
name
- The name of the variable.FsVariablesException
- When no variable of name
exists.void setVariable(String name, org.apache.uima.cas.FeatureStructure fs) throws FsVariablesException
name
- The name of the variable.fs
- The value to set.FsVariablesException
- When no variable of name
exists.Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.