Modified: 
uima/uv3/ruta-v3/trunk/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
 Mon Nov 18 12:19:31 2019
@@ -35,404 +35,436 @@ import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.JCasRegistry;
 import org.apache.uima.jcas.tcas.Annotation;
 
-/** 
- * Updated by JCasGen Fri Feb 16 11:29:59 CET 2018
- * XML source: 
C:/work/ws/ws-uima-ruta/ruta-v3/ruta-typesystem/target/jcasgen/typesystem.xml
- * @generated */
+/**
+ * Updated by JCasGen Fri Feb 16 11:29:59 CET 2018 XML source:
+ * 
C:/work/ws/ws-uima-ruta/ruta-v3/ruta-typesystem/target/jcasgen/typesystem.xml
+ * 
+ * @generated
+ */
 public class RutaBasic extends Annotation {
 
-    private static final int INITIAL_CAPACITY = 2;
+  private static final int INITIAL_CAPACITY = 2;
 
-    private static final String ROOT_TYPE1 = "uima.tcas.Annotation";
+  private static final String ROOT_TYPE1 = "uima.tcas.Annotation";
 
-    private static final String ROOT_TYPE2 = "uima.cas.AnnotationBase";
+  private static final String ROOT_TYPE2 = "uima.cas.AnnotationBase";
 
-    private boolean lowMemoryProfile = false;
+  private boolean lowMemoryProfile = false;
 
-    private int[] partOf = new int[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
-
-    private Collection<?>[] beginMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
-
-    private Collection<?>[] endMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
-
-    private boolean empty = true;
-
-    public boolean isEmpty() {
-        return empty;
-    }
-
-    public boolean isLowMemoryProfile() {
-        return lowMemoryProfile;
-    }
-
-    public void setLowMemoryProfile(boolean lowMemoryProfile) {
-        this.lowMemoryProfile = lowMemoryProfile;
-    }
-
-    public void addPartOf(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        addPartOf(code);
-    }
-
-    private void addPartOf(int code) {
-        partOf[code] = partOf[code] + 1;
-        if (!lowMemoryProfile) {
-            int parentCode = 
getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code);
-            if (parentCode > 0) {
-                addPartOf(parentCode);
-            }
-        }
-    }
-
-    public void removePartOf(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        removePartOf(code);
-    }
-
-    private void removePartOf(int code) {
-        if (partOf[code] != 0) {
-            partOf[code] = partOf[code] - 1;
-            if (!lowMemoryProfile) {
-                int parentCode = 
getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code);
-                if (parentCode > 0) {
-                    removePartOf(parentCode);
-                }
-            }
-        }
-    }
-
-    public boolean isPartOf(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        int count = partOf[code];
-        if (count > 0) {
-            return true;
-        }
-        if (lowMemoryProfile) {
-            List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
-            for (Type each : subsumedTypes) {
-                int code2 = ((TypeImpl) each).getCode();
-                int count2 = partOf[code2];
-                if (count2 > 0) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public void setPartOf(int[] partOf) {
-        this.partOf = partOf;
-    }
-
-    public int[] getPartOf() {
-        return partOf;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Collection<AnnotationFS> getBeginAnchors(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        Collection<AnnotationFS> set = (Collection<AnnotationFS>) 
beginMap[code];
-        if (lowMemoryProfile) {
-            Collection<AnnotationFS> result = new ArrayList<AnnotationFS>();
-            if (set != null) {
-                result.addAll(set);
-            }
-            List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
-            for (Type each : subsumedTypes) {
-                int parentCode = ((TypeImpl) each).getCode();
-                Collection<?> c = beginMap[parentCode];
-                if (c != null) {
-                    result.addAll((Collection<? extends AnnotationFS>) c);
-                }
-            }
-            return result;
-        } else {
-            if (set == null) {
-                return Collections.emptySet();
-            } else {
-                return set;
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public Collection<AnnotationFS> getEndAnchors(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        Collection<AnnotationFS> set = (Collection<AnnotationFS>) endMap[code];
-        if (lowMemoryProfile) {
-            Collection<AnnotationFS> result = new ArrayList<AnnotationFS>();
-            if (set != null) {
-                result.addAll(set);
-            }
-            List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
-            for (Type each : subsumedTypes) {
-                int parentCode = ((TypeImpl) each).getCode();
-                Collection<?> c = endMap[parentCode];
-                if (c != null) {
-                    result.addAll((Collection<? extends AnnotationFS>) c);
-                }
-            }
-            return result;
-        } else {
-            if (set == null) {
-                return Collections.emptySet();
-            } else {
-                return set;
-            }
-        }
-    }
-
-    public boolean beginsWith(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        Collection<?> set = beginMap[code];
-        boolean beginsWith = set != null && !set.isEmpty();
-        if (beginsWith) {
-            return true;
-        }
-        if (lowMemoryProfile) {
-            List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
-            for (Type each : subsumedTypes) {
-                if (beginsWith(each)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public boolean endsWith(Type type) {
-        int code = ((TypeImpl) type).getCode();
-        Collection<?> set = endMap[code];
-        boolean endswith = set != null && !set.isEmpty();
-        if (endswith) {
-            return true;
-        }
-        if (lowMemoryProfile) {
-            List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
-            for (Type each : subsumedTypes) {
-                if (endsWith(each)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    @SuppressWarnings("unchecked")
-    public void addBegin(AnnotationFS annotation, Type type) {
-        empty = false;
-        int code = ((TypeImpl) type).getCode();
-        Collection<Object> set = (Collection<Object>) beginMap[code];
-        if (set == null) {
-            set = new ArrayList<Object>(INITIAL_CAPACITY);
-            beginMap[code] = set;
-        }
-        set.add(annotation);
-        if (!lowMemoryProfile && !type.getName().equals(ROOT_TYPE1) && 
!type.getName().equals(ROOT_TYPE2)) {
-            TypeSystem typeSystem = getCAS().getTypeSystem();
-            Type parent = typeSystem.getParent(type);
-            if (parent != null) {
-                addBegin(annotation, parent);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void addEnd(AnnotationFS annotation, Type type) {
-        empty = false;
-        int code = ((TypeImpl) type).getCode();
-        Collection<Object> set = (Collection<Object>) endMap[code];
-        if (set == null) {
-            set = new ArrayList<Object>(INITIAL_CAPACITY);
-            endMap[code] = set;
-        }
-        set.add(annotation);
-        if (!lowMemoryProfile && !type.getName().equals(ROOT_TYPE1) && 
!type.getName().equals(ROOT_TYPE2)) {
-            TypeSystem typeSystem = getCAS().getTypeSystem();
-            Type parent = typeSystem.getParent(type);
-            if (parent != null) {
-                addEnd(annotation, parent);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void removeBegin(AnnotationFS annotation, Type type) {
-        int code = ((TypeImpl) type).getCode();
-        Collection<Object> set = (Collection<Object>) beginMap[code];
-        if (set != null) {
-            set.remove(annotation);
-            if (set.isEmpty()) {
-                beginMap[code] = null;
-            }
-        }
-        if (!lowMemoryProfile) {
-            TypeSystem typeSystem = getCAS().getTypeSystem();
-            Type parent = typeSystem.getParent(type);
-            if (parent != null) {
-                removeBegin(annotation, parent);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void removeEnd(AnnotationFS annotation, Type type) {
-        int code = ((TypeImpl) type).getCode();
-        Collection<Object> set = (Collection<Object>) endMap[code];
-        if (set != null) {
-            set.remove(annotation);
-            if (set.isEmpty()) {
-                endMap[code] = null;
-            }
-        }
-        if (!lowMemoryProfile) {
-            TypeSystem typeSystem = getCAS().getTypeSystem();
-            Type parent = typeSystem.getParent(type);
-            if (parent != null) {
-                removeEnd(annotation, parent);
-            }
-        }
-    }
-
-    public Collection<?>[] getBeginMap() {
-        return beginMap;
-    }
-
-    public Collection<?>[] getEndMap() {
-        return endMap;
-    }
-
-    public void setBeginMap(Collection<?>[] beginMap) {
-        this.beginMap = beginMap;
-        for (Collection<?> each : beginMap) {
-            if (each != null && !each.isEmpty()) {
-                this.empty = false;
-                break;
-            }
-        }
-    }
-
-    public void setEndMap(Collection<?>[] endMap) {
-        this.endMap = endMap;
-        for (Collection<?> each : endMap) {
-            if (each != null && !each.isEmpty()) {
-                this.empty = false;
-                break;
-            }
-        }
-    }
-
-    public void clearBeginMap() {
-        this.beginMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
-    }
-
-    public void clearEndMap() {
-        this.endMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
-        for (Collection<?> each : beginMap) {
-            if (each != null && !each.isEmpty()) {
-                return;
-            }
-        }
-        this.empty = true;
-    }
-
-    /** @generated
-     * @ordered 
-     */
-    @SuppressWarnings ("hiding")
-    public final static String _TypeName = 
"org.apache.uima.ruta.type.RutaBasic";
-    
-    /** @generated
-     * @ordered 
-     */
-    @SuppressWarnings ("hiding")
-    public final static int typeIndexID = 
JCasRegistry.register(RutaBasic.class);
-    /** @generated
-     * @ordered 
-     */
-    @SuppressWarnings ("hiding")
-    public final static int type = typeIndexID;
-    /** @generated
-     * @return index of the type  
-     */
-    @Override
-    public              int getTypeIndexID() {return typeIndexID;}
-   
-   
-    /* *******************
-     *   Feature Offsets *
-     * *******************/ 
-     
-    public final static String _FeatName_replacement = "replacement";
-
-
-    /* Feature Adjusted Offsets */
-    private final static CallSite _FC_replacement = 
TypeSystemImpl.createCallSite(RutaBasic.class, "replacement");
-    private final static MethodHandle _FH_replacement = 
_FC_replacement.dynamicInvoker();
-
-     
-    /** Never called.  Disable default constructor
-     * @generated */
-    protected RutaBasic() {/* intentionally empty block */}
-      
-    /** Internal - constructor used by generator 
-     * @generated
-     * @param casImpl the CAS this Feature Structure belongs to
-     * @param type the type of this Feature Structure 
-     */
-    public RutaBasic(TypeImpl type, CASImpl casImpl) {
-      super(type, casImpl);
-      readObject();
-    }
-    
-    /** @generated
-     * @param jcas JCas to which this Feature Structure belongs 
-     */
-    public RutaBasic(JCas jcas) {
-      super(jcas);
-      readObject();   
-    } 
-
-
-    /** @generated
-     * @param jcas JCas to which this Feature Structure belongs
-     * @param begin offset to the begin spot in the SofA
-     * @param end offset to the end spot in the SofA 
-    */  
-    public RutaBasic(JCas jcas, int begin, int end) {
-      super(jcas);
-      setBegin(begin);
-      setEnd(end);
-      readObject();
-    }   
-
-    /** 
-     * <!-- begin-user-doc -->
-     * Write your own initialization here
-     * <!-- end-user-doc -->
-     *
-     * @generated modifiable 
-     */
-    private void readObject() {/*default - does nothing empty block */}
-       
-   
-      
-    //*--------------*
-    //* Feature: replacement
-
-    /** getter for replacement - gets 
-     * @generated
-     * @return value of the feature 
-     */
-    public String getReplacement() { return 
_getStringValueNc(wrapGetIntCatchException(_FH_replacement));}
-      
-    /** setter for replacement - sets  
-     * @generated
-     * @param v value to set into the feature 
-     */
-    public void setReplacement(String v) {
-      _setStringValueNfc(wrapGetIntCatchException(_FH_replacement), v);
-    }    
-      
+  private int[] partOf = new int[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
+
+  private Collection<?>[] beginMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem())
+          .getLargestTypeCode()];
+
+  private Collection<?>[] endMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem())
+          .getLargestTypeCode()];
+
+  private boolean empty = true;
+
+  public boolean isEmpty() {
+    return empty;
+  }
+
+  public boolean isLowMemoryProfile() {
+    return lowMemoryProfile;
+  }
+
+  public void setLowMemoryProfile(boolean lowMemoryProfile) {
+    this.lowMemoryProfile = lowMemoryProfile;
+  }
+
+  public void addPartOf(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    addPartOf(code);
+  }
+
+  private void addPartOf(int code) {
+    partOf[code] = partOf[code] + 1;
+    if (!lowMemoryProfile) {
+      int parentCode = 
getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code);
+      if (parentCode > 0) {
+        addPartOf(parentCode);
+      }
+    }
+  }
+
+  public void removePartOf(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    removePartOf(code);
+  }
+
+  private void removePartOf(int code) {
+    if (partOf[code] != 0) {
+      partOf[code] = partOf[code] - 1;
+      if (!lowMemoryProfile) {
+        int parentCode = 
getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code);
+        if (parentCode > 0) {
+          removePartOf(parentCode);
+        }
+      }
+    }
+  }
+
+  public boolean isPartOf(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    int count = partOf[code];
+    if (count > 0) {
+      return true;
+    }
+    if (lowMemoryProfile) {
+      List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
+      for (Type each : subsumedTypes) {
+        int code2 = ((TypeImpl) each).getCode();
+        int count2 = partOf[code2];
+        if (count2 > 0) {
+          return true;
+        }
+      }
+
+    }
+    return false;
+
+  }
+
+  public void setPartOf(int[] partOf) {
+    this.partOf = partOf;
+  }
+  
+  public int[] getPartOf() {
+    return partOf;
+  }
+  
+  @SuppressWarnings("unchecked")
+  public Collection<AnnotationFS> getBeginAnchors(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    Collection<AnnotationFS> set = (Collection<AnnotationFS>) beginMap[code];
+    if (lowMemoryProfile) {
+      Collection<AnnotationFS> result = new ArrayList<AnnotationFS>();
+      if (set != null) {
+        result.addAll(set);
+      }
+      List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
+      for (Type each : subsumedTypes) {
+        int parentCode = ((TypeImpl) each).getCode();
+        Collection<?> c = beginMap[parentCode];
+        if (c != null) {
+          result.addAll((Collection<? extends AnnotationFS>) c);
+        }
+      }
+      return result;
+    } else {
+      if (set == null) {
+        return Collections.emptySet();
+      } else {
+        return set;
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public Collection<AnnotationFS> getEndAnchors(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    Collection<AnnotationFS> set = (Collection<AnnotationFS>) endMap[code];
+    if (lowMemoryProfile) {
+      Collection<AnnotationFS> result = new ArrayList<AnnotationFS>();
+      if (set != null) {
+        result.addAll(set);
+      }
+      List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
+      for (Type each : subsumedTypes) {
+        int parentCode = ((TypeImpl) each).getCode();
+        Collection<?> c = endMap[parentCode];
+        if (c != null) {
+          result.addAll((Collection<? extends AnnotationFS>) c);
+        }
+      }
+      return result;
+    } else {
+      if (set == null) {
+        return Collections.emptySet();
+      } else {
+        return set;
+      }
+    }
+  }
+
+  public boolean beginsWith(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    Collection<?> set = beginMap[code];
+    boolean beginsWith = set != null && !set.isEmpty();
+    if (beginsWith) {
+      return true;
+    }
+    if (lowMemoryProfile) {
+      List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
+      for (Type each : subsumedTypes) {
+        if (beginsWith(each)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  public boolean endsWith(Type type) {
+    int code = ((TypeImpl) type).getCode();
+    Collection<?> set = endMap[code];
+    boolean endswith = set != null && !set.isEmpty();
+    if (endswith) {
+      return true;
+    }
+    if (lowMemoryProfile) {
+      List<Type> subsumedTypes = 
getCAS().getTypeSystem().getProperlySubsumedTypes(type);
+      for (Type each : subsumedTypes) {
+        if (endsWith(each)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  @SuppressWarnings("unchecked")
+  public void addBegin(AnnotationFS annotation, Type type) {
+    empty = false;
+    int code = ((TypeImpl) type).getCode();
+    Collection<Object> set = (Collection<Object>) beginMap[code];
+    if (set == null) {
+      set = new ArrayList<Object>(INITIAL_CAPACITY);
+      beginMap[code] = set;
+    }
+    set.add(annotation);
+    if (!lowMemoryProfile && !type.getName().equals(ROOT_TYPE1)
+            && !type.getName().equals(ROOT_TYPE2)) {
+      TypeSystem typeSystem = getCAS().getTypeSystem();
+      Type parent = typeSystem.getParent(type);
+      if (parent != null) {
+        addBegin(annotation, parent);
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public void addEnd(AnnotationFS annotation, Type type) {
+    empty = false;
+    int code = ((TypeImpl) type).getCode();
+    Collection<Object> set = (Collection<Object>) endMap[code];
+    if (set == null) {
+      set = new ArrayList<Object>(INITIAL_CAPACITY);
+      endMap[code] = set;
+    }
+    set.add(annotation);
+    if (!lowMemoryProfile && !type.getName().equals(ROOT_TYPE1)
+            && !type.getName().equals(ROOT_TYPE2)) {
+      TypeSystem typeSystem = getCAS().getTypeSystem();
+      Type parent = typeSystem.getParent(type);
+      if (parent != null) {
+        addEnd(annotation, parent);
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public void removeBegin(AnnotationFS annotation, Type type) {
+    int code = ((TypeImpl) type).getCode();
+    Collection<Object> set = (Collection<Object>) beginMap[code];
+    if (set != null) {
+      set.remove(annotation);
+      if (set.isEmpty()) {
+        beginMap[code] = null;
+      }
+    }
+    if (!lowMemoryProfile) {
+      TypeSystem typeSystem = getCAS().getTypeSystem();
+      Type parent = typeSystem.getParent(type);
+      if (parent != null) {
+        removeBegin(annotation, parent);
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public void removeEnd(AnnotationFS annotation, Type type) {
+    int code = ((TypeImpl) type).getCode();
+    Collection<Object> set = (Collection<Object>) endMap[code];
+    if (set != null) {
+      set.remove(annotation);
+      if (set.isEmpty()) {
+        endMap[code] = null;
+      }
+    }
+    if (!lowMemoryProfile) {
+      TypeSystem typeSystem = getCAS().getTypeSystem();
+      Type parent = typeSystem.getParent(type);
+      if (parent != null) {
+        removeEnd(annotation, parent);
+      }
+    }
+  }
+
+  public Collection<?>[] getBeginMap() {
+    return beginMap;
+  }
+
+  public Collection<?>[] getEndMap() {
+    return endMap;
+  }
+
+  public void setBeginMap(Collection<?>[] beginMap) {
+    this.beginMap = beginMap;
+    for (Collection<?> each : beginMap) {
+      if (each != null && !each.isEmpty()) {
+        this.empty = false;
+        break;
+      }
+    }
+  }
+
+  public void setEndMap(Collection<?>[] endMap) {
+    this.endMap = endMap;
+    for (Collection<?> each : endMap) {
+      if (each != null && !each.isEmpty()) {
+        this.empty = false;
+        break;
+      }
+    }
+  }
+
+  public void clearBeginMap() {
+    this.beginMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem())
+            .getLargestTypeCode()];
+  }
+
+  public void clearEndMap() {
+    this.endMap = new ArrayList<?>[((TypeSystemImpl) 
getCAS().getTypeSystem()).getLargestTypeCode()];
+    for (Collection<?> each : beginMap) {
+      if (each != null && !each.isEmpty()) {
+        return;
+      }
+    }
+    this.empty = true;
+  }
+
+  /**
+   * @generated
+   * @ordered
+   */
+  @SuppressWarnings("hiding")
+  public final static String _TypeName = "org.apache.uima.ruta.type.RutaBasic";
+
+  /**
+   * @generated
+   * @ordered
+   */
+  @SuppressWarnings("hiding")
+  public final static int typeIndexID = JCasRegistry.register(RutaBasic.class);
+
+  /**
+   * @generated
+   * @ordered
+   */
+  @SuppressWarnings("hiding")
+  public final static int type = typeIndexID;
+
+  /**
+   * @generated
+   * @return index of the type
+   */
+  @Override
+  public int getTypeIndexID() {
+    return typeIndexID;
+  }
+
+  /*
+   * ******************* Feature Offsets *
+   *******************/
+
+  public final static String _FeatName_replacement = "replacement";
+
+  /* Feature Adjusted Offsets */
+  private final static CallSite _FC_replacement = 
TypeSystemImpl.createCallSite(RutaBasic.class,
+          "replacement");
+
+  private final static MethodHandle _FH_replacement = 
_FC_replacement.dynamicInvoker();
+
+  /**
+   * Never called. Disable default constructor
+   * 
+   * @generated
+   */
+  protected RutaBasic() {
+    /* intentionally empty block */}
+
+  /**
+   * Internal - constructor used by generator
+   * 
+   * @generated
+   * @param casImpl
+   *          the CAS this Feature Structure belongs to
+   * @param type
+   *          the type of this Feature Structure
+   */
+  public RutaBasic(TypeImpl type, CASImpl casImpl) {
+    super(type, casImpl);
+    readObject();
+  }
+
+  /**
+   * @generated
+   * @param jcas
+   *          JCas to which this Feature Structure belongs
+   */
+  public RutaBasic(JCas jcas) {
+    super(jcas);
+    readObject();
+  }
+
+  /**
+   * @generated
+   * @param jcas
+   *          JCas to which this Feature Structure belongs
+   * @param begin
+   *          offset to the begin spot in the SofA
+   * @param end
+   *          offset to the end spot in the SofA
+   */
+  public RutaBasic(JCas jcas, int begin, int end) {
+    super(jcas);
+    setBegin(begin);
+    setEnd(end);
+    readObject();
+  }
+
+  /**
+   * <!-- begin-user-doc --> Write your own initialization here <!-- 
end-user-doc -->
+   *
+   * @generated modifiable
+   */
+  private void readObject() {
+    /* default - does nothing empty block */}
+
+  // *--------------*
+  // * Feature: replacement
+
+  /**
+   * getter for replacement - gets
+   * 
+   * @generated
+   * @return value of the feature
+   */
+  public String getReplacement() {
+    return _getStringValueNc(wrapGetIntCatchException(_FH_replacement));
+  }
+
+  /**
+   * setter for replacement - sets
+   * 
+   * @generated
+   * @param v
+   *          value to set into the feature
+   */
+  public void setReplacement(String v) {
+    _setStringValueNfc(wrapGetIntCatchException(_FH_replacement), v);
+  }
 
 }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/action/MarkFastReloadTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/action/MarkFastReloadTest.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/action/MarkFastReloadTest.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/action/MarkFastReloadTest.java
 Mon Nov 18 12:19:31 2019
@@ -27,7 +27,7 @@ import org.apache.uima.ruta.engine.RutaE
 import org.apache.uima.ruta.engine.RutaTestUtils;
 import org.junit.Test;
 
-public class MarkFastReloadTest  {
+public class MarkFastReloadTest {
 
   @Test
   public void test() {
@@ -39,8 +39,10 @@ public class MarkFastReloadTest  {
       String ruleFileName = namespace + "/" + name + 
RutaEngine.SCRIPT_FILE_EXTENSION;
       String textFileName = namespace + "/" + name + ".txt";
       Map<String, Object> parameters = new HashMap<>();
-      parameters.put(RutaEngine.PARAM_ADDITIONAL_EXTENSIONS, new String[] 
{MarkReloadExtension.class.getName()});
-      cas = RutaTestUtils.process(ruleFileName, textFileName, parameters, 50, 
null,  null, namespace + "/", null);
+      parameters.put(RutaEngine.PARAM_ADDITIONAL_EXTENSIONS,
+              new String[] { MarkReloadExtension.class.getName() });
+      cas = RutaTestUtils.process(ruleFileName, textFileName, parameters, 50, 
null, null,
+              namespace + "/", null);
     } catch (Exception e) {
       e.printStackTrace();
       assert (false);
@@ -48,11 +50,10 @@ public class MarkFastReloadTest  {
 
     RutaTestUtils.assertAnnotationsEquals(cas, 1, 3, "1 0 0", "100", "2 0 0");
     RutaTestUtils.assertAnnotationsEquals(cas, 2, 0);
-    RutaTestUtils.assertAnnotationsEquals(cas, 3, 1, "100");
+    RutaTestUtils.assertAnnotationsEquals(cas, 3, 3, "1 0 0", "100", "2 0 0");
     RutaTestUtils.assertAnnotationsEquals(cas, 4, 2, "1 0 0", "2 0 0");
 
     cas.release();
   }
 
-    
 }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/type/TypeFromStringFunctionTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/type/TypeFromStringFunctionTest.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/type/TypeFromStringFunctionTest.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core-ext/src/test/java/org/apache/uima/ruta/type/TypeFromStringFunctionTest.java
 Mon Nov 18 12:19:31 2019
@@ -38,11 +38,14 @@ import org.apache.uima.ruta.engine.RutaE
 import org.apache.uima.ruta.engine.RutaTestUtils;
 import org.apache.uima.util.InvalidXMLException;
 import org.junit.Test;
+import org.xml.sax.SAXException;
 
 public class TypeFromStringFunctionTest {
 
   @Test
-  public void test() throws Exception {
+  public void test() throws ResourceInitializationException, 
InvalidXMLException, IOException,
+          AnalysisEngineProcessException, ResourceConfigurationException, 
URISyntaxException,
+          SAXException {
     String document = "This is a test.\n1900/12/24 and 
24.4.1982\nCW\norg.apache.uima.ruta.type.NUM";
 
     String script = "";
@@ -64,7 +67,7 @@ public class TypeFromStringFunctionTest
     t = RutaTestUtils.getTestType(cas, 1);
     ai = cas.getAnnotationIndex(t);
     assertEquals(7, ai.size());
-    
+
     t = RutaTestUtils.getTestType(cas, 2);
     ai = cas.getAnnotationIndex(t);
     assertEquals(8, ai.size());
@@ -72,6 +75,6 @@ public class TypeFromStringFunctionTest
     if (cas != null) {
       cas.release();
     }
-    
+
   }
 }

Modified: uima/uv3/ruta-v3/trunk/ruta-core/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/pom.xml?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- uima/uv3/ruta-v3/trunk/ruta-core/pom.xml (original)
+++ uima/uv3/ruta-v3/trunk/ruta-core/pom.xml Mon Nov 18 12:19:31 2019
@@ -30,22 +30,19 @@
   <name>Apache UIMA Ruta: ${project.artifactId}</name>
   
   <dependencies>
+  
     <dependency>
       <groupId>org.apache.uima</groupId>
       <artifactId>ruta-typesystem</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.uima</groupId>
       <artifactId>uimaj-core</artifactId>
       <version>${uimaVersion}</version>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
     </dependency>
+    
    <dependency>
       <groupId>org.antlr</groupId>
       <artifactId>antlr-runtime</artifactId>
@@ -57,34 +54,46 @@
         </exclusion>
       </exclusions>
     </dependency>
+    
     <dependency>
       <groupId>org.htmlparser</groupId>
       <artifactId>htmlparser</artifactId>
       <version>1.6</version>
     </dependency>
+    
+    <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-text</artifactId>
+          <version>1.6</version>
+       </dependency>
+    
     <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
       <version>3.2.1</version>
       <scope>compile</scope>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.uima</groupId>
       <artifactId>uimaj-tools</artifactId>
       <version>${uimaVersion}</version>
       <scope>compile</scope>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.uima</groupId>
       <artifactId>uimaj-test-util</artifactId>
       <version>${uimaVersion}</version>
       <scope>test</scope>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
       <version>3.8.1</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.uima</groupId>
       <artifactId>uimafit-core</artifactId>
@@ -102,12 +111,14 @@
         </exclusion>
       </exclusions>
     </dependency>
+    
     <!-- needed for ruta-ep-ide - TODO this should be moved to engine? -->
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <version>2.4</version>
     </dependency>
+    
     <!-- needed for ruta-ep-textruler/ruta-ep-addons - TODO this should be 
moved to engine? -->
     <dependency>
       <groupId>org.apache.commons</groupId>
@@ -115,6 +126,11 @@
       <version>3.0</version>
     </dependency>
     
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <scope>test</scope>
+    </dependency>
     
     <dependency>
       <groupId>org.slf4j</groupId>
@@ -148,6 +164,7 @@
                   
<exclude>src/test/resources/org/apache/uima/ruta/engine/*.html</exclude> <!-- 
test data -->
                   
<exclude>src/test/resources/META-INF/org.apache.uima.fit/types.txt</exclude> 
<!-- test data -->
                   
<exclude>src/main/resources/META-INF/org.apache.uima.fit/*.txt</exclude>
+                  <exclude>api-change-report/**</exclude>
                   <exclude>issuesFixed/**</exclude> <!-- generated -->
                   <exclude>input/**</exclude> <!-- temp test data -->
                   <exclude>TypeSystem.xml</exclude> <!-- temp test data -->

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g
 Mon Nov 18 12:19:31 2019
@@ -242,44 +242,57 @@ public void setExternalFactory(RutaExter
        
        public void addType(RutaBlock parent, Token nameToken, Token 
parentTypeToken, List featureTypes,
           List featureNames) {
-          String name = nameToken.getText();
-          String parentType = "uima.tcas.Annotation";
-          if(parentTypeToken != null) {
-               parentType = parentTypeToken.getText();
+          
+      
+          
+      String name = nameToken.getText();
+      String parentType = "uima.tcas.Annotation";
+      if(parentTypeToken != null) {
+        parentType = parentTypeToken.getText();
          }
+         
          String resolvedType = name;
+         
          if (!name.contains(".")) {
-           if(StringUtils.isBlank(moduleName)) {
-             resolvedType = namespace + "." + name;
+           List<String> typeNameParts = new ArrayList<>();
+           
+           if(parent != null && !StringUtils.isBlank(parent.getNamespace())) {
+             typeNameParts.add(parent.getNamespace());
            } else {
-             resolvedType = namespace + "." + moduleName + "." + name;
-           }
+             if(!StringUtils.isBlank(namespace)) {
+            typeNameParts.add(namespace);
+             }
+             if(!StringUtils.isBlank(moduleName)) {
+            typeNameParts.add(moduleName);
+          }
+        }
+           typeNameParts.add(name);
+           resolvedType = StringUtils.join(typeNameParts, ".");
          }
-          parent.getEnvironment().declareType(resolvedType);
-         if(descInfo != null) {
-                 name = parent.getNamespace() + "." + name.trim();
-                 String descriptionString = null;
-                 if(StringUtils.isBlank(namespace)) {
-                       if(StringUtils.isBlank(moduleName)) {
-                               descriptionString = "Type defined in unknown 
script.";
-                       } else {
-                               descriptionString = "Type defined in " + 
moduleName;
-                       }
-                         
-                         } else {
-                         descriptionString = "Type defined in " + 
parent.getNamespace();
-                 }
-                 descInfo.addType(name, descriptionString, parentType);
-                 if(featureTypes != null && featureNames != null) {
-                         for (int i = 0; i < featureTypes.size(); i++) {
-                                 Object object = featureTypes.get(i);
-                                 String ftype = (String) featureTypes.get(i);
-                                 String fname = (String) featureNames.get(i);
-                                 descInfo.addFeature(name, fname, fname, 
ftype);
-                         }
-                 }
+      parent.getEnvironment().declareType(resolvedType);
+      
+      if(descInfo != null) {
+        String descriptionString = null;
+        if(StringUtils.isBlank(namespace)) {
+          if(StringUtils.isBlank(moduleName)) {
+            descriptionString = "Type defined in unknown script.";
+             } else {
+            descriptionString = "Type defined in " + moduleName;
+          }
+               } else {
+          descriptionString = "Type defined in " + parent.getNamespace();
+        }
+        descInfo.addType(resolvedType, descriptionString, parentType);
+        if(featureTypes != null && featureNames != null) {
+          for (int i = 0; i < featureTypes.size(); i++) {
+            Object object = featureTypes.get(i);
+            String ftype = (String) featureTypes.get(i);
+            String fname = (String) featureNames.get(i);
+            descInfo.addFeature(resolvedType, fname, fname, ftype);
+          }
+               }
          }
-        }
+       }
        
        public boolean isType(RutaBlock parent, String type) {
                return parent.getEnvironment().getType(type) != null || 
type.equals("Document");

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
 Mon Nov 18 12:19:31 2019
@@ -156,6 +156,8 @@ public class RutaEnvironment {
 
   private Map<String, Object> variableValues;
 
+  private Map<String, Object> tempVariableValues;
+
   private Map<String, Class<?>> variableTypes;
 
   private Map<String, Class<?>> availableTypes;
@@ -195,6 +197,7 @@ public class RutaEnvironment {
     wordLists = new HashMap<String, RutaWordList>();
     tables = new HashMap<String, RutaTable>();
     variableValues = new HashMap<String, Object>();
+    tempVariableValues = new HashMap<String, Object>();
     variableTypes = new HashMap<String, Class<?>>();
     variableGenericTypes = new HashMap<String, Class<?>>();
     macroConditions = new HashMap<>();
@@ -638,6 +641,11 @@ public class RutaEnvironment {
   }
 
   public RutaWordList getWordList(String list) {
+
+    if (list == null) {
+      return null;
+    }
+
     RutaWordList result = wordLists.get(list);
     UimaContext context = owner.getContext();
     Boolean dictRemoveWS = false;
@@ -775,6 +783,7 @@ public class RutaEnvironment {
     variableTypes.remove(name);
     variableGenericTypes.remove(name);
     variableValues.remove(name);
+    tempVariableValues.remove(name);
   }
 
   public boolean ownsVariable(String name) {
@@ -841,8 +850,12 @@ public class RutaEnvironment {
     if (variableAliases.containsKey(name)) {
       name = variableAliases.get(name);
     }
+    Object result = null;
     boolean containsKey = variableValues.containsKey(name);
-    Object result = variableValues.get(name);
+    result = tempVariableValues.get(name);
+    if (result == null) {
+      result = variableValues.get(name);
+    }
 
     if (result instanceof String && type.equals(Type.class)) {
       // "cast" string to type, because initial values were set when there
@@ -976,6 +989,13 @@ public class RutaEnvironment {
     }
   }
 
+  public void setTempVariableValue(String name, Object value) {
+    if (variableAliases.containsKey(name)) {
+      name = variableAliases.get(name);
+    }
+    tempVariableValues.put(name, value);
+  }
+
   @SuppressWarnings("rawtypes")
   private List getList(ListExpression value) {
     if (value instanceof SimpleBooleanListExpression) {
@@ -1130,6 +1150,13 @@ public class RutaEnvironment {
     addAnnotationsToVariable(annotations, var, context);
   }
 
+  public void removeVariableValue(String var, MatchContext context) {
+    if (StringUtils.isBlank(var)) {
+      return;
+    }
+    setTempVariableValue(var, null);
+  }
+
   public void addAnnotationsToVariable(List<AnnotationFS> annotations, String 
var,
           MatchContext context) {
     if (StringUtils.isBlank(var)) {
@@ -1138,7 +1165,7 @@ public class RutaEnvironment {
 
     Class<?> variableType = getVariableType(var);
     if (List.class.equals(variableType) && 
AnnotationFS.class.equals(getVariableGenericType(var))) {
-      setVariableValue(var, annotations);
+      setTempVariableValue(var, annotations);
     } else if (AnnotationFS.class.equals(variableType)) {
       if (context.getDirection()) {
         AnnotationFS annotation = null;
@@ -1149,9 +1176,26 @@ public class RutaEnvironment {
             annotation = annotations.get(0);
           }
         }
-        setVariableValue(var, annotation);
+        setTempVariableValue(var, annotation);
+      }
+    }
+  }
+
+  public void acceptTempVariableValues(Collection<String> localVariables) {
+    for (String variableName : localVariables) {
+      if (tempVariableValues.containsKey(variableName)) {
+        Object value = tempVariableValues.get(variableName);
+        setVariableValue(variableName, value);
       }
     }
+
+    clearTempVariables(localVariables);
+  }
+
+  public void clearTempVariables(Collection<String> localVariables) {
+    for (String variableName : localVariables) {
+      tempVariableValues.remove(variableName);
+    }
   }
 
 }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
 Mon Nov 18 12:19:31 2019
@@ -365,9 +365,6 @@ public class RutaStream {
   private boolean indexType(Type type) {
     if (typeUsage != null) {
       boolean contains = 
typeUsage.getUsedTypesWithSubTypes().contains(type.getName());
-      // if(!contains) {
-      // System.out.println(type.getShortName());
-      // }
       return contains;
     }
     return true;

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/UIMAConstants.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/UIMAConstants.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/UIMAConstants.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/UIMAConstants.java
 Mon Nov 18 12:19:31 2019
@@ -20,9 +20,11 @@
 package org.apache.uima.ruta;
 
 public class UIMAConstants {
-  
+
   public static final String FEATURE_COVERED_TEXT = "coveredText";
 
   public static final String FEATURE_COVERED_TEXT_SHORT = "ct";
-  
+
+  public static final String FEATURE_TYPE = "type";
+
 }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GetFeatureAction.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GetFeatureAction.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GetFeatureAction.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GetFeatureAction.java
 Mon Nov 18 12:19:31 2019
@@ -20,6 +20,8 @@
 package org.apache.uima.ruta.action;
 
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.Feature;
@@ -33,7 +35,6 @@ import org.apache.uima.ruta.expression.s
 import org.apache.uima.ruta.rule.MatchContext;
 import org.apache.uima.ruta.rule.RuleElement;
 import org.apache.uima.ruta.rule.RuleMatch;
-import org.apache.uima.ruta.rule.RutaRuleElement;
 import org.apache.uima.ruta.visitor.InferenceCrowd;
 
 public class GetFeatureAction extends AbstractRutaAction {
@@ -52,32 +53,31 @@ public class GetFeatureAction extends Ab
   public void execute(MatchContext context, RutaStream stream, InferenceCrowd 
crowd) {
     RuleMatch match = context.getRuleMatch();
     RuleElement element = context.getElement();
-    // TODO refactor
     RutaBlock parent = element.getParent();
 
-    Type type = null;
-    if (element instanceof RutaRuleElement) {
-      type = ((RutaRuleElement) element).getMatcher().getType(parent, stream);
-    }
-    if (type == null) {
+    AnnotationFS annotation = context.getAnnotation();
+    if (annotation == null) {
       return;
     }
 
     String stringValue = featureStringExpression.getStringValue(context, 
stream);
-    Feature featureByBaseName = type.getFeatureByBaseName(stringValue);
+
     RutaEnvironment environment = parent.getEnvironment();
     List<AnnotationFS> matchedAnnotations = 
match.getMatchedAnnotationsOfElement(element);
     for (AnnotationFS annotationFS : matchedAnnotations) {
-      if (annotationFS.getType().getFeatureByBaseName(stringValue) == null) {
-        // TODO replace syso by logger
-        System.out.println("Can't access feature " + stringValue
-                + ", because it's not defined in the matched type: " + 
annotationFS.getType());
-        return;
+      Feature featureByBaseName = 
annotationFS.getType().getFeatureByBaseName(stringValue);
+      if (featureByBaseName == null) {
+        Logger.getLogger(this.getClass().getName()).log(Level.INFO,
+                "Can't access feature " + stringValue
+                        + ", because it's not defined in the matched type: "
+                        + annotationFS.getType().getName());
+        continue;
       }
 
       TypeSystem typeSystem = stream.getCas().getTypeSystem();
       Type range = featureByBaseName.getRange();
       String featName = range.getName();
+
       if (environment.getVariableType(variable).equals(String.class)
               && typeSystem.subsumes(typeSystem.getType(CAS.TYPE_NAME_STRING), 
range)) {
         Object value = annotationFS.getStringValue(featureByBaseName);

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/MacroAction.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/MacroAction.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/MacroAction.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/MacroAction.java
 Mon Nov 18 12:19:31 2019
@@ -98,6 +98,14 @@ public class MacroAction extends Abstrac
     }
   }
 
+  @Override
+  public void setLabel(String label) {
+    super.setLabel(label);
+    for (AbstractRutaAction action : actions) {
+      action.setLabel(label);
+    }
+  }
+
   public String getName() {
     return name;
   }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/ForEachBlock.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/ForEachBlock.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/ForEachBlock.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/ForEachBlock.java
 Mon Nov 18 12:19:31 2019
@@ -122,6 +122,9 @@ public class ForEachBlock extends RutaBl
   private boolean setRuleElementAnchorRecursively(RuleElement ruleElement) {
     if (ruleElement instanceof RutaRuleElement) {
       RutaMatcher matcher = ((RutaRuleElement) ruleElement).getMatcher();
+      if (matcher == null) {
+        return false;
+      }
       IRutaExpression expression = matcher.getExpression();
       if (expression instanceof AnnotationTypeExpression) {
         MatchReference reference = ((AnnotationTypeExpression) 
expression).getReference();

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/RutaScriptBlock.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/RutaScriptBlock.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/RutaScriptBlock.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/block/RutaScriptBlock.java
 Mon Nov 18 12:19:31 2019
@@ -30,6 +30,7 @@ import org.apache.uima.ruta.rule.Abstrac
 import org.apache.uima.ruta.rule.AbstractRuleMatch;
 import org.apache.uima.ruta.rule.RuleApply;
 import org.apache.uima.ruta.rule.RuleMatch;
+import org.apache.uima.ruta.rule.RutaMatcher;
 import org.apache.uima.ruta.rule.RutaRule;
 import org.apache.uima.ruta.rule.RutaRuleElement;
 import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -59,8 +60,12 @@ public class RutaScriptBlock extends Rut
           continue;
         }
         // TODO refactor!!
-        Type type = ((RutaRuleElement) 
rule.getRuleElements().get(0)).getMatcher()
-                .getType(getParent() == null ? this : getParent(), stream);
+        RutaMatcher matcher = ((RutaRuleElement) 
rule.getRuleElements().get(0)).getMatcher();
+        if (matcher == null) {
+          continue;
+        }
+
+        Type type = matcher.getType(getParent() == null ? this : getParent(), 
stream);
         RutaStream window = stream.getWindowStream(each, type);
         for (RutaStatement element : getElements()) {
           if (element != null) {

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
 Mon Nov 18 12:19:31 2019
@@ -67,8 +67,7 @@ public class NearCondition extends TypeS
     int minValue = min.getIntegerValue(context, stream);
     boolean forwardValue = forward.getBooleanValue(context, stream);
 
-    FSIterator<AnnotationFS> it = filtered.getBooleanValue(context, stream)
-            ? stream.getCurrentIterator()
+    FSIterator<AnnotationFS> it = filtered.getBooleanValue(context, stream) ? 
stream
             : stream.getUnfilteredBasicIterator();
     AnnotationFS pointer = null;
     if (forwardValue) {

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java
 Mon Nov 18 12:19:31 2019
@@ -32,6 +32,7 @@ import org.apache.uima.ruta.expression.t
 import org.apache.uima.ruta.rule.EvaluatedCondition;
 import org.apache.uima.ruta.rule.MatchContext;
 import org.apache.uima.ruta.rule.RuleElement;
+import org.apache.uima.ruta.rule.RutaMatcher;
 import org.apache.uima.ruta.rule.RutaRuleElement;
 import org.apache.uima.ruta.type.RutaBasic;
 import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -91,7 +92,10 @@ public class PositionCondition extends T
     List<Type> targetTypes = new ArrayList<Type>();
     if (element instanceof RutaRuleElement) {
       RutaRuleElement re = (RutaRuleElement) element;
-      targetTypes.add(re.getMatcher().getType(element.getParent(), stream));
+      RutaMatcher matcher = re.getMatcher();
+      if (matcher != null) {
+        targetTypes.add(matcher.getType(element.getParent(), stream));
+      }
     } else {
       targetTypes.add(annotation.getType());
     }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java
 Mon Nov 18 12:19:31 2019
@@ -399,8 +399,6 @@ public class RutaDescriptorBuilder {
     if (name.indexOf(".") == -1) {
       if (types.containsKey(name)) {
         name = types.get(name);
-      } else {
-        name = packageName + "." + name;
       }
     }
     int lastIndexOf = name.lastIndexOf(".");

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java
 Mon Nov 18 12:19:31 2019
@@ -50,6 +50,7 @@ import org.apache.uima.ruta.extensions.R
 import org.apache.uima.ruta.parser.RutaLexer;
 import org.apache.uima.ruta.parser.RutaParser;
 import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.Level;
 
 public class RutaDescriptorFactory {
 
@@ -229,7 +230,8 @@ public class RutaDescriptorFactory {
           }
         }
       } catch (Exception e) {
-        // System.out.println("EXTENSION ERROR: " + each);
+        UIMAFramework.getLogger(getClass()).log(Level.WARNING,
+                "Error loading external extension " + each, e);
       }
     }
     return factory;

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java
 Mon Nov 18 12:19:31 2019
@@ -27,8 +27,8 @@ import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.CAS;
@@ -258,7 +258,6 @@ public class HtmlConverter extends JCasA
       }
     }
 
-
     if (useSpaceGap) {
       gapText = " ";
     }
@@ -398,8 +397,9 @@ public class HtmlConverter extends JCasA
       Annotation clone = (Annotation) casCopier.copyFs(annotation);
       // change the view/sofa of the new annotation...
       // see: http://osdir.com/ml/apache.uima.general/2007-09/msg00107.html
-      clone.setFeatureValue(modview.getTypeSystem()
-              .getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFA), 
modview.getSofa());
+      clone.setFeatureValue(
+              
modview.getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFA),
+              modview.getSofa());
       final int mappedBegin = map[clone.getBegin()];
       final int mappedEnd = map[clone.getEnd()];
       if (mappedBegin < mappedEnd) {
@@ -473,7 +473,8 @@ public class HtmlConverter extends JCasA
     return this.handleConversion(visibleSpansSoFar, splitSeq, 
linebreakReplacement);
   }
 
-  private SortedSet<HtmlConverterPSpan> 
htmlDecoding(SortedSet<HtmlConverterPSpan> visibleSpansSoFar) {
+  private SortedSet<HtmlConverterPSpan> htmlDecoding(
+          SortedSet<HtmlConverterPSpan> visibleSpansSoFar) {
     TreeSet<HtmlConverterPSpan> copy = new 
TreeSet<HtmlConverterPSpan>(visibleSpansSoFar);
 
     Pattern patt = Pattern.compile("(&[a-zA-Z0-9]{2,6};)|(&#\\d{2,5};)");
@@ -515,7 +516,8 @@ public class HtmlConverter extends JCasA
   }
 
   private SortedSet<HtmlConverterPSpan> handleConversion(
-          SortedSet<HtmlConverterPSpan> visibleSpansSoFar, String 
patternString, String replacement) {
+          SortedSet<HtmlConverterPSpan> visibleSpansSoFar, String 
patternString,
+          String replacement) {
     TreeSet<HtmlConverterPSpan> copy = new 
TreeSet<HtmlConverterPSpan>(visibleSpansSoFar);
 
     Pattern patt = Pattern.compile(patternString);

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java
 Mon Nov 18 12:19:31 2019
@@ -390,8 +390,8 @@ public class RutaEngine extends JCasAnno
    */
   public static final String PARAM_DICT_REMOVE_WS = "dictRemoveWS";
 
-  @ConfigurationParameter(name = PARAM_DICT_REMOVE_WS, mandatory = false, 
defaultValue = "false")
-  private Boolean dictRemoveWS = false;
+  @ConfigurationParameter(name = PARAM_DICT_REMOVE_WS, mandatory = false, 
defaultValue = "true")
+  private Boolean dictRemoveWS = true;
 
   /**
    * If this parameter is set to any String value then this String/token is 
used to split columns in

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaTestUtils.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaTestUtils.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaTestUtils.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaTestUtils.java
 Mon Nov 18 12:19:31 2019
@@ -306,7 +306,7 @@ public class RutaTestUtils {
     Type t = getTestType(cas, typeId);
     Collection<AnnotationFS> select = CasUtil.select(cas, t);
     if (select.size() != expectedCnt) {
-      throw new AssertionError("size of expected annotations (" + expectedCnt
+      throw new RuntimeException("size of expected annotations (" + expectedCnt
               + ") does not match with actual size (" + select.size() + ").");
     }
     if (expecteds.length > 0) {
@@ -314,7 +314,7 @@ public class RutaTestUtils {
       for (String expected : expecteds) {
         String actual = iterator.next().getCoveredText();
         if (!actual.equals(expected)) {
-          throw new AssertionError(
+          throw new RuntimeException(
                   "expected text (" + expected + ") does not match with actual 
(" + actual + ").");
         }
       }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/AnnotationTypeExpression.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/AnnotationTypeExpression.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/AnnotationTypeExpression.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/AnnotationTypeExpression.java
 Mon Nov 18 12:19:31 2019
@@ -111,7 +111,9 @@ public class AnnotationTypeExpression ex
       } else {
         Type type = getType(context, stream);
         types = new ArrayList<>(1);
-        types.add(type);
+        if (type != null) {
+          types.add(type);
+        }
       }
       for (Type type : types) {
 
@@ -165,6 +167,12 @@ public class AnnotationTypeExpression ex
     if (!initialized) {
       initialize(context, stream);
     }
+
+    if (typeExpression == null && typeListExpression == null && 
annotationExpression == null
+            && annotationListExpression == null) {
+      return null;
+    }
+
     if (typeExpression != null) {
       return typeExpression.getType(context, stream);
     } else {
@@ -200,7 +208,7 @@ public class AnnotationTypeExpression ex
     }
     if (annotationListExpression != null) {
       List<AnnotationFS> result = 
annotationListExpression.getAnnotationList(context, stream);
-      if (featureExpression != null) {
+      if (result != null && featureExpression != null) {
         return new ArrayList<>(featureExpression.getAnnotations(result, true, 
context, stream));
       } else {
         return result;

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/ExpressionFactory.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/ExpressionFactory.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/ExpressionFactory.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/ExpressionFactory.java
 Mon Nov 18 12:19:31 2019
@@ -25,6 +25,7 @@ import java.util.List;
 import org.antlr.runtime.Token;
 import org.apache.uima.cas.CAS;
 import org.apache.uima.ruta.TypeUsageInformation;
+import org.apache.uima.ruta.UIMAConstants;
 import org.apache.uima.ruta.block.RutaBlock;
 import org.apache.uima.ruta.condition.AbstractRutaCondition;
 import org.apache.uima.ruta.condition.AndCondition;
@@ -210,12 +211,34 @@ public class ExpressionFactory {
   }
 
   public ITypeExpression createSimpleTypeExpression(String typeString, 
RutaBlock parent) {
+    if (typeString.endsWith("." + UIMAConstants.FEATURE_TYPE)) {
+      return createTypeFeatureExpression(typeString, parent);
+    }
+
     if (typeUsage != null) {
       typeUsage.addMentionedType(typeString);
     }
     return new SimpleTypeExpression(typeString);
   }
 
+  public ITypeExpression createTypeFeatureExpression(String typeString, 
RutaBlock parent) {
+    MatchReference matchReference = createMatchReference(typeString);
+    return createTypeFeatureExpression(matchReference);
+  }
+
+  public ITypeExpression createTypeFeatureExpression(FeatureExpression 
featureExpression) {
+    if (featureExpression instanceof SimpleFeatureExpression) {
+      return createTypeFeatureExpression(
+              ((SimpleFeatureExpression) 
featureExpression).getMatchReference());
+    }
+    return null;
+  }
+
+  private ITypeExpression createTypeFeatureExpression(MatchReference 
matchReference) {
+    AnnotationTypeExpression typeExpression = 
createAnnotationTypeExpression(matchReference);
+    return typeExpression;
+  }
+
   public IBooleanExpression createBooleanFunction(Token op, IBooleanExpression 
e1,
           IBooleanExpression e2) {
     return new SimpleBooleanFunction(op.getText(), e1, e2);

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/MatchReference.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/MatchReference.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/MatchReference.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/MatchReference.java
 Mon Nov 18 12:19:31 2019
@@ -27,6 +27,7 @@ import org.apache.uima.ruta.RutaConstant
 import org.apache.uima.ruta.RutaEnvironment;
 import org.apache.uima.ruta.RutaStream;
 import org.apache.uima.ruta.block.RutaBlock;
+import 
org.apache.uima.ruta.expression.annotation.AnnotationListDelegateVariableExpression;
 import 
org.apache.uima.ruta.expression.annotation.AnnotationListVariableExpression;
 import 
org.apache.uima.ruta.expression.annotation.AnnotationListVariableIndexExpression;
 import org.apache.uima.ruta.expression.annotation.AnnotationVariableExpression;
@@ -164,6 +165,7 @@ public class MatchReference extends Ruta
         return true;
       } else if (environment.isVariableOfType(candidate, 
RutaConstants.RUTA_VARIABLE_ANNOTATION)) {
         annotationExpression = new AnnotationVariableExpression(candidate);
+        annotationListExpression = new 
AnnotationListDelegateVariableExpression(candidate);
         return true;
       } else if (environment.isVariableOfType(candidate,
               RutaConstants.RUTA_VARIABLE_ANNOTATION_LIST)) {

Added: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/annotation/AnnotationListDelegateVariableExpression.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/annotation/AnnotationListDelegateVariableExpression.java?rev=1869967&view=auto
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/annotation/AnnotationListDelegateVariableExpression.java
 (added)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/annotation/AnnotationListDelegateVariableExpression.java
 Mon Nov 18 12:19:31 2019
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.expression.annotation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.block.RutaBlock;
+import org.apache.uima.ruta.rule.MatchContext;
+
+public class AnnotationListDelegateVariableExpression extends 
AbstractAnnotationListExpression {
+
+  private String var;
+
+  public AnnotationListDelegateVariableExpression(String var) {
+    super();
+    this.var = var;
+  }
+
+  @Override
+  public List<AnnotationFS> getList(MatchContext context, RutaStream stream) {
+
+    RutaBlock parent = context.getParent();
+    AnnotationFS variableValue = parent.getEnvironment().getVariableValue(var, 
AnnotationFS.class,
+            stream);
+
+    if (variableValue != null) {
+      return Arrays.asList(variableValue);
+    }
+
+    return null;
+  }
+
+}

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/FeatureMatchExpression.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/FeatureMatchExpression.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/FeatureMatchExpression.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/FeatureMatchExpression.java
 Mon Nov 18 12:19:31 2019
@@ -41,6 +41,7 @@ import org.apache.uima.ruta.expression.a
 import org.apache.uima.ruta.expression.bool.IBooleanExpression;
 import org.apache.uima.ruta.expression.number.INumberExpression;
 import org.apache.uima.ruta.expression.string.IStringExpression;
+import org.apache.uima.ruta.expression.type.ITypeExpression;
 import org.apache.uima.ruta.rule.MatchContext;
 
 public class FeatureMatchExpression extends SimpleFeatureExpression {
@@ -88,7 +89,14 @@ public class FeatureMatchExpression exte
           RutaStream stream) {
     Type featureRangeType = null;
     TypeSystem typeSystem = stream.getCas().getTypeSystem();
-    if (feature instanceof CoveredTextFeature) {
+    if (feature instanceof TypeFeature) {
+      if (getArg() instanceof ITypeExpression) {
+        Type t1 = fs.getType();
+        ITypeExpression expr = (ITypeExpression) getArg();
+        Type t2 = expr.getType(context, stream);
+        return compare(t1, t2);
+      }
+    } else if (feature instanceof CoveredTextFeature) {
       featureRangeType = typeSystem.getType(CAS.TYPE_NAME_STRING);
     } else if (feature != null) {
       featureRangeType = feature.getRange();

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/GenericFeatureExpression.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/GenericFeatureExpression.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/GenericFeatureExpression.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/GenericFeatureExpression.java
 Mon Nov 18 12:19:31 2019
@@ -49,6 +49,8 @@ public class GenericFeatureExpression ex
 
   private FeatureExpression featureExpression;
 
+  private ITypeExpression typeExpression;
+
   private INumberExpression numberExpression;
 
   private IStringExpression stringExpression;
@@ -66,7 +68,7 @@ public class GenericFeatureExpression ex
   private IAnnotationListExpression annotationListExpression;
 
   private ExpressionFactory expressionFactory;
-  
+
   public GenericFeatureExpression(FeatureExpression fe) {
     super();
     this.featureExpression = fe;
@@ -128,14 +130,19 @@ public class GenericFeatureExpression ex
     }
     return annotationExpression.getFeatureStructure(context, stream);
   }
-  
-  
+
   @Override
   public Type getType(MatchContext context, RutaStream stream) {
+    if (typeExpression == null) {
+      typeExpression = 
expressionFactory.createTypeFeatureExpression(featureExpression);
+    }
+    if (typeExpression != null) {
+      return typeExpression.getType(context, stream);
+    }
     // special case where an argument is interpreted as a type expression
     return featureExpression.getInitialType(context, stream);
   }
-  
+
   public FeatureExpression getFeatureExpression() {
     return featureExpression;
   }
@@ -200,5 +207,4 @@ public class GenericFeatureExpression ex
     return result;
   }
 
-
 }

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/SimpleFeatureExpression.java
 Mon Nov 18 12:19:31 2019
@@ -100,6 +100,8 @@ public class SimpleFeatureExpression ext
           // also allow for unknown types
           feature = new CoveredTextFeature();
         }
+      } else if (StringUtils.equals(each, UIMAConstants.FEATURE_TYPE)) {
+        feature = new TypeFeature();
       } else if (type == null || type.isArray()) {
         // lazy check of range
         feature = new LazyFeature(each, context.getParent());
@@ -229,8 +231,8 @@ public class SimpleFeatureExpression ext
     }
 
     if (currentFeature == null || currentFeature instanceof CoveredTextFeature
-            || currentFeature.getRange().isPrimitive()) {
-      // feature == null -> this is the coveredText "feature"
+            || currentFeature instanceof TypeFeature || 
currentFeature.getRange().isPrimitive()) {
+      // feature == null -> this is not a real feature
       if (this instanceof FeatureMatchExpression) {
         FeatureMatchExpression fme = (FeatureMatchExpression) this;
         if (checkOnFeatureValue) {

Added: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/TypeFeature.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/TypeFeature.java?rev=1869967&view=auto
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/TypeFeature.java
 (added)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/TypeFeature.java
 Mon Nov 18 12:19:31 2019
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.ruta.expression.feature;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+
+public class TypeFeature implements Feature {
+
+  public TypeFeature() {
+    super();
+  }
+  
+  @Override
+  public int compareTo(Feature o) {
+    return 0;
+  }
+
+  @Override
+  public Type getDomain() {
+    return null;
+  }
+
+  @Override
+  public Type getRange() {
+    return null;
+  }
+
+  @Override
+  public String getName() {
+    return null;
+  }
+
+  @Override
+  public String getShortName() {
+    return null;
+  }
+
+  @Override
+  public boolean isMultipleReferencesAllowed() {
+    return false;
+  }
+
+}

Added: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/type/TypeFeatureExpression.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/type/TypeFeatureExpression.java?rev=1869967&view=auto
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/type/TypeFeatureExpression.java
 (added)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/expression/type/TypeFeatureExpression.java
 Mon Nov 18 12:19:31 2019
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.expression.type;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.expression.feature.FeatureExpression;
+import org.apache.uima.ruta.rule.MatchContext;
+
+public class TypeFeatureExpression extends AbstractTypeExpression {
+
+  private FeatureExpression fe;
+
+  public TypeFeatureExpression(FeatureExpression fe) {
+
+    super();
+    this.fe = fe;
+  }
+
+  @Override
+  public Type getType(MatchContext context, RutaStream stream) {
+
+    return null;
+  }
+
+  public FeatureExpression getFe() {
+
+    return this.fe;
+  }
+
+  public void setFe(FeatureExpression fe) {
+
+    this.fe = fe;
+  }
+
+  @Override
+  public String getStringValue(MatchContext context, RutaStream stream) {
+    Type type = getType(context, stream);
+    if (type != null) {
+      return type.getName();
+    }
+    return null;
+  }
+
+}

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/EditDistanceCostMap.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/EditDistanceCostMap.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/EditDistanceCostMap.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/EditDistanceCostMap.java
 Mon Nov 18 12:19:31 2019
@@ -29,6 +29,9 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.util.Level;
+
 /**
  * Class EditDistanceMap.
  * 
@@ -155,7 +158,7 @@ public class EditDistanceCostMap {
     try {
       br = new BufferedReader(new FileReader(new File(file)));
     } catch (FileNotFoundException e) {
-      System.err.println("File not found.");
+      UIMAFramework.getLogger(getClass()).log(Level.WARNING, "File not found: 
" + file, e);
       return false;
     }
 
@@ -188,7 +191,6 @@ public class EditDistanceCostMap {
 
             // The "strings" should have just one character.
             if (cArray.length != 1) {
-              System.err.println("Invalid format.");
               retValue = false;
               continue;
             }
@@ -207,7 +209,6 @@ public class EditDistanceCostMap {
             char[] dArray = line[2].toCharArray();
 
             if (cArray.length != 1 || dArray.length != 1) {
-              System.err.println("Invalid format.");
               retValue = false;
               continue;
             }
@@ -221,18 +222,14 @@ public class EditDistanceCostMap {
             defaultCosts = value;
 
           } else {
-            System.err.println("Invalid EditDistance" + "CostMap-Operation.");
             retValue = false;
           }
 
         } catch (StringIndexOutOfBoundsException e) {
-          System.err.println("String Index out of bounds.");
           retValue = false;
         } catch (IndexOutOfBoundsException e) {
-          System.err.println("Index out of bounds.");
           retValue = false;
         } catch (NumberFormatException e) {
-          System.err.println("Number Format Error.");
           retValue = false;
         }
       }
@@ -240,7 +237,6 @@ public class EditDistanceCostMap {
       br.close();
 
     } catch (IOException e) {
-      System.err.println("IO-Error.");
       return false;
     }
 

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
 Mon Nov 18 12:19:31 2019
@@ -38,6 +38,7 @@ import java.util.Set;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.Feature;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.TypeSystem;
@@ -98,6 +99,10 @@ public class MultiTreeWordList implement
     this.root = new MultiTextNode();
     this.costMap = new EditDistanceCostMap();
 
+    if (lists == null) {
+      return;
+    }
+
     for (Resource list : lists) {
       // check if the resource is a directory
       File directory = null;
@@ -154,6 +159,11 @@ public class MultiTreeWordList implement
   public MultiTreeWordList(String[] pathnames, File base) throws IOException {
     this.root = new MultiTextNode();
     this.costMap = new EditDistanceCostMap();
+
+    if (pathnames == null) {
+      return;
+    }
+
     for (String pathname : pathnames) {
       String name = getRelativePath(new File(pathname), base);
       load(new FileSystemResource(pathname), name);
@@ -171,6 +181,11 @@ public class MultiTreeWordList implement
   public MultiTreeWordList(List<File> files, File base) throws IOException {
     this.root = new MultiTextNode();
     this.costMap = new EditDistanceCostMap();
+
+    if (files == null) {
+      return;
+    }
+
     for (File file : files) {
       String name = getRelativePath(file, base);
       load(new FileSystemResource(file), name);

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
 Mon Nov 18 12:19:31 2019
@@ -36,7 +36,7 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.internal.util.XMLUtils;
@@ -144,6 +144,11 @@ public class TreeWordList implements Rut
 
   public void buildNewTree(List<String> data) {
     this.root = new TextNode();
+
+    if (data == null) {
+      return;
+    }
+
     for (String s : data) {
       addWord(s);
     }
@@ -191,6 +196,11 @@ public class TreeWordList implements Rut
    */
   public void addWord(String s) {
     // Create Nodes from all chars of the strings besides the last one
+
+    if (s == null) {
+      return;
+    }
+
     TextNode pointer = root;
     for (Character each : s.toCharArray()) {
       if (dictRemoveWS && Character.isWhitespace(each)) {
@@ -258,7 +268,7 @@ public class TreeWordList implements Rut
 
       TextNode wsNode = pointer.getChildNode(' ');
       if (ignoreWS && wsNode != null) {
-        result |= recursiveContains(wsNode, text, --next, ignoreCase, 
fragment, ignoreChars,
+        result |= recursiveContains(wsNode, text, next - 1, ignoreCase, 
fragment, ignoreChars,
                 maxIgnoreChars, ignoreWS);
       }
 
@@ -282,7 +292,7 @@ public class TreeWordList implements Rut
     } else {
       TextNode wsNode = pointer.getChildNode(' ');
       if (ignoreWS && wsNode != null) {
-        result |= recursiveContains(wsNode, text, --next, ignoreCase, 
fragment, ignoreChars,
+        result |= recursiveContains(wsNode, text, next - 1, ignoreCase, 
fragment, ignoreChars,
                 maxIgnoreChars, ignoreWS);
       }
 
@@ -319,7 +329,7 @@ public class TreeWordList implements Rut
           char[] ignoreChars, int maxIgnoredChars, boolean ignoreWS) {
     ArrayList<AnnotationFS> results = new ArrayList<AnnotationFS>();
     stream.moveToFirst();
-    RutaStream streamPointer = stream.copy();
+    FSIterator<AnnotationFS> streamPointer = stream.copy();
     while (stream.isValid()) {
       RutaBasic anchorBasic = (RutaBasic) stream.get();
       streamPointer.moveTo(anchorBasic);

Modified: 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/XMLEventHandler.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/XMLEventHandler.java?rev=1869967&r1=1869966&r2=1869967&view=diff
==============================================================================
--- 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/XMLEventHandler.java
 (original)
+++ 
uima/uv3/ruta-v3/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/XMLEventHandler.java
 Mon Nov 18 12:19:31 2019
@@ -21,7 +21,7 @@ package org.apache.uima.ruta.resource;
 
 import java.util.Stack;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.helpers.DefaultHandler;
 


Reply via email to