public interface FeaturePath
Interface for a feature path. A feature path is a sequence of features, specified as shortFeatureNames (strings). The feature path can either be initialized using the addFeature() or the initialize() method.
A single feature path object can apply to many different types. The method typeInit()
is (optionally)
used to bind a feature path object to a particular starting Type. This binding remains until another
call to typeInit()
is made. It is used to speed up application of the featurePath to an instance,
but is not required - the application will dynamically lookup features along the path as needed.
If no typeInit call is made, or if the current binding is not correct for the Feature Structure, then the mapping of the features in the feature path specification to actual features is recomputed during the the evaluation of the particular getter invocation.
After these calls the feature path value can be applied to a particular Feature Structure and a 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.
All the intervening features except for the last must be features whose values are other Feature Structures.
Features whose range is an Array are not permitted, unless they occur at the end of the Feature Path. In that case, the value returned must be returned by one of the getValueAsString methods.
Modifier and Type | Method and Description |
---|---|
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)
Deprecated.
use getTypeClass (spelling fix)
|
Type |
getType(FeatureStructure fs)
Returns the type of the feature path.
|
TypeClass |
getTypeClass(FeatureStructure fs)
Returns the type class 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.
|
int size()
>= 0
.Feature getFeature(int i)
i
- The position in the path (starting at 0
).null
if there is no such feature.void addFeature(Feature feat)
feat
- The feature to be added.void initialize(String featurePath) throws CASException
featurePath
- The featurePath that is used for this feature path object.CASException
- Throws an exception if the feature path syntax is invalid.void typeInit(Type featurePathType) throws CASException
featurePathType
- The type the feature path should be used on.CASException
- Throws an exception if the feature path is not valid for the
given typeString getValueAsString(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueString ll_getValueAsString(int fsRef, org.apache.uima.cas.impl.LowLevelCAS llCas)
fsRef
- FeatureStructure reference (LowLevel API) to evaluate the
feature path valuellCas
- LowLevelCAS for the fsRefType getType(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path type@Deprecated TypeClass getTypClass(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path type classTypeClass getTypeClass(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path type classString getFeaturePath()
String getStringValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueInteger getIntValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueBoolean getBooleanValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueByte getByteValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueDouble getDoubleValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueFloat getFloatValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueLong getLongValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueShort getShortValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueFeatureStructure getFSValue(FeatureStructure fs)
fs
- FeatureStructure to evaluate the feature path valueCopyright © 2006–2017 The Apache Software Foundation. All rights reserved.