org.apache.uima.cas
Interface FeaturePath


public interface FeaturePath

Interface for a feature path. A feature path is a sequence of features. The feature path can either be initialized using the addFeature() or the initialize() method. To initialize and check the feature path for a desired type call typeInit(). After these calls the feature path value can be extracted using the provided getter methods.

The feature path elements are separated by "/". So a valid feature path is /my/feature/path.

The feature path syntax also allows some built-in functions on the last feature path element. Built-in functions are added with a ":" followed by the function name. E.g. "/my/path:fsId()". The allowed built-in functions are:

Built-in functions are only evaluated if getValueAsString() is called.


Method Summary
 void addFeature(Feature feat)
          Add a new feature at the end of the path.
 Boolean getBooleanValue(FeatureStructure fs)
          Returns the Boolean value of a boolean valued feature path.
 Byte getByteValue(FeatureStructure fs)
          Returns the Byte value of a byte valued feature path.
 Double getDoubleValue(FeatureStructure fs)
          Returns the Double value of a double valued feature path.
 Feature getFeature(int i)
          Get feature at position.
 String getFeaturePath()
          Returns the feature path as string.
 Float getFloatValue(FeatureStructure fs)
          Returns the Float value of a float valued feature path.
 FeatureStructure getFSValue(FeatureStructure fs)
          Returns the FeatureStructure of a FeatureStructure valued feature path.
 Integer getIntValue(FeatureStructure fs)
          Returns the Integer value of an integer valued feature path.
 Long getLongValue(FeatureStructure fs)
          Returns the Long value of a long valued feature path.
 Short getShortValue(FeatureStructure fs)
          Returns the Short value of a short valued feature path.
 String getStringValue(FeatureStructure fs)
          Returns the String value of a string valued feature path.
 TypeClass getTypClass(FeatureStructure fs)
          Returns the type class of the feature path.
 Type getType(FeatureStructure fs)
          Returns the type of the feature path.
 String getValueAsString(FeatureStructure fs)
          Returns the feature path value as string for the given FeatureStructure.
 void initialize(String featurePath)
          Initialize the feature path object with the given feature path string.
 String ll_getValueAsString(int fsRef, org.apache.uima.cas.impl.LowLevelCAS llCas)
          Returns the feature path value as string for the given FeatureStructure.
 int size()
          Get length of path.
 void typeInit(Type featurePathType)
          Check the feature path for the given type and initialize internal structures for faster access to the feature path value.
 

Method Detail

size

int size()
Get length of path.

Returns:
An integer >= 0.

getFeature

Feature getFeature(int i)
Get feature at position.

Parameters:
i - The position in the path (starting at 0).
Returns:
The feature, or null if there is no such feature.

addFeature

void addFeature(Feature feat)
Add a new feature at the end of the path.

Parameters:
feat - The feature to be added.

initialize

void initialize(String featurePath)
                throws CASException
Initialize the feature path object with the given feature path string.

Parameters:
featurePath - The featurePath that is used for this feature path object.
Throws:
CASException - Throws an exception if the feature path syntax is invalid.

typeInit

void typeInit(Type featurePathType)
              throws CASException
Check the feature path for the given type and initialize internal structures for faster access to the feature path value.

Parameters:
featurePathType - The type the feature path should be used on.
Throws:
CASException - Throws an exception if the feature path is not valid for the given type

getValueAsString

String getValueAsString(FeatureStructure fs)
Returns the feature path value as string for the given FeatureStructure. If the feature path contains a built-in function it is evaluated and the built-in function value is returned. If the feature path ends with an array the array is converted to a comma separated string.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the value of the feature path as String or null if the feature path was not set

ll_getValueAsString

String ll_getValueAsString(int fsRef,
                           org.apache.uima.cas.impl.LowLevelCAS llCas)
Returns the feature path value as string for the given FeatureStructure. If the feature path contains a built-in function it is evaluated and the built-in function value is returned. If the feature path ends with an array the array is converted to a comma separated string.

Parameters:
fsRef - FeatureStructure reference (LowLevel API) to evaluate the feature path value
llCas - LowLevelCAS for the fsRef
Returns:
Returns the value of the feature path as String

getType

Type getType(FeatureStructure fs)
Returns the type of the feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path type
Returns:
Returns the type of the feature path or null if the feature path is not set.

getTypClass

TypeClass getTypClass(FeatureStructure fs)
Returns the type class of the feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path type class
Returns:
Returns the type class of the feature path or null if the feature path is not set

getFeaturePath

String getFeaturePath()
Returns the feature path as string.

Returns:
Returns the feature path as string.

getStringValue

String getStringValue(FeatureStructure fs)
Returns the String value of a string valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the String value of a string valued feature path or null if the feature path was not set

getIntValue

Integer getIntValue(FeatureStructure fs)
Returns the Integer value of an integer valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Integer value of a integer valued feature path or null if the feature path was not set

getBooleanValue

Boolean getBooleanValue(FeatureStructure fs)
Returns the Boolean value of a boolean valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Boolean value of a boolean valued feature path or null if the feature path was not set

getByteValue

Byte getByteValue(FeatureStructure fs)
Returns the Byte value of a byte valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Byte value of a byte valued feature path or null if the feature path was not set

getDoubleValue

Double getDoubleValue(FeatureStructure fs)
Returns the Double value of a double valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Double value of a double valued feature path or null if the feature path was not set

getFloatValue

Float getFloatValue(FeatureStructure fs)
Returns the Float value of a float valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Float value of a float valued feature path or null if the feature path was not set

getLongValue

Long getLongValue(FeatureStructure fs)
Returns the Long value of a long valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Long value of a long valued feature path or null if the feature path was not set

getShortValue

Short getShortValue(FeatureStructure fs)
Returns the Short value of a short valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the Short value of a short valued feature path or null if the feature path was not set

getFSValue

FeatureStructure getFSValue(FeatureStructure fs)
Returns the FeatureStructure of a FeatureStructure valued feature path.

Parameters:
fs - FeatureStructure to evaluate the feature path value
Returns:
Returns the FeatureStructure value of a FeatureStructure valued feature path or null if the feature path was not set


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