You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2015/03/31 16:07:11 UTC

svn commit: r1670345 - /uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/AbstractStructureAction.java

Author: pkluegl
Date: Tue Mar 31 14:07:11 2015
New Revision: 1670345

URL: http://svn.apache.org/r1670345
Log:
UIMA-4319
- get annotations referenced by feature

Modified:
    uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/AbstractStructureAction.java

Modified: uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/AbstractStructureAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/AbstractStructureAction.java?rev=1670345&r1=1670344&r2=1670345&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/AbstractStructureAction.java (original)
+++ uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/AbstractStructureAction.java Tue Mar 31 14:07:11 2015
@@ -19,6 +19,7 @@
 
 package org.apache.uima.ruta.action;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,6 +37,7 @@ import org.apache.uima.ruta.RutaStream;
 import org.apache.uima.ruta.UIMAConstants;
 import org.apache.uima.ruta.expression.IRutaExpression;
 import org.apache.uima.ruta.expression.bool.IBooleanExpression;
+import org.apache.uima.ruta.expression.feature.FeatureExpression;
 import org.apache.uima.ruta.expression.feature.GenericFeatureExpression;
 import org.apache.uima.ruta.expression.number.INumberExpression;
 import org.apache.uima.ruta.expression.string.IStringExpression;
@@ -79,15 +81,17 @@ public abstract class AbstractStructureA
           }
         } else if (valueObject instanceof GenericFeatureExpression && !range.isPrimitive()) {
           GenericFeatureExpression gfe = (GenericFeatureExpression) valueObject;
-          TypeExpression type = gfe.getFeatureExpression().getTypeExpr(parent);
+          FeatureExpression fe = gfe.getFeatureExpression();
+          TypeExpression type = fe.getTypeExpr(parent);
           List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(matchedAnnotation,
                   type.getType(parent));
+          List<AnnotationFS> featureAnnotations = new ArrayList<AnnotationFS>(fe.getFeatureAnnotations(annotationsInWindow, stream, parent, false));
           if (typeSystem.subsumes(jcas.getCasType(FSArray.type), range)) {
             structure
-                    .setFeatureValue(targetFeature, UIMAUtils.toFSArray(jcas, annotationsInWindow));
+                    .setFeatureValue(targetFeature, UIMAUtils.toFSArray(jcas, featureAnnotations));
           } else if (typeSystem.subsumes(range, type.getType(parent))
-                  && !annotationsInWindow.isEmpty()) {
-            AnnotationFS annotation = annotationsInWindow.get(0);
+                  && !featureAnnotations.isEmpty()) {
+            AnnotationFS annotation = featureAnnotations.get(0);
             structure.setFeatureValue(targetFeature, annotation);
           }
         } else if (valueObject instanceof IStringExpression