Java Code Examples for org.apache.uima.jcas.cas.TOP#getFeatureValueAsString()
The following examples show how to use
org.apache.uima.jcas.cas.TOP#getFeatureValueAsString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XCASSerializer.java From uima-uimaj with Apache License 2.0 | 6 votes |
private void encodeFeatures(TOP fs, AttributesImpl attrs) { TypeImpl ti = fs._getTypeImpl(); for (FeatureImpl fi : ti.getFeatureImpls()) { String attrValue; if (fi.getRangeImpl().isRefType) { TOP v = fs.getFeatureValue(fi); attrValue = (null == v) ? null : Integer.toString(v._id); } else { attrValue = fs.getFeatureValueAsString(fi); } if (attrValue != null) { addAttribute(attrs, featureNames[fi.getCode()], attrValue); } } }
Example 2
Source File: FeaturePathImpl.java From uima-uimaj with Apache License 2.0 | 4 votes |
@Override public String getValueAsString(FeatureStructure fs) { TOP tgtFs = getTargetFs((TOP) fs); if (tgtFs == FEATURE_PATH_FAILED) { return null; } if (targetType == null) { return null; } switch (TypeSystemImpl.getTypeClass(targetType)) { case LowLevelCAS.TYPE_CLASS_INVALID: return null; case LowLevelCAS.TYPE_CLASS_STRING: case LowLevelCAS.TYPE_CLASS_BOOLEAN: case LowLevelCAS.TYPE_CLASS_BYTE: case LowLevelCAS.TYPE_CLASS_SHORT: case LowLevelCAS.TYPE_CLASS_INT: case LowLevelCAS.TYPE_CLASS_LONG: case LowLevelCAS.TYPE_CLASS_FLOAT: case LowLevelCAS.TYPE_CLASS_DOUBLE: verifyNoBuiltInFunction(); return tgtFs.getFeatureValueAsString(targetFeature); case LowLevelCAS.TYPE_CLASS_BOOLEANARRAY: case LowLevelCAS.TYPE_CLASS_BYTEARRAY: case LowLevelCAS.TYPE_CLASS_SHORTARRAY: case LowLevelCAS.TYPE_CLASS_INTARRAY: case LowLevelCAS.TYPE_CLASS_LONGARRAY: case LowLevelCAS.TYPE_CLASS_FLOATARRAY: case LowLevelCAS.TYPE_CLASS_DOUBLEARRAY: case LowLevelCAS.TYPE_CLASS_STRINGARRAY: case LowLevelCAS.TYPE_CLASS_FSARRAY: if (this.builtInFunction > NO_BUILT_IN_FUNCTION) { return evaluateBuiltInFunction(tgtFs); } return ((CommonArrayFS)tgtFs).getValuesAsCommaSeparatedString(); case LowLevelCAS.TYPE_CLASS_FS: if (tgtFs == null) { return null; } if (this.builtInFunction > NO_BUILT_IN_FUNCTION) { return evaluateBuiltInFunction(tgtFs); } return tgtFs.toString(); } // end of switch return null; }