Author: pkluegl
Date: Fri Aug 26 17:46:28 2016
New Revision: 1757900
URL: http://svn.apache.org/viewvc?rev=1757900&view=rev
Log:
UIMA-4851
- support ct as normal feature again
Modified:
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
Modified:
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
URL:
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java?rev=1757900&r1=1757899&r2=1757900&view=diff
==============================================================================
---
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
(original)
+++
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
Fri Aug 26 17:46:28 2016
@@ -81,21 +81,23 @@ public class SimpleFeatureExpression ext
throw new IllegalArgumentException(
"Not able to access feature " + each + " of type " +
type.getName());
}
- } else if (StringUtils.equals(each, UIMAConstants.FEATURE_COVERED_TEXT))
{
- // there is no explicit feature for coveredText
- feature = new CoveredTextFeature();
+ } else if (StringUtils.equals(each, UIMAConstants.FEATURE_COVERED_TEXT)
+ || StringUtils.equals(each,
UIMAConstants.FEATURE_COVERED_TEXT_SHORT)) {
+ if(type != null) {
+ feature = type.getFeatureByBaseName(each);
+ }
+ if (feature == null) {
+ // there is no explicit feature for coveredText
+ feature = new CoveredTextFeature();
+ }
} else if (type == null || type.isArray()) {
// lazy check of range
feature = new LazyFeature(each);
} else {
feature = type.getFeatureByBaseName(each);
if (feature == null) {
- if (StringUtils.equals(each,
UIMAConstants.FEATURE_COVERED_TEXT_SHORT)) {
- feature = new CoveredTextFeature();
- } else {
- throw new IllegalArgumentException(
- "Not able to access feature " + each + " of type " +
type.getName());
- }
+ throw new IllegalArgumentException(
+ "Not able to access feature " + each + " of type " +
type.getName());
}
}
result.add(feature);
@@ -120,21 +122,23 @@ public class SimpleFeatureExpression ext
if (annotation != null) {
return annotation.getType();
}
- }
-// else {
-// IAnnotationListExpression annotationListExpression =
mr.getAnnotationListExpression(context, stream);
-// if (annotationListExpression != null) {
-// CAS cas = stream.getCas();
-// TypeSystem typeSystem = cas.getTypeSystem();
-// typeSystem.
-// Type mostGeneralType = null;
-// cas.g
-// List<AnnotationFS> annotationList =
annotationListExpression.getAnnotationList(context, stream);
-// for (AnnotationFS annotationFS : annotationList) {
-//
-// }
-// }
-// }
+ }
+ // else {
+ // IAnnotationListExpression annotationListExpression =
+ // mr.getAnnotationListExpression(context, stream);
+ // if (annotationListExpression != null) {
+ // CAS cas = stream.getCas();
+ // TypeSystem typeSystem = cas.getTypeSystem();
+ // typeSystem.
+ // Type mostGeneralType = null;
+ // cas.g
+ // List<AnnotationFS> annotationList =
annotationListExpression.getAnnotationList(context,
+ // stream);
+ // for (AnnotationFS annotationFS : annotationList) {
+ //
+ // }
+ // }
+ // }
}
return null;
}
@@ -181,7 +185,8 @@ public class SimpleFeatureExpression ext
LazyFeature lazyFeature = (LazyFeature) currentFeature;
Feature delegate = lazyFeature.initialize(annotation);
if (delegate == null) {
- throw new RuntimeException("Invalid feature! Feature
'"+lazyFeature.getFeatureName()+"' is not defined for type
'"+annotation.getType()+"'.");
+ throw new RuntimeException("Invalid feature! Feature '" +
lazyFeature.getFeatureName()
+ + "' is not defined for type '" + annotation.getType() +
"'.");
} else {
currentFeature = delegate;
}