public class FeatureValuePathImpl extends Object implements FeatureValuePath
coveredText() can be accessed using evaluateAsString
typeName() can be accessed using evaluateAsString
fsId() can be accessed using evaluateAsInt. Its result can be
used to retrieve an FS from the current LowLevel-CAS.
uniqueId() can be accessed using evaluateAsInt. Its result
can be used to uniquely identify an FS for a document (even if the document is split over several
CAS chunks)
FSArray, but not as
the last path snippet. The next path snippet must contain the fully qualified type name, example:
family/members[0]/somepackage.Person:nameIntArray, StringArray, FloatArray, but only as the last path snippet.[index] returns the array entry at index
[last] returns the last entry of the array
[] returns an array of values. [] is only allowed 0 or 1 time
in a feature path. If it is used, getValueType will return one of the following:
CAS.TYPE_NAME_STRING_ARRAY ,CAS.TYPE_NAME_INTEGER_ARRAY,CAS.TYPE_NAME_FLOAT_ARRAY.
FSArray, an actual feature name
can be omitted, and only the array access operator can be used. Examples:
[]/somepackage.Person:coveredText()
[last]/somepackage.Person:fsId()
FeaturePath.getFeaturePath. Note that the
client code needs to keep track of the "start type" of the feature path, that is, the type that
contains the attribute used in the first snippet of the path.
typeSystemInit of your component (CAS consumer or TAE), call
typeSystemInit of the feature path.
getValueType to find out whether the feature path evaluates to a String,
and int, a float, or their array counterparts.
evaluateAs methods
| Modifier and Type | Method and Description |
|---|---|
Object |
evaluate(int currentFS,
LowLevelCAS cas) |
Float |
evaluateAsFloat(int currentFS,
LowLevelCAS cas) |
Float[] |
evaluateAsFloatArray(int currentFS,
LowLevelCAS cas) |
Integer |
evaluateAsInt(int currentFS,
LowLevelCAS cas) |
Integer[] |
evaluateAsIntArray(int currentFS,
LowLevelCAS cas) |
String |
evaluateAsString(int currentFS,
LowLevelCAS cas)
Evaluates each snippet of the feature path.
|
String[] |
evaluateAsStringArray(int currentFS,
LowLevelCAS cas) |
static FeatureValuePathImpl |
getFeaturePath(String featurePath) |
int |
getFSType()
Returns the type for which the last feature in the feature path is defined.
|
String |
getValueType()
Returns the type that this feature path will evaluate to.
|
String |
toString() |
void |
typeSystemInit(int fsType,
LowLevelTypeSystem ts) |
public static FeatureValuePathImpl getFeaturePath(String featurePath) throws CASRuntimeException
CASRuntimeExceptionpublic Object evaluate(int currentFS, LowLevelCAS cas)
evaluate in interface FeatureValuePathpublic Float evaluateAsFloat(int currentFS, LowLevelCAS cas)
evaluateAsFloat in interface FeatureValuePathpublic Float[] evaluateAsFloatArray(int currentFS, LowLevelCAS cas)
evaluateAsFloatArray in interface FeatureValuePathpublic Integer evaluateAsInt(int currentFS, LowLevelCAS cas)
evaluateAsInt in interface FeatureValuePathpublic Integer[] evaluateAsIntArray(int currentFS, LowLevelCAS cas)
evaluateAsIntArray in interface FeatureValuePathpublic String evaluateAsString(int currentFS, LowLevelCAS cas)
null if some feature within the path is not set. If the
leaf snippet is COVERED_TEXT, returns the covered text of
currentFS.evaluateAsString in interface FeatureValuePathcurrentFS - the current Feature Structurecas - CASpublic String[] evaluateAsStringArray(int currentFS, LowLevelCAS cas)
evaluateAsStringArray in interface FeatureValuePathpublic int getFSType()
typeSystemInit has been called prior to this method.
feature1/.../featureN-1/featureN, returns the type of
featureN.
feature1/.../featureN-1/typeN:featureN, returns the
type code for typeN. (For example, if the range type of featureN-1 is FSList or FSArray)
feature1, where feature1 is simple-valued, returns the
type that was used in typeSystemInit
getFSType in interface FeatureValuePathpublic String getValueType()
getValueType in interface FeatureValuePathpublic void typeSystemInit(int fsType,
LowLevelTypeSystem ts)
throws CASRuntimeException
typeSystemInit in interface FeatureValuePathCASRuntimeExceptionCopyright © 2006–2021 The Apache Software Foundation. All rights reserved.