Merge branch 'master' into UIMA-6261-verbalization-NullExpression
diff --git a/README b/README
index 9631e49..49770b6 100644
--- a/README
+++ b/README
@@ -1,7 +1,10 @@
 

-Apache UIMA Ruta (TM) v2.8.1

+Apache UIMA Ruta (TM) v3.0.1

 -------------------------------------------------------------------------

 

+This release is compatible with UIMA v3, but not compatible with UIMA v2. 

+For compatibility to UIMA v2, please refer to the latest UIMA Ruta v2 release, e.g., 2.8.0.

+

 Building from the Source Distribution

 -------------------------------------

 

diff --git a/RELEASE_NOTES.html b/RELEASE_NOTES.html
index d660e5a..e97ef5d 100644
--- a/RELEASE_NOTES.html
+++ b/RELEASE_NOTES.html
@@ -21,10 +21,10 @@
    -->

 

 <head>

-  <title>Apache UIMA Ruta v2.8.1 Release Notes</title>

+  <title>Apache UIMA Ruta v3.0.1 Release Notes</title>

 </head>

 <body>

-<h1>Apache UIMA Ruta&#8482; v2.8.1 Release Notes</h1>

+<h1>Apache UIMA Ruta&#8482; v3.0.1 Release Notes</h1>

 

 <h2>Contents</h2>

 <p>

@@ -37,18 +37,23 @@
    

 <h2><a name="what.is.uima-ruta">1. What is UIMA Ruta?</a></h2>

 

-     <p>

-  			Apache UIMA Ruta&#8482; is a rule-based script language supported by Eclipse-based tooling.

-      The language is designed to enable rapid development of text processing applications within Apache UIMA&#8482;. 

-      A special focus lies on the intuitive and flexible domain specific language for defining 

-      patterns of annotations. The Eclipse-based tooling for Ruta, called the Ruta Workbench,

-      was created to support the user and to facilitate every step when writing Ruta rules. Both the 

-      Ruta rule language and the Ruta Workbench integrate smoothly with Apache UIMA.

-			</p>

+<p>

+  Apache UIMA Ruta&#8482; is a rule-based script language supported by Eclipse-based tooling.

+  The language is designed to enable rapid development of text processing applications within Apache UIMA&#8482;. 

+  A special focus lies on the intuitive and flexible domain specific language for defining 

+  patterns of annotations. The Eclipse-based tooling for Ruta, called the Ruta Workbench,

+  was created to support the user and to facilitate every step when writing Ruta rules. Both the 

+  Ruta rule language and the Ruta Workbench integrate smoothly with Apache UIMA.

+</p>

 

 <h2><a name="major.changes">2. Major Changes in this Release</a></h2>

 

 <p>

+  This release provides compatibility to UIMA v3. An upgrade from UIMA Ruta v2 to this version requires 

+  also an update to UIMA v3 of the overall application or Eclipse installation. Please refer to the 

+  UIMA v3 user's guide for detailed information: https://uima.apache.org/d/uimaj-3.0.0/version_3_users_guide.html

+</p>

+<p>

   <p>UIMA Ruta Language and Analysis Engine:</p>

   <ul>

   	<li>Fixed broken literal string matching.</li>

diff --git a/example-projects/ruta-ep-example-extensions/.gitignore b/example-projects/ruta-ep-example-extensions/.gitignore
index 718773c..7e3a306 100644
--- a/example-projects/ruta-ep-example-extensions/.gitignore
+++ b/example-projects/ruta-ep-example-extensions/.gitignore
@@ -1 +1 @@
-META-INF/
+META-INF/
\ No newline at end of file
diff --git a/example-projects/ruta-ep-example-extensions/pom.xml b/example-projects/ruta-ep-example-extensions/pom.xml
index 01f358d..34bf878 100644
--- a/example-projects/ruta-ep-example-extensions/pom.xml
+++ b/example-projects/ruta-ep-example-extensions/pom.xml
@@ -27,7 +27,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-ep-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../../ruta-ep-parent/pom.xml</relativePath>

   </parent>

   <properties>

diff --git a/example-projects/ruta-maven-example/pom.xml b/example-projects/ruta-maven-example/pom.xml
index 7df423a..6514e1c 100644
--- a/example-projects/ruta-maven-example/pom.xml
+++ b/example-projects/ruta-maven-example/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../../ruta-parent/pom.xml</relativePath>
   </parent>
   <url>${uimaWebsiteUrl}</url>
diff --git a/pom.xml b/pom.xml
index a33cdaa..2e2e028 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>ruta-parent/pom.xml</relativePath>

   </parent>

 

@@ -35,10 +35,10 @@
   <description>The top project for Apache UIMA Ruta</description>

   <url>${uimaWebsiteUrl}</url>

   <properties>

-    <jiraVersion>12346562</jiraVersion>

-    <!--

-      <assembly.attach>false</assembly.attach>

-    -->

+    <jiraVersion>12346599</jiraVersion>

+    <!-- 

+     <assembly.attach>false</assembly.attach>

+     -->

   </properties>

 

   <!-- override pom setting in the build project. JIRA 5.1 needs different URL -->

diff --git a/ruta-basic-type/pom.xml b/ruta-basic-type/pom.xml
index 45ad6c6..ca57fe1 100644
--- a/ruta-basic-type/pom.xml
+++ b/ruta-basic-type/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-parent/pom.xml</relativePath>
   </parent>
 
diff --git a/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java b/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
index a2b80f6..dd204b5 100644
--- a/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
+++ b/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
@@ -18,6 +18,8 @@
  */
 package org.apache.uima.ruta.type;
 
+import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandle;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -25,18 +27,17 @@
 
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.impl.CASImpl;
 import org.apache.uima.cas.impl.TypeImpl;
 import org.apache.uima.cas.impl.TypeSystemImpl;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.JCasRegistry;
-import org.apache.uima.jcas.cas.TOP_Type;
 import org.apache.uima.jcas.tcas.Annotation;
 
 /**
- * Updated by JCasGen Thu Jul 12 10:42:33 CEST 2012 XML source:
- * D:/work/workspace-uima6/uimaj-ruta/src
- * /main/java/org/apache/uima/ruta/engine/InternalTypeSystem.xml
+ * 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
  */
@@ -348,45 +349,85 @@
    * @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 */
+  /**
+   * @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 */
-  }
+  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(int addr, TOP_Type type) {
-    super(addr, type);
+  public RutaBasic(TypeImpl type, CASImpl casImpl) {
+    super(type, casImpl);
     readObject();
   }
 
-  /** @generated */
+  /**
+   * @generated
+   * @param jcas
+   *          JCas to which this Feature Structure belongs
+   */
   public RutaBasic(JCas jcas) {
     super(jcas);
     readObject();
   }
 
-  /** @generated */
+  /**
+   * @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);
@@ -396,36 +437,34 @@
 
   /**
    * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
-   * 
+   *
    * @generated modifiable
    */
   private void readObject() {
-  }
+    /* default - does nothing empty block */}
 
   // *--------------*
-  // * Feature: Replacement
+  // * Feature: replacement
 
   /**
-   * getter for Replacement - gets
+   * getter for replacement - gets
    * 
    * @generated
+   * @return value of the feature
    */
   public String getReplacement() {
-    if (RutaBasic_Type.featOkTst && ((RutaBasic_Type) jcasType).casFeat_replacement == null)
-      jcasType.jcas.throwFeatMissing("replacement", "org.apache.uima.ruta.type.RutaBasic");
-    return jcasType.ll_cas.ll_getStringValue(addr,
-            ((RutaBasic_Type) jcasType).casFeatCode_replacement);
+    return _getStringValueNc(wrapGetIntCatchException(_FH_replacement));
   }
 
   /**
-   * setter for Replacement - sets
+   * setter for replacement - sets
    * 
    * @generated
+   * @param v
+   *          value to set into the feature
    */
   public void setReplacement(String v) {
-    if (RutaBasic_Type.featOkTst && ((RutaBasic_Type) jcasType).casFeat_replacement == null)
-      jcasType.jcas.throwFeatMissing("replacement", "org.apache.uima.ruta.type.RutaBasic");
-    jcasType.ll_cas.ll_setStringValue(addr, ((RutaBasic_Type) jcasType).casFeatCode_replacement, v);
+    _setStringValueNfc(wrapGetIntCatchException(_FH_replacement), v);
   }
 
 }
diff --git a/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic_Type.java b/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic_Type.java
deleted file mode 100644
index 0b6f364..0000000
--- a/ruta-basic-type/src/main/java/org/apache/uima/ruta/type/RutaBasic_Type.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.type;
-
-import org.apache.uima.cas.Feature;
-import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.cas.Type;
-import org.apache.uima.cas.impl.CASImpl;
-import org.apache.uima.cas.impl.FSGenerator;
-import org.apache.uima.cas.impl.FeatureImpl;
-import org.apache.uima.cas.impl.TypeImpl;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
-import org.apache.uima.jcas.tcas.Annotation_Type;
-
-/**
- * Updated by JCasGen Thu Jul 12 10:42:33 CEST 2012
- * 
- * @generated
- */
-public class RutaBasic_Type extends Annotation_Type {
-  /** @generated */
-  @SuppressWarnings({ "unchecked", "rawtypes" })
-  protected FSGenerator getFSGenerator() {
-    return fsGenerator;
-  }
-
-  /** @generated */
-  @SuppressWarnings("rawtypes")
-  private final FSGenerator fsGenerator = new FSGenerator() {
-    public FeatureStructure createFS(int addr, CASImpl cas) {
-      if (RutaBasic_Type.this.useExistingInstance) {
-        // Return eq fs instance if already created
-        FeatureStructure fs = RutaBasic_Type.this.jcas.getJfsFromCaddr(addr);
-        if (null == fs) {
-          fs = new RutaBasic(addr, RutaBasic_Type.this);
-          RutaBasic_Type.this.jcas.putJfsFromCaddr(addr, fs);
-          return fs;
-        }
-        return fs;
-      } else
-        return new RutaBasic(addr, RutaBasic_Type.this);
-    }
-  };
-
-  /** @generated */
-  public final static int typeIndexID = RutaBasic.typeIndexID;
-
-  /**
-   * @generated
-   * @modifiable
-   */
-  public final static boolean featOkTst = JCasRegistry
-          .getFeatOkTst("org.apache.uima.ruta.type.RutaBasic");
-
-  /** @generated */
-  final Feature casFeat_replacement;
-
-  /** @generated */
-  final int casFeatCode_replacement;
-
-  /** @generated */
-  public String getReplacement(int addr) {
-    if (featOkTst && casFeat_replacement == null)
-      jcas.throwFeatMissing("replacement", "org.apache.uima.ruta.type.RutaBasic");
-    return ll_cas.ll_getStringValue(addr, casFeatCode_replacement);
-  }
-
-  /** @generated */
-  public void setReplacement(int addr, String v) {
-    if (featOkTst && casFeat_replacement == null)
-      jcas.throwFeatMissing("replacement", "org.apache.uima.ruta.type.RutaBasic");
-    ll_cas.ll_setStringValue(addr, casFeatCode_replacement, v);
-  }
-
-  /**
-   * initialize variables to correspond with Cas Type and Features
-   * 
-   * @generated
-   */
-  public RutaBasic_Type(JCas jcas, Type casType) {
-    super(jcas, casType);
-    casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
-
-    casFeat_replacement = jcas.getRequiredFeatureDE(casType, "replacement", "uima.cas.String",
-            featOkTst);
-    casFeatCode_replacement = (null == casFeat_replacement) ? JCas.INVALID_FEATURE_CODE
-            : ((FeatureImpl) casFeat_replacement).getCode();
-
-  }
-}
diff --git a/ruta-core-ext/pom.xml b/ruta-core-ext/pom.xml
index b665411..200eabb 100644
--- a/ruta-core-ext/pom.xml
+++ b/ruta-core-ext/pom.xml
@@ -30,7 +30,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-parent/pom.xml</relativePath>
   </parent>
 
diff --git a/ruta-core/pom.xml b/ruta-core/pom.xml
index 76072d2..36277ea 100644
--- a/ruta-core/pom.xml
+++ b/ruta-core/pom.xml
@@ -22,10 +22,11 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

   <modelVersion>4.0.0</modelVersion>

   <artifactId>ruta-core</artifactId>

+

   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-parent/pom.xml</relativePath>

   </parent>

 

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java b/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java
index a6e630e..855ff9b 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java
@@ -194,8 +194,10 @@
 

   public FSIterator<AnnotationFS> createFilteredIterator(CAS cas, Type basicType) {

     if (windowAnnotation != null) {

-      FSIterator<AnnotationFS> windowIt = cas.getAnnotationIndex(basicType)

-              .subiterator(windowAnnotation);

+      FSIterator<AnnotationFS> windowIt = cas.getAnnotationIndex(basicType).select()

+              .coveredBy(windowAnnotation).fsIterator();

+//     was: FSIterator<AnnotationFS> windowIt = cas.getAnnotationIndex(basicType)

+//              .subiterator(windowAnnotation);

       FSIterator<AnnotationFS> iterator = cas.createFilteredIterator(windowIt,

               createCurrentConstraint(false));

       return iterator;

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java b/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
index 0aab776..fa70516 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
@@ -634,7 +634,6 @@
    */

   public void importPackage(String packageName, String alias) {

     List<String> aliases = packageImports.get(packageName);

-

     if (aliases == null) {

       aliases = new ArrayList<>(1);

       packageImports.put(packageName, aliases);

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java b/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
index 59b58c8..f9a2d07 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
@@ -53,7 +53,6 @@
 import org.apache.uima.cas.StringArrayFS;

 import org.apache.uima.cas.Type;

 import org.apache.uima.cas.TypeSystem;

-import org.apache.uima.cas.impl.FSIteratorImplBase;

 import org.apache.uima.cas.text.AnnotationFS;

 import org.apache.uima.cas.text.AnnotationIndex;

 import org.apache.uima.fit.util.CasUtil;

@@ -84,6 +83,7 @@
 import org.apache.uima.ruta.rule.AbstractRule;

 import org.apache.uima.ruta.rule.AbstractRuleMatch;

 import org.apache.uima.ruta.rule.MatchContext;

+import org.apache.uima.ruta.rule.RuleElement;

 import org.apache.uima.ruta.type.RutaAnnotation;

 import org.apache.uima.ruta.type.RutaBasic;

 import org.apache.uima.ruta.type.RutaOptional;

@@ -91,7 +91,7 @@
 import org.apache.uima.ruta.utils.UIMAUtils;

 import org.apache.uima.ruta.visitor.InferenceCrowd;

 

-public class RutaStream extends FSIteratorImplBase<AnnotationFS> {

+public class RutaStream {

 

   private final CAS cas;

 

@@ -204,9 +204,11 @@
   private void updateIterators(CAS cas, Type basicType, FilterManager filter,

           AnnotationFS additionalWindow) {

     if (additionalWindow != null) {

-      basicIt = cas.getAnnotationIndex(basicType).subiterator(additionalWindow);

+      this.basicIt = cas.getAnnotationIndex(basicType).select().coveredBy(additionalWindow)

+              .fsIterator();

+      // was: this.basicIt = cas.getAnnotationIndex(basicType).subiterator(additionalWindow);

     } else {

-      basicIt = cas.getAnnotationIndex(basicType).iterator();

+      this.basicIt = cas.getAnnotationIndex(basicType).iterator();

     }

     currentIt = filter.createFilteredIterator(cas, basicType);

   }

@@ -497,8 +499,7 @@
     return stream;

   }

 

-  @Override

-  public FSIterator<AnnotationFS> copy() {

+  public RutaStream copy() {

     RutaStream stream = new RutaStream(cas, basicType, beginAnchors, endAnchors, filter,

             lowMemoryProfile, simpleGreedyForComposed, emptyIsInvisible, typeUsage, crowd);

     stream.setDynamicAnchoring(dynamicAnchoring);

@@ -509,17 +510,14 @@
     return stream;

   }

 

-  @Override

   public AnnotationFS get() throws NoSuchElementException {

     return currentIt.get();

   }

 

-  @Override

   public boolean isValid() {

     return currentIt.isValid();

   }

 

-  @Override

   public void moveTo(FeatureStructure fs) {

     try {

       currentIt.moveTo(fs);

@@ -528,22 +526,26 @@
     }

   }

 

-  @Override

+  public boolean hasNext() {

+    return currentIt.hasNext();

+  }

+

+  public AnnotationFS next() {

+    return currentIt.next();

+  }

+

   public void moveToFirst() {

     currentIt.moveToFirst();

   }

 

-  @Override

   public void moveToLast() {

     currentIt.moveToLast();

   }

 

-  @Override

   public void moveToNext() {

     currentIt.moveToNext();

   }

 

-  @Override

   public void moveToPrevious() {

     currentIt.moveToPrevious();

   }

@@ -693,7 +695,10 @@
     }

     FSMatchConstraint defaultConstraint = filter.getDefaultConstraint();

     FSIterator<AnnotationFS> iterator = cas.createFilteredIterator(

-            cas.getAnnotationIndex(basicType).subiterator(windowAnnotation), defaultConstraint);

+            cas.getAnnotationIndex(basicType).select().coveredBy(windowAnnotation).fsIterator(),

+            defaultConstraint);

+//    FSIterator<AnnotationFS> iterator = cas.createFilteredIterator(

+//            cas.getAnnotationIndex(basicType).subiterator(windowAnnotation), defaultConstraint);

 

     while (iterator.isValid()) {

       result.add((RutaBasic) iterator.get());

@@ -730,6 +735,10 @@
     return basicIt;

   }

 

+  public FSIterator<AnnotationFS> getCurrentIterator() {

+    return currentIt;

+  }

+

   public AnnotationFS getDocumentAnnotation() {

     return documentAnnotation;

   }

@@ -892,6 +901,9 @@
     Set<Type> currentHiddenTypes = filter.getCurrentHiddenTypes();

     RutaBasic beginAnchor = getBeginAnchor(begin);

     if (beginAnchor != null) {

+      if (beginAnchor.isEmpty() && emptyIsInvisible) {

+        return false;

+      }

       for (Type type : currentHiddenTypes) {

         boolean partOf = beginAnchor.isPartOf(type);

         if (partOf) {

@@ -901,6 +913,9 @@
     }

     RutaBasic endAnchor = getEndAnchor(end);

     if (endAnchor != null) {

+      if (endAnchor.isEmpty() && emptyIsInvisible) {

+        return false;

+      }

       for (Type type : currentHiddenTypes) {

         boolean partOf = endAnchor.isPartOf(type);

         if (partOf) {

@@ -920,7 +935,6 @@
         }

       }

     }

-

     return true;

   }

 

@@ -948,9 +962,13 @@
                     || windowAnnotation.getEnd() != cas.getDocumentAnnotation().getEnd())) {

       AnnotationFS frame = cas.createAnnotation(cas.getTypeSystem().getType(RutaEngine.FRAME_TYPE),

               windowAnnotation.getBegin(), windowAnnotation.getEnd());

-      FSIterator<AnnotationFS> subiterator = cas.getAnnotationIndex(type).subiterator(frame);

-      while (subiterator.hasNext()) {

-        AnnotationFS each = subiterator.next();

+      FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(type).select().coveredBy(frame)

+              .fsIterator();

+      // was: FSIterator<AnnotationFS> subiterator =

+      // cas.getAnnotationIndex(type).subiterator(frame);

+

+      while (iterator.hasNext()) {

+        AnnotationFS each = iterator.next();

         if (isVisible(each)) {

           result.add(each);

         }

@@ -1023,12 +1041,12 @@
       if (value instanceof IStringListExpression) {

         IStringListExpression stringListExpr = (IStringListExpression) value;

         List<String> stringList = stringListExpr.getStringList(context, this);

-        StringArrayFS stringArray = FSCollectionFactory.createStringArray(cas, stringList);

+        StringArrayFS stringArray = FSCollectionFactory.createStringArrayFS(cas, stringList);

         annotation.setFeatureValue(feature, stringArray);

       } else if (value instanceof IStringExpression) {

         IStringExpression stringExpr = (IStringExpression) value;

         String string = stringExpr.getStringValue(context, this);

-        StringArrayFS array = FSCollectionFactory.createStringArray(cas, new String[] { string });

+        StringArrayFS array = FSCollectionFactory.createStringArrayFS(cas, new String[] { string });

         annotation.setFeatureValue(feature, array);

       }

     } else if (rangeName.equals(CAS.TYPE_NAME_INTEGER) || rangeName.equals(CAS.TYPE_NAME_LONG)

@@ -1050,12 +1068,13 @@
       if (value instanceof INumberExpression) {

         INumberExpression numberExpr = (INumberExpression) value;

         int v = numberExpr.getIntegerValue(context, this);

-        IntArrayFS array = FSCollectionFactory.createIntArray(cas, new int[] { v });

+        IntArrayFS array = FSCollectionFactory.createIntArrayFS(cas, new int[] { v });

         annotation.setFeatureValue(feature, array);

       } else if (value instanceof INumberListExpression) {

         INumberListExpression expr = (INumberListExpression) value;

         List<Number> list = expr.getNumberList(context, this);

-        IntArrayFS array = FSCollectionFactory.createIntArray(cas, RutaListUtils.toIntArray(list));

+        IntArrayFS array = FSCollectionFactory.createIntArrayFS(cas,

+                RutaListUtils.toIntArray(list));

         annotation.setFeatureValue(feature, array);

       }

     } else if (rangeName.equals(CAS.TYPE_NAME_DOUBLE)) {

@@ -1068,12 +1087,12 @@
       if (value instanceof INumberExpression) {

         INumberExpression numberExpr = (INumberExpression) value;

         double v = numberExpr.getDoubleValue(context, this);

-        DoubleArrayFS array = FSCollectionFactory.createDoubleArray(cas, new double[] { v });

+        DoubleArrayFS array = FSCollectionFactory.createDoubleArrayFS(cas, new double[] { v });

         annotation.setFeatureValue(feature, array);

       } else if (value instanceof INumberListExpression) {

         INumberListExpression expr = (INumberListExpression) value;

         List<Number> list = expr.getNumberList(context, this);

-        DoubleArrayFS array = FSCollectionFactory.createDoubleArray(cas,

+        DoubleArrayFS array = FSCollectionFactory.createDoubleArrayFS(cas,

                 RutaListUtils.toDoubleArray(list));

         annotation.setFeatureValue(feature, array);

       }

@@ -1087,12 +1106,12 @@
       if (value instanceof INumberExpression) {

         INumberExpression numberExpr = (INumberExpression) value;

         float v = numberExpr.getFloatValue(context, this);

-        FloatArrayFS array = FSCollectionFactory.createFloatArray(cas, new float[] { v });

+        FloatArrayFS array = FSCollectionFactory.createFloatArrayFS(cas, new float[] { v });

         annotation.setFeatureValue(feature, array);

       } else if (value instanceof INumberListExpression) {

         INumberListExpression expr = (INumberListExpression) value;

         List<Number> list = expr.getNumberList(context, this);

-        FloatArrayFS array = FSCollectionFactory.createFloatArray(cas,

+        FloatArrayFS array = FSCollectionFactory.createFloatArrayFS(cas,

                 RutaListUtils.toFloatArray(list));

         annotation.setFeatureValue(feature, array);

       }

@@ -1106,12 +1125,12 @@
       if (value instanceof IBooleanListExpression) {

         IBooleanListExpression expr = (IBooleanListExpression) value;

         List<Boolean> list = expr.getBooleanList(context, this);

-        BooleanArrayFS array = FSCollectionFactory.createBooleanArray(cas, list);

+        BooleanArrayFS array = FSCollectionFactory.createBooleanArrayFS(cas, list);

         annotation.setFeatureValue(feature, array);

       } else if (value instanceof IBooleanExpression) {

         IBooleanExpression expr = (IBooleanExpression) value;

         Boolean v = expr.getBooleanValue(context, this);

-        BooleanArrayFS array = FSCollectionFactory.createBooleanArray(cas, new boolean[] { v });

+        BooleanArrayFS array = FSCollectionFactory.createBooleanArrayFS(cas, new boolean[] { v });

         annotation.setFeatureValue(feature, array);

       }

     } else if (value instanceof AnnotationTypeExpression && !range.isPrimitive()) {

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/action/FillAction.java b/ruta-core/src/main/java/org/apache/uima/ruta/action/FillAction.java
index ff6d32f..9a1eb27 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/action/FillAction.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/action/FillAction.java
@@ -76,8 +76,9 @@
           }

         }

       }

-      if (!list.isEmpty()) {

-        AnnotationFS annotationFS = list.get(0);

+

+      for (AnnotationFS annotationFS : list) {

+

         stream.getCas().removeFsFromIndexes(annotationFS);

         context.setAnnotation(matchedAnnotation);

         stream.assignFeatureValues(annotationFS, features, context);

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java b/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
index 4330eed..e788e7a 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
@@ -67,7 +67,7 @@
     int minValue = min.getIntegerValue(context, stream);

     boolean forwardValue = forward.getBooleanValue(context, stream);

 

-    FSIterator<AnnotationFS> it = filtered.getBooleanValue(context, stream) ? stream

+    FSIterator<AnnotationFS> it = filtered.getBooleanValue(context, stream) ? stream.getCurrentIterator()

             : stream.getUnfilteredBasicIterator();

     AnnotationFS pointer = null;

     if (forwardValue) {

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java b/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
index 74047d7..c382c38 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
@@ -823,7 +823,7 @@
 

     Collection<AnnotationFS> results = new HashSet<AnnotationFS>();

     stream.moveToFirst();

-    FSIterator<AnnotationFS> streamPointer = stream.copy();

+    RutaStream streamPointer = stream.copy();

 

     while (stream.isValid()) {

       RutaBasic anchorBasic = (RutaBasic) stream.get();

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java b/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
index 7c9d6e7..4c1ca1e 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
@@ -329,7 +329,7 @@
           char[] ignoreChars, int maxIgnoredChars, boolean ignoreWS) {

     ArrayList<AnnotationFS> results = new ArrayList<AnnotationFS>();

     stream.moveToFirst();

-    FSIterator<AnnotationFS> streamPointer = stream.copy();

+    RutaStream streamPointer = stream.copy();

     while (stream.isValid()) {

       RutaBasic anchorBasic = (RutaBasic) stream.get();

       streamPointer.moveTo(anchorBasic);

diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationListFSIterator.java b/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationListFSIterator.java
index 8c3ab92..c053d20 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationListFSIterator.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationListFSIterator.java
@@ -18,13 +18,17 @@
  */
 package org.apache.uima.ruta.rule;
 
+import java.util.Comparator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
+import org.apache.commons.lang3.NotImplementedException;
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.impl.FSIteratorImplBase;
+import org.apache.uima.cas.impl.LowLevelIndex;
 import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.jcas.cas.TOP;
 
 public class AnnotationListFSIterator extends FSIteratorImplBase<AnnotationFS> {
 
@@ -89,4 +93,94 @@
     return new AnnotationListFSIterator(list);
   }
 
+  @Override
+  public int ll_indexSizeMaybeNotCurrent() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public LowLevelIndex<AnnotationFS> ll_getIndex() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public int ll_maxAnnotSpan() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public boolean isIndexesHaveBeenUpdated() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public boolean maybeReinitIterator() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void moveToFirstNoReinit() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void moveToLastNoReinit() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void moveToNoReinit(FeatureStructure fs) {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public Comparator<TOP> getComparator() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public AnnotationFS getNvc() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void moveToNextNvc() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void moveToPreviousNvc() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public boolean hasPrevious() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public AnnotationFS previous() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public int nextIndex() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public int previousIndex() {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void set(AnnotationFS e) {
+    throw new NotImplementedException("Not supported.");
+  }
+
+  @Override
+  public void add(AnnotationFS e) {
+    throw new NotImplementedException("Not supported.");
+  }
+
 }
diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaAnnotationTypeMatcher.java b/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaAnnotationTypeMatcher.java
index 0fa25e1..98780c7 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaAnnotationTypeMatcher.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaAnnotationTypeMatcher.java
@@ -107,99 +107,70 @@
   public Collection<? extends AnnotationFS> getAnnotationsAfter(RutaRuleElement ruleElement,
           AnnotationFS annotation, RutaBlock parent, RutaStream stream) {
     if (annotation.getEnd() == stream.getDocumentAnnotation().getEnd()) {
-      return emptyList();
+      return Collections.emptyList();
     }
-    
-    RutaBasic lastBasic = stream.getEndAnchor(annotation.getEnd());
-    int end = 0;
-    if (lastBasic == null) {
-      if (annotation.getEnd() != 0) {
-        return emptyList();
-      }
-    } else {
-      end = lastBasic.getEnd();
-    }
-    
-    if (end == stream.getDocumentAnnotation().getBegin()) {
-      // non existing wildcard match
-      stream.moveToFirst();
-    } else if (annotation.getEnd() > 0) {
-      stream.moveTo(lastBasic);
-      if (stream.isVisible(lastBasic) && stream.isValid()
-              && stream.get().getEnd() == lastBasic.getEnd()) {
-        stream.moveToNext();
-      }
-    } else {
-      stream.moveToFirst();
-    }
-
-    if (!stream.isValid()) {
-      return emptyList();
-    }
-    
-    RutaBasic nextBasic = (RutaBasic) stream.get();
-    // TODO HOTFIX for annotation of length 0
-    while (stream.isValid() && nextBasic.getBegin() < end) {
-      stream.moveToNext();
-      if (stream.isValid()) {
-        nextBasic = (RutaBasic) stream.get();
-      }
+    RutaBasic nextBasic = stream.getBasicNextTo(false, annotation);
+    if (nextBasic == null) {
+      return Collections.emptyList();
     }
 
     MatchContext context = new MatchContext(parent);
     // just for forcing expression top initialize
     expression.getType(context, stream);
     if (expression.getAnnotationExpression() != null) {
-      AnnotationFS ref = expression.getAnnotation(context, stream);
-      
-      if (ref == null) {
-        return emptyList();
-      }
 
-      if (nextBasic.getBegin() == ref.getBegin()) {
-        return asList(ref);
-      }
-      
-      return emptyList();
-    }
-    
-    if (expression.getAnnotationListExpression() != null) {
-      RutaBasic referenceElement = nextBasic;
-      return expression.getAnnotationList(context, stream).stream()
-          .filter(each -> referenceElement.getBegin() == each.getBegin())
-          .collect(Collectors.toList());
-    } 
-    
-    List<Type> types;
-    if (expression.getTypeListExpression() != null) {
-      types = expression.getTypeListExpression().getTypeList(context, stream);
-    } else {
-      types = asList(getType(context.getParent(), stream));
-    }
-    
-    List<AnnotationFS> annotations = new ArrayList<>();
-    for (Type type : types) {
-      Collection<AnnotationFS> beginAnchors = nextBasic.getBeginAnchors(type);
-      Collection<AnnotationFS> anchors = new ArrayList<>(beginAnchors.size());
-      
-      if (beginAnchors != null) {
-        for (AnnotationFS afs : beginAnchors) {
-          if (afs.getBegin() >= stream.getDocumentAnnotation().getBegin()
-                  && afs.getEnd() <= stream.getDocumentAnnotation().getEnd()) {
-            anchors.add(afs);
-          }
+      AnnotationFS ref = expression.getAnnotation(context, stream);
+      if (ref != null) {
+        boolean beginsWith = nextBasic.getBegin() == ref.getBegin();
+        if (beginsWith) {
+          Collection<AnnotationFS> result = new ArrayList<>(1);
+          result.add(ref);
+          return result;
         }
       }
-      
-      if (expression.getFeatureExpression() != null) {
-        annotations.addAll(expression.getFeatureExpression().getAnnotations(anchors,
-                CHECK_ON_FEATURE, context, stream));
-      } else {
-        annotations.addAll(anchors);
+    } else if (expression.getAnnotationListExpression() != null) {
+      List<AnnotationFS> annotations = expression.getAnnotationList(context, stream);
+      Collection<AnnotationFS> result = new ArrayList<>();
+      for (AnnotationFS each : annotations) {
+        boolean beginsWith = nextBasic.getBegin() == each.getBegin();
+        if (beginsWith) {
+          result.add(each);
+        }
       }
+      return result;
+    } else {
+      List<Type> types = null;
+      if (expression.getTypeListExpression() != null) {
+        types = expression.getTypeListExpression().getTypeList(context, stream);
+      } else {
+        Type type = getType(context.getParent(), stream);
+        types = new ArrayList<>(1);
+        types.add(type);
+      }
+      List<AnnotationFS> annotations = new ArrayList<>();
+      for (Type type : types) {
+        Collection<AnnotationFS> anchors = new ArrayList<>();
+        Collection<AnnotationFS> beginAnchors = nextBasic.getBeginAnchors(type);
+        if (beginAnchors != null) {
+          for (AnnotationFS afs : beginAnchors) {
+            if (afs.getBegin() >= stream.getDocumentAnnotation().getBegin()
+                    && afs.getEnd() <= stream.getDocumentAnnotation().getEnd()) {
+              anchors.add(afs);
+            }
+          }
+        }
+        if (expression.getFeatureExpression() != null) {
+          annotations.addAll(expression.getFeatureExpression().getAnnotations(anchors,
+                  CHECK_ON_FEATURE, context, stream));
+        } else {
+          annotations.addAll(anchors);
+        }
+
+      }
+      return annotations;
     }
-    
-    return annotations;
+
+    return Collections.emptyList();
   }
 
   @Override
@@ -208,82 +179,63 @@
     if (annotation.getBegin() == stream.getDocumentAnnotation().getBegin()) {
       return Collections.emptyList();
     }
-    
-    RutaBasic firstBasic = stream.getBeginAnchor(annotation.getBegin());
-    if (firstBasic == null) {
+    RutaBasic nextBasic = stream.getBasicNextTo(true, annotation);
+    if (nextBasic == null) {
       return Collections.emptyList();
     }
-    
-    stream.moveTo(firstBasic);
-    if (stream.isVisible(firstBasic)) {
-      stream.moveToPrevious();
-    }
-    if (firstBasic.getBegin() == stream.getDocumentAnnotation().getEnd()) {
-      // non existing wildcard match
-      stream.moveToLast();
-    }
-
-    if (!stream.isValid()) {
-      return emptyList();
-    }
-
-    RutaBasic nextBasic = (RutaBasic) stream.get();
-    // TODO HOTFIX for annotation of length 0
-    while (stream.isValid() && nextBasic.getEnd() > firstBasic.getBegin()) {
-      stream.moveToPrevious();
-      if (stream.isValid()) {
-        nextBasic = (RutaBasic) stream.get();
-      }
-    }
 
     MatchContext context = new MatchContext(parent);
     // just for forcing expression top initialize
     expression.getType(context, stream);
     if (expression.getAnnotationExpression() != null) {
       AnnotationFS ref = expression.getAnnotationExpression().getAnnotation(context, stream);
-      
-      if (nextBasic.getEnd() == ref.getEnd()) {
-        return asList(ref);
+      boolean endsWith = nextBasic.getEnd() == ref.getEnd();
+      if (endsWith) {
+        Collection<AnnotationFS> result = new ArrayList<>(1);
+        result.add(ref);
+        return result;
       }
-      
-      return emptyList();
-    } 
-    
-    if (expression.getAnnotationListExpression() != null) {
-      RutaBasic referenceElement = nextBasic;
-      return expression.getAnnotationListExpression().getAnnotationList(context, stream).stream()
-          .filter(each -> referenceElement.getEnd() == each.getEnd())
-          .collect(Collectors.toList());
-    }
-    
-    List<Type> types;
-    if (expression.getTypeListExpression() != null) {
-      types = expression.getTypeListExpression().getTypeList(context, stream);
-    } else {
-      types = asList(getType(context.getParent(), stream));
-    }
-    
-    List<AnnotationFS> annotations = new ArrayList<>();
-    for (Type type : types) {
-      Collection<AnnotationFS> endAnchors = nextBasic.getEndAnchors(type);
-      Collection<AnnotationFS> anchors = new ArrayList<>(endAnchors.size());
-      if (endAnchors != null) {
-        for (AnnotationFS afs : endAnchors) {
-          if (afs.getBegin() >= stream.getDocumentAnnotation().getBegin()) {
-            anchors.add(afs);
-          }
+    } else if (expression.getAnnotationListExpression() != null) {
+      List<AnnotationFS> annotations = expression.getAnnotationListExpression()
+              .getAnnotationList(context, stream);
+      for (AnnotationFS each : annotations) {
+        boolean endsWith = nextBasic.getEnd() == each.getEnd();
+        if (endsWith) {
+          Collection<AnnotationFS> result = new ArrayList<>();
+          result.add(each);
+          return result;
         }
       }
-      
-      if (expression.getFeatureExpression() != null) {
-        annotations.addAll(expression.getFeatureExpression().getAnnotations(anchors,
-                CHECK_ON_FEATURE, context, stream));
+    } else {
+      List<Type> types = null;
+      if (expression.getTypeListExpression() != null) {
+        types = expression.getTypeListExpression().getTypeList(context, stream);
       } else {
-        annotations.addAll(anchors);
+        Type type = getType(context.getParent(), stream);
+        types = new ArrayList<>(1);
+        types.add(type);
       }
+      List<AnnotationFS> annotations = new ArrayList<>();
+      for (Type type : types) {
+        Collection<AnnotationFS> anchors = new ArrayList<>();
+        Collection<AnnotationFS> endAnchors = nextBasic.getEndAnchors(type);
+        if (endAnchors != null) {
+          for (AnnotationFS afs : endAnchors) {
+            if (afs.getBegin() >= stream.getDocumentAnnotation().getBegin()) {
+              anchors.add(afs);
+            }
+          }
+        }
+        if (expression.getFeatureExpression() != null) {
+          annotations.addAll(expression.getFeatureExpression().getAnnotations(anchors,
+                  CHECK_ON_FEATURE, context, stream));
+        } else {
+          annotations.addAll(anchors);
+        }
+      }
+      return annotations;
     }
-    
-    return annotations;
+    return Collections.emptyList();
   }
 
   @Override
diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java b/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
index c2aa66d..dde4543 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
@@ -30,11 +30,9 @@
 import org.apache.commons.lang3.tuple.ImmutablePair;

 import org.apache.commons.lang3.tuple.Pair;

 import org.apache.uima.cas.CAS;

-import org.apache.uima.cas.CASException;

 import org.apache.uima.cas.FSIterator;

 import org.apache.uima.cas.Type;

 import org.apache.uima.cas.text.AnnotationFS;

-import org.apache.uima.jcas.JCas;

 import org.apache.uima.ruta.RutaEnvironment;

 import org.apache.uima.ruta.RutaStream;

 import org.apache.uima.ruta.action.AbstractRutaAction;

@@ -44,7 +42,6 @@
 import org.apache.uima.ruta.expression.AnnotationTypeExpression;

 import org.apache.uima.ruta.expression.string.IStringExpression;

 import org.apache.uima.ruta.type.RutaBasic;

-import org.apache.uima.ruta.type.RutaFrame;

 import org.apache.uima.ruta.visitor.InferenceCrowd;

 

 public class WildCardRuleElement extends AbstractRuleElement {

@@ -508,14 +505,20 @@
     } else {

       iterator = getIteratorOfType(after, defaultType, annotation, stream);

     }

-    if (iterator != null && iterator.isValid() && iterator.get().equals(annotation)) {

-      moveOn(after, iterator, stream);

+    if (annotation != null && iterator != null && iterator.isValid()) {

+      AnnotationFS pointer = iterator.get();

+      if ((after && pointer.getEnd() == annotation.getEnd())

+              || (!after && pointer.getBegin() == annotation.getBegin())) {

+        moveOn(after, iterator, stream);

+      }

     }

     return iterator;

   }

 

   private FSIterator<AnnotationFS> getIteratorOfType(boolean after, Type type,

           AnnotationFS annotation, RutaStream stream) {

+    // TODO reimplement with cas select logic

+

     CAS cas = stream.getCas();

     // TODO adapt logic to changes in UIMA iterator behavior!

     FSIterator<AnnotationFS> result = null;

@@ -562,23 +565,17 @@
         }

       }

     } else {

-      JCas jcas = null;

-      try {

-        jcas = cas.getJCas();

-      } catch (CASException e) {

-        e.printStackTrace();

-      }

-      RutaFrame window = new RutaFrame(jcas, stream.getDocumentAnnotation().getBegin(),

-              stream.getDocumentAnnotation().getEnd());

+

+      result = cas.getAnnotationIndex(type).select().coveredBy(stream.getDocumentAnnotation())

+              .fsIterator();

       if (annotation == null) {

-        result = cas.getAnnotationIndex(type).subiterator(window);

       } else {

-        result = cas.getAnnotationIndex(type).subiterator(window);

         AnnotationFS pointer = stream.getAnchor(after, annotation);

         result.moveTo(pointer);

+

         if (!result.isValid()) {

           if (after) {

-            // result.moveToFirst();

+//            result.moveToFirst();

           } else {

             // TODO due to type priorities: RutaBasic is last -> moveTo will not work

             result.moveToLast();

diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/action/FillTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/action/FillTest.java
index a28d778..0be768a 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/action/FillTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/action/FillTest.java
@@ -21,6 +21,8 @@
 

 import static org.junit.Assert.assertEquals;

 

+import java.util.ArrayList;

+import java.util.List;

 import java.util.Map;

 import java.util.TreeMap;

 

@@ -30,27 +32,23 @@
 import org.apache.uima.cas.Type;

 import org.apache.uima.cas.text.AnnotationFS;

 import org.apache.uima.cas.text.AnnotationIndex;

+import org.apache.uima.ruta.engine.Ruta;

 import org.apache.uima.ruta.engine.RutaEngine;

 import org.apache.uima.ruta.engine.RutaTestUtils;

+import org.apache.uima.ruta.engine.RutaTestUtils.TestFeature;

 import org.junit.Test;

 

 public class FillTest {

 

   @Test

-  public void test() {

+  public void test() throws Exception {

     String name = this.getClass().getSimpleName();

     String namespace = this.getClass().getPackage().getName().replaceAll("\\.", "/");

     Map<String, String> complexTypes = new TreeMap<String, String>();

     String type = "org.apache.uima.LanguageStorage";

     complexTypes.put(type, CAS.TYPE_NAME_DOCUMENT_ANNOTATION);

-    CAS cas = null;

-    try {

-      cas = RutaTestUtils.process(namespace + "/" + name + RutaEngine.SCRIPT_FILE_EXTENSION, namespace + "/" + name

-              + ".txt", 50, false, false, complexTypes, null);

-    } catch (Exception e) {

-      e.printStackTrace();

-      assert (false);

-    }

+    CAS cas = RutaTestUtils.process(namespace + "/" + name + RutaEngine.SCRIPT_FILE_EXTENSION,

+            namespace + "/" + name + ".txt", 50, false, false, complexTypes, null);

     Type t = null;

     AnnotationIndex<AnnotationFS> ai = null;

     FSIterator<AnnotationFS> iterator = null;

@@ -63,7 +61,27 @@
     Feature featureByBaseName = t.getFeatureByBaseName("language");

     String stringValue = afs.getStringValue(featureByBaseName);

     assertEquals("en", stringValue);

-   

-    cas.release();

+  }

+

+  @Test

+  public void testOverlapping() throws Exception {

+

+    String script = "(CW W){-> Struct, Struct};\n";

+    script += "CW{-> FILL(Struct, \"s\" = \"a\")};\n";

+    script += "Struct.s==\"a\"{-> T1};\n";

+

+    Map<String, String> typeMap = new TreeMap<String, String>();

+    String typeName = "Struct";

+    typeMap.put(typeName, "uima.tcas.Annotation");

+

+    Map<String, List<TestFeature>> featureMap = new TreeMap<String, List<TestFeature>>();

+    List<TestFeature> list = new ArrayList<RutaTestUtils.TestFeature>();

+    featureMap.put(typeName, list);

+    list.add(new TestFeature("s", "", "uima.cas.String"));

+

+    CAS cas = RutaTestUtils.getCAS("Some text.", typeMap, featureMap);

+    Ruta.apply(cas, script);

+

+    RutaTestUtils.assertAnnotationsEquals(cas, 1, 2, "Some text");

   }

 }

diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/engine/DummySeeder.java b/ruta-core/src/test/java/org/apache/uima/ruta/engine/DummySeeder.java
index 840f8dc..b403f03 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/engine/DummySeeder.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/engine/DummySeeder.java
@@ -1,37 +1,37 @@
-/*
- * 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.engine;
-
-import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.Type;
-import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.ruta.seed.RutaAnnotationSeeder;
-import org.apache.uima.ruta.seed.TextSeeder;
-
-public class DummySeeder implements RutaAnnotationSeeder{
-
-  @Override
-  public Type seed(String text, CAS cas) {
-    Type type = cas.getTypeSystem().getType(TextSeeder.seedType);
-    AnnotationFS annotation = cas.createAnnotation(type, 0, text.length());
-    cas.addFsToIndexes(annotation);
-    return type;
-  }
-
-}
+/*

+ * 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.engine;

+

+import org.apache.uima.cas.CAS;

+import org.apache.uima.cas.Type;

+import org.apache.uima.cas.text.AnnotationFS;

+import org.apache.uima.ruta.seed.RutaAnnotationSeeder;

+import org.apache.uima.ruta.seed.TextSeeder;

+

+public class DummySeeder implements RutaAnnotationSeeder{

+

+  @Override

+  public Type seed(String text, CAS cas) {

+    Type type = cas.getTypeSystem().getType(TextSeeder.seedType);

+    AnnotationFS annotation = cas.createAnnotation(type, 0, text.length());

+    cas.addFsToIndexes(annotation);

+    return type;

+  }

+

+}

diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/engine/MultipleSeedersTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/engine/MultipleSeedersTest.java
index 4dc4595..2cb8fc9 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/engine/MultipleSeedersTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/engine/MultipleSeedersTest.java
@@ -1,50 +1,50 @@
-/*
- * 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.engine;
-
-import org.apache.uima.analysis_engine.AnalysisEngine;
-import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.util.JCasUtil;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceInitializationException;
-import org.apache.uima.ruta.type.ALL;
-import org.apache.uima.ruta.type.TruePositive;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class MultipleSeedersTest {
-
-  @Test
-  public void test() throws ResourceInitializationException, AnalysisEngineProcessException {
-    
-    AnalysisEngine ae = AnalysisEngineFactory.createEngine(RutaEngine.class, 
-            RutaEngine.PARAM_RULES, "TokenSeed{-> TruePositive};",
-            RutaEngine.PARAM_SEEDERS, new String[] {DummySeeder.class.getName(),DummySeeder.class.getName()});
-    
-    JCas jcas = ae.newJCas();
-    jcas.setDocumentText("Dummy text.");
-    ae.process(jcas);
-    
-    Assert.assertEquals(2, JCasUtil.select(jcas, TruePositive.class).size());
-    Assert.assertEquals(0, JCasUtil.select(jcas, ALL.class).size());
-    
-  }
-  
-}
+/*

+ * 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.engine;

+

+import org.apache.uima.analysis_engine.AnalysisEngine;

+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;

+import org.apache.uima.fit.factory.AnalysisEngineFactory;

+import org.apache.uima.fit.util.JCasUtil;

+import org.apache.uima.jcas.JCas;

+import org.apache.uima.resource.ResourceInitializationException;

+import org.apache.uima.ruta.type.ALL;

+import org.apache.uima.ruta.type.TruePositive;

+import org.junit.Assert;

+import org.junit.Test;

+

+public class MultipleSeedersTest {

+

+  @Test

+  public void test() throws ResourceInitializationException, AnalysisEngineProcessException {

+    

+    AnalysisEngine ae = AnalysisEngineFactory.createEngine(RutaEngine.class, 

+            RutaEngine.PARAM_RULES, "TokenSeed{-> TruePositive};",

+            RutaEngine.PARAM_SEEDERS, new String[] {DummySeeder.class.getName(),DummySeeder.class.getName()});

+    

+    JCas jcas = ae.newJCas();

+    jcas.setDocumentText("Dummy text.");

+    ae.process(jcas);

+    

+    Assert.assertEquals(2, JCasUtil.select(jcas, TruePositive.class).size());

+    Assert.assertEquals(0, JCasUtil.select(jcas, ALL.class).size());

+    

+  }

+  

+}

diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java
index e075e0b..27f8dde 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java
@@ -795,17 +795,4 @@
 

   }

 

-  @Test

-  @Ignore

-  public void testInlineWithQuantifier() throws Exception {

-    

-    String script = "";

-    script += "CW{-> Struct1, Struct1.a=sw} sw:SW;\n";

-    script += "sw:SW{-> Struct1, Struct1.a=sw};\n";

-    script += "p:PERIOD{-> Struct1, Struct1.a=p};\n";

-    script += "(s1:Struct1<-{u1:s1.a;} (s2:Struct1<-{u2:s2.a{u2.ct==u1.ct};})+){-> T1};\n";

-    CAS cas = this.applyOnStruct4Cas(script);

-    RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "Some text");

-  }

-  

 }

diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/resource/CSVTableTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/resource/CSVTableTest.java
index 927226c..6588a91 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/resource/CSVTableTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/resource/CSVTableTest.java
@@ -1,76 +1,76 @@
-/*
- * 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.resource;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-public class CSVTableTest {
-  private static final String CUSTOM_SEPARATOR = "#|#";
-
-  @Test
-  public void testDefaultLookup() throws IOException {
-    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),
-            CSVTable.DEFAULT_CSV_SEPARATOR);
-    checkValue(csvTable, 0, 0, "this is the first line first column");
-    checkValue(csvTable, 0, 1, "ONE");
-    checkValue(csvTable, 1, 0, "this is the second line first column");
-    checkValue(csvTable, 1, 1, "TWO");
-    checkValue(csvTable, 2, 0, "this is the a line with custom");
-    checkValue(csvTable, 2, 1, " non default separator used#|#THREE");
-  }
-
-  @Test
-  public void testDefaultLookupWithEmptyColumn() throws IOException {
-    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),
-            CSVTable.DEFAULT_CSV_SEPARATOR);
-    checkValue(csvTable, 3, 0, "line with empty column");
-    checkValue(csvTable, 3, 1, " "); // spacer added by table implementation
-    checkValue(csvTable, 3, 2, "AFTER_EMPTY_COLUMN");
-  }
-
-  @Test
-  public void testLookupWithCustomSeparator() throws IOException {
-    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),
-            CUSTOM_SEPARATOR);
-    checkValue(csvTable, 0, 0, "this is the first line first column;ONE");
-    checkValue(csvTable, 1, 0, "this is the second line first column;TWO");
-    checkValue(csvTable, 2, 0, "this is the a line with custom; non default separator used");
-    checkValue(csvTable, 2, 1, "THREE");
-  }
-
-  @Test
-  public void testLookupWithCustomSeparatorAndEmptyColumn() throws IOException {
-    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),
-            CUSTOM_SEPARATOR);
-    checkValue(csvTable, 4, 0, "line with empty column custom separator");
-    checkValue(csvTable, 4, 1, " "); // spacer added by table implementation
-    checkValue(csvTable, 4, 2, "AFTER_EMPTY_COLUMN2");
-  }
-
-  private void checkValue(CSVTable table, int row, int column, String expectedValue) {
-    String actualValue = table.getEntry(row, column);
-    assertThat(actualValue, is(expectedValue));
-  }
-
+/*

+ * 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.resource;

+

+import static org.hamcrest.CoreMatchers.is;

+import static org.junit.Assert.assertThat;

+

+import java.io.IOException;

+

+import org.junit.Test;

+

+public class CSVTableTest {

+  private static final String CUSTOM_SEPARATOR = "#|#";

+

+  @Test

+  public void testDefaultLookup() throws IOException {

+    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),

+            CSVTable.DEFAULT_CSV_SEPARATOR);

+    checkValue(csvTable, 0, 0, "this is the first line first column");

+    checkValue(csvTable, 0, 1, "ONE");

+    checkValue(csvTable, 1, 0, "this is the second line first column");

+    checkValue(csvTable, 1, 1, "TWO");

+    checkValue(csvTable, 2, 0, "this is the a line with custom");

+    checkValue(csvTable, 2, 1, " non default separator used#|#THREE");

+  }

+

+  @Test

+  public void testDefaultLookupWithEmptyColumn() throws IOException {

+    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),

+            CSVTable.DEFAULT_CSV_SEPARATOR);

+    checkValue(csvTable, 3, 0, "line with empty column");

+    checkValue(csvTable, 3, 1, " "); // spacer added by table implementation

+    checkValue(csvTable, 3, 2, "AFTER_EMPTY_COLUMN");

+  }

+

+  @Test

+  public void testLookupWithCustomSeparator() throws IOException {

+    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),

+            CUSTOM_SEPARATOR);

+    checkValue(csvTable, 0, 0, "this is the first line first column;ONE");

+    checkValue(csvTable, 1, 0, "this is the second line first column;TWO");

+    checkValue(csvTable, 2, 0, "this is the a line with custom; non default separator used");

+    checkValue(csvTable, 2, 1, "THREE");

+  }

+

+  @Test

+  public void testLookupWithCustomSeparatorAndEmptyColumn() throws IOException {

+    CSVTable csvTable = new CSVTable(CSVTable.class.getResourceAsStream("test_csvfile.csv"),

+            CUSTOM_SEPARATOR);

+    checkValue(csvTable, 4, 0, "line with empty column custom separator");

+    checkValue(csvTable, 4, 1, " "); // spacer added by table implementation

+    checkValue(csvTable, 4, 2, "AFTER_EMPTY_COLUMN2");

+  }

+

+  private void checkValue(CSVTable table, int row, int column, String expectedValue) {

+    String actualValue = table.getEntry(row, column);

+    assertThat(actualValue, is(expectedValue));

+  }

+

 }
\ No newline at end of file
diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java b/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java
index 937bfeb..720670b 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java
@@ -271,4 +271,18 @@
     RutaTestUtils.assertAnnotationsEquals(cas, 2, 0);

   }

 

+  @Test

+  public void testLastElementAlsoAnnotatedWithLookahead() throws Exception {

+    String document = "a b c. a b c.";

+    String script = "ANY+{-PARTOF({PERIOD, T1})->T1};\n";

+    script += "\"a\" -> T2, T3;\n";

+    script += "\"c\" -> T3;\n";

+    script += "T1 -> { T2 # T3{-> T4};};\n";

+

+    CAS cas = RutaTestUtils.getCAS(document, null, null, false);

+    Ruta.apply(cas, script);

+

+    RutaTestUtils.assertAnnotationsEquals(cas, 4, 2, "c", "c");

+  }

+

 }

diff --git a/ruta-docbook/pom.xml b/ruta-docbook/pom.xml
index e8efb90..7167bb7 100644
--- a/ruta-docbook/pom.xml
+++ b/ruta-docbook/pom.xml
@@ -26,11 +26,12 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-parent/pom.xml</relativePath>

   </parent>

   <name>Apache UIMA Ruta Documentation</name>

   <url>${uimaWebsiteUrl}</url>

+

   <properties>

     <uimaScmProject>${project.artifactId}</uimaScmProject>

     <bookNameRoot>tools.ruta.book</bookNameRoot>

diff --git a/ruta-docbook/src/docbook/tools.ruta.howtos.xml b/ruta-docbook/src/docbook/tools.ruta.howtos.xml
index 39e8532..3cecf68 100644
--- a/ruta-docbook/src/docbook/tools.ruta.howtos.xml
+++ b/ruta-docbook/src/docbook/tools.ruta.howtos.xml
@@ -250,7 +250,7 @@
 		<programlisting><![CDATA[<plugin>
 <groupId>org.apache.uima</groupId>
 <artifactId>ruta-maven-plugin</artifactId>
-<version>2.8.1</version>
+<version>3.0.1</version>
 <configuration>
 
  <!-- This is a exemplary configuration, which explicitly specifies the 
@@ -403,7 +403,7 @@
     <programlisting><![CDATA[<plugin>
 <groupId>org.apache.uima</groupId>
 <artifactId>ruta-maven-plugin</artifactId>
-<version>2.8.1</version>
+<version>3.0.1</version>
 <configuration></configuration>
 <executions>
 <execution>
@@ -456,7 +456,7 @@
     <programlisting><![CDATA[<plugin>
 <groupId>org.apache.uima</groupId>
 <artifactId>ruta-maven-plugin</artifactId>
-<version>2.8.1</version>
+<version>3.0.1</version>
 <configuration></configuration>
 <executions>
 <execution>
@@ -527,7 +527,7 @@
     </para>  
     
     <programlisting><![CDATA[mvn archetype:generate -DarchetypeGroupId=org.apache.uima 
-    -DarchetypeArtifactId=ruta-maven-archetype -DarchetypeVersion=2.8.1
+    -DarchetypeArtifactId=ruta-maven-archetype -DarchetypeVersion=3.0.1
     -DgroupId=my.domain -DartifactId=my-ruta-project]]></programlisting>
     
     <para>
diff --git a/ruta-eclipse-feature/pom.xml b/ruta-eclipse-feature/pom.xml
index 3ad9038..2bca59a 100644
--- a/ruta-eclipse-feature/pom.xml
+++ b/ruta-eclipse-feature/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-parent/pom.xml</relativePath>

   </parent>

 

diff --git a/ruta-eclipse-update-site/category.xml b/ruta-eclipse-update-site/category.xml
index fea9ffa..b53d5f7 100644
--- a/ruta-eclipse-update-site/category.xml
+++ b/ruta-eclipse-update-site/category.xml
@@ -20,7 +20,7 @@
    ***************************************************************
    -->
 <site>
-   <feature url="features/org.apache.uima.ruta.feature_2.8.1.jar" id="org.apache.uima.ruta.feature" version="2.8.1">
+   <feature url="features/org.apache.uima.ruta.feature_3.0.0.jar" id="org.apache.uima.ruta.feature" version="3.0.0">
       <category name="apache-uima-ruta"/>
    </feature>
    <category-def name="apache-uima-ruta" label="Apache UIMA Ruta">
diff --git a/ruta-eclipse-update-site/pom.xml b/ruta-eclipse-update-site/pom.xml
index f7217d0..b5b4454 100644
--- a/ruta-eclipse-update-site/pom.xml
+++ b/ruta-eclipse-update-site/pom.xml
@@ -30,7 +30,7 @@
   

 	<artifactId>ruta-eclipse-update-site</artifactId>

 	<packaging>pom</packaging>

-	<version>2.8.1</version>

+	<version>3.0.1</version>

   

 	<name>Apache UIMA Ruta Eclipse: ${project.artifactId}</name>

   <description>The UIMA Ruta Eclipse update site</description>

@@ -46,9 +46,9 @@
   <properties>

     <uimaScmProject>${project.artifactId}</uimaScmProject>

     <eclipseUpdateSiteComponent>ruta</eclipseUpdateSiteComponent>

-    <eclipseUpdateSubSite>${project.build.directory}/eclipse-update-site/${eclipseUpdateSiteComponent}</eclipseUpdateSubSite>

-    <item-maven-release-version>2.8.1</item-maven-release-version>

-    <item-eclipse-release-version>2.8.1</item-eclipse-release-version>

+    <eclipseUpdateSubSite>${project.build.directory}/eclipse-update-site-v3/${eclipseUpdateSiteComponent}</eclipseUpdateSubSite>

+    <item-maven-release-version>3.0.1</item-maven-release-version>

+    <item-eclipse-release-version>3.0.1</item-eclipse-release-version>

     <dropPrevVersions>false</dropPrevVersions>

   </properties>

 	<build>

@@ -89,7 +89,7 @@
                 <artifactItem><groupId>org.apache.uima</groupId><artifactId>ruta-ep-ide</artifactId>            <version>${item-maven-release-version}</version><destFileName>org.apache.uima.ruta.ide_${item-eclipse-release-version}.jar      </destFileName></artifactItem>

                 <artifactItem><groupId>org.apache.uima</groupId><artifactId>ruta-ep-ide-ui</artifactId>         <version>${item-maven-release-version}</version><destFileName>org.apache.uima.ruta.ide.ui_${item-eclipse-release-version}.jar   </destFileName></artifactItem>

                 <artifactItem><groupId>org.apache.uima</groupId><artifactId>ruta-ep-textruler</artifactId>      <version>${item-maven-release-version}</version><destFileName>org.apache.uima.ruta.textruler_${item-eclipse-release-version}.jar</destFileName></artifactItem>

-                <artifactItem><groupId>org.apache.uima</groupId><artifactId>ruta-ep-core-ext</artifactId>      <version>${item-maven-release-version}</version><destFileName>org.apache.uima.ruta.core.ext_${item-eclipse-release-version}.jar</destFileName></artifactItem>

+                <artifactItem><groupId>org.apache.uima</groupId><artifactId>ruta-ep-core-ext</artifactId>       <version>${item-maven-release-version}</version><destFileName>org.apache.uima.ruta.core.ext_${item-eclipse-release-version}.jar</destFileName></artifactItem>

               </artifactItems>            

               <outputDirectory>${toBePacked}</outputDirectory>              

             </configuration>

@@ -158,7 +158,7 @@
 	                        <delete dir="${eclipseUpdateSubSite}" quiet="true" />

 	                        <exec executable="svn" failonerror="true">

 	                          <arg value="checkout" />

-	                          <arg value="${distsvnroot}repos/dist/release/uima/eclipse-update-site/${eclipseUpdateSiteComponent}" />

+	                          <arg value="${distsvnroot}repos/dist/release/uima/eclipse-update-site-v3/${eclipseUpdateSiteComponent}" />

 	                          <arg value="${eclipseUpdateSubSite}" />

 	                        </exec> 

 	                        

diff --git a/ruta-ep-addons/pom.xml b/ruta-ep-addons/pom.xml
index 2fdb2a3..78691e7 100644
--- a/ruta-ep-addons/pom.xml
+++ b/ruta-ep-addons/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-ep-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-ep-parent/pom.xml</relativePath>

   </parent>

   <properties>

diff --git a/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/ExplainTree.java b/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/ExplainTree.java
index 1268cbe..9c0ea11 100755
--- a/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/ExplainTree.java
+++ b/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/ExplainTree.java
@@ -107,7 +107,7 @@
             debugInlinedBlock.getAsCondition(), debugInlinedBlock.getMatched(), ts);

     parent.addChild(inlinedBlockNode);

 

-    FSArray inlinedRules = debugInlinedBlock.getInlinedRules();

+    FSArray<DebugScriptApply> inlinedRules = debugInlinedBlock.getInlinedRules();

     if (inlinedRules != null) {

       for (FeatureStructure each : inlinedRules) {

         buildTree(each, inlinedBlockNode, ts, offset, onlyRules);

@@ -234,7 +234,7 @@
       }

     }

 

-    FSArray inlinedActionBlocks = fs.getInlinedActionBlocks();

+    FSArray<DebugInlinedBlock> inlinedActionBlocks = fs.getInlinedActionBlocks();

     if (inlinedActionBlocks != null) {

       InlinedRootNode inlinedRootNode = new InlinedRootNode(remsNode, ts);

       remsNode.setInlined(inlinedRootNode);

@@ -269,7 +269,7 @@
         buildTree(each, remNode, ts, offset, onlyRules);

       }

     }

-    FSArray inlinedConditionBlocks = fs.getInlinedConditionBlocks();

+    FSArray<DebugInlinedBlock> inlinedConditionBlocks = fs.getInlinedConditionBlocks();

     if (inlinedConditionBlocks != null) {

       InlinedRootNode inlinedRootNode = new InlinedRootNode(remNode, ts);

       remNode.setInlined(inlinedRootNode);

diff --git a/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/RuleElementMatchNode.java b/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/RuleElementMatchNode.java
index 2ef1a35..39d8fe0 100755
--- a/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/RuleElementMatchNode.java
+++ b/ruta-ep-addons/src/main/java/org/apache/uima/ruta/explain/tree/RuleElementMatchNode.java
@@ -27,8 +27,8 @@
 import org.apache.uima.ruta.caseditor.view.tree.IAnnotationNode;

 import org.apache.uima.ruta.explain.ExplainConstants;

 

-public class RuleElementMatchNode extends ExplainAbstractTreeNode implements IEvaluatedNode,

-        IAnnotationNode {

+public class RuleElementMatchNode extends ExplainAbstractTreeNode

+        implements IEvaluatedNode, IAnnotationNode {

 

   private boolean matched;

 

@@ -40,7 +40,8 @@
     matched = baseFS.getBooleanValue(baseFeat);

 

     f = fs.getType().getFeatureByBaseName(ExplainConstants.CONDITIONS);

-    ArrayFS value = (ArrayFS) fs.getFeatureValue(f);

+    @SuppressWarnings("unchecked")

+    ArrayFS<FeatureStructure> value = (ArrayFS<FeatureStructure>) fs.getFeatureValue(f);

     if (value != null) {

       FeatureStructure[] fsarray = value.toArray();

       for (FeatureStructure each : fsarray) {

diff --git a/ruta-ep-caseditor/.gitignore b/ruta-ep-caseditor/.gitignore
index 718773c..7e3a306 100644
--- a/ruta-ep-caseditor/.gitignore
+++ b/ruta-ep-caseditor/.gitignore
@@ -1 +1 @@
-META-INF/
+META-INF/
\ No newline at end of file
diff --git a/ruta-ep-caseditor/pom.xml b/ruta-ep-caseditor/pom.xml
index eed81f1..3306d69 100644
--- a/ruta-ep-caseditor/pom.xml
+++ b/ruta-ep-caseditor/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-ep-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-ep-parent/pom.xml</relativePath>

   </parent>

   <properties>

diff --git a/ruta-ep-core-ext/pom.xml b/ruta-ep-core-ext/pom.xml
index a072c93..0991dd9 100644
--- a/ruta-ep-core-ext/pom.xml
+++ b/ruta-ep-core-ext/pom.xml
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-ep-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-ep-parent/pom.xml</relativePath>
   </parent>
   <properties>
diff --git a/ruta-ep-engine/.gitignore b/ruta-ep-engine/.gitignore
index 718773c..7e3a306 100644
--- a/ruta-ep-engine/.gitignore
+++ b/ruta-ep-engine/.gitignore
@@ -1 +1 @@
-META-INF/
+META-INF/
\ No newline at end of file
diff --git a/ruta-ep-engine/pom.xml b/ruta-ep-engine/pom.xml
index f781363..113f336 100644
--- a/ruta-ep-engine/pom.xml
+++ b/ruta-ep-engine/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-parent/pom.xml</relativePath>

   </parent>

 

diff --git a/ruta-ep-ide-ui/.gitignore b/ruta-ep-ide-ui/.gitignore
index 718773c..7e3a306 100644
--- a/ruta-ep-ide-ui/.gitignore
+++ b/ruta-ep-ide-ui/.gitignore
@@ -1 +1 @@
-META-INF/
+META-INF/
\ No newline at end of file
diff --git a/ruta-ep-ide-ui/pom.xml b/ruta-ep-ide-ui/pom.xml
index 4775b98..9d815f3 100644
--- a/ruta-ep-ide-ui/pom.xml
+++ b/ruta-ep-ide-ui/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-ep-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-ep-parent/pom.xml</relativePath>

   </parent>

 

diff --git a/ruta-ep-ide/.gitignore b/ruta-ep-ide/.gitignore
index 718773c..7e3a306 100644
--- a/ruta-ep-ide/.gitignore
+++ b/ruta-ep-ide/.gitignore
@@ -1 +1 @@
-META-INF/
+META-INF/
\ No newline at end of file
diff --git a/ruta-ep-ide/pom.xml b/ruta-ep-ide/pom.xml
index b2de160..4057c37 100644
--- a/ruta-ep-ide/pom.xml
+++ b/ruta-ep-ide/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-ep-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-ep-parent/pom.xml</relativePath>

   </parent>

 

diff --git a/ruta-ep-parent/pom.xml b/ruta-ep-parent/pom.xml
index 09b7f8f..1b041c8 100644
--- a/ruta-ep-parent/pom.xml
+++ b/ruta-ep-parent/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-parent/pom.xml</relativePath>
   </parent>
 
diff --git a/ruta-ep-textruler/.gitignore b/ruta-ep-textruler/.gitignore
index 718773c..7e3a306 100644
--- a/ruta-ep-textruler/.gitignore
+++ b/ruta-ep-textruler/.gitignore
@@ -1 +1 @@
-META-INF/
+META-INF/
\ No newline at end of file
diff --git a/ruta-ep-textruler/pom.xml b/ruta-ep-textruler/pom.xml
index 84b3836..e675b10 100644
--- a/ruta-ep-textruler/pom.xml
+++ b/ruta-ep-textruler/pom.xml
@@ -25,7 +25,7 @@
   <parent>

     <groupId>org.apache.uima</groupId>

     <artifactId>ruta-ep-parent</artifactId>

-    <version>2.8.2-SNAPSHOT</version>

+    <version>3.0.2-SNAPSHOT</version>

     <relativePath>../ruta-ep-parent/pom.xml</relativePath>

   </parent>

 

diff --git a/ruta-maven-archetype/pom.xml b/ruta-maven-archetype/pom.xml
index c6292cd..3529af5 100644
--- a/ruta-maven-archetype/pom.xml
+++ b/ruta-maven-archetype/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-parent/pom.xml</relativePath>
   </parent>
   <properties>
diff --git a/ruta-maven-archetype/src/main/resources/archetype-resources/pom.xml b/ruta-maven-archetype/src/main/resources/archetype-resources/pom.xml
index 55a3da4..3eea8b2 100644
--- a/ruta-maven-archetype/src/main/resources/archetype-resources/pom.xml
+++ b/ruta-maven-archetype/src/main/resources/archetype-resources/pom.xml
@@ -35,7 +35,7 @@
 
   <properties>
     <junit-version>4.11</junit-version>
-    <uima-version>2.10.4</uima-version>
+    <uima-version>3.1.1</uima-version>
     <ruta-version>${archetypeVersion}</ruta-version>
   </properties>
 
diff --git a/ruta-maven-plugin/pom.xml b/ruta-maven-plugin/pom.xml
index 544c151..2c23714 100644
--- a/ruta-maven-plugin/pom.xml
+++ b/ruta-maven-plugin/pom.xml
@@ -22,7 +22,7 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <!-- This artifact name follows the conventions described http://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-custom-plugin.html
-    where patterns like xxx-maven-plugin and maven-xxx-plugin can be invoked just using xxx if the right 
+    where patterns like xxx-maven-plugin and maven-xxx-plugin can be invoked just using xxx if the right
     settings are in place -->
   <artifactId>ruta-maven-plugin</artifactId>
   <packaging>maven-plugin</packaging>
@@ -34,7 +34,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-parent/pom.xml</relativePath>
   </parent>
   <properties>
@@ -142,7 +142,7 @@
             </execution>
           </executions>
         </plugin>
-        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence 
+        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence
           on the Maven build itself. -->
         <plugin>
           <groupId>org.eclipse.m2e</groupId>
diff --git a/ruta-parent/pom.xml b/ruta-parent/pom.xml
index 0b0c451..f604200 100644
--- a/ruta-parent/pom.xml
+++ b/ruta-parent/pom.xml
@@ -31,7 +31,7 @@
 

   <artifactId>ruta-parent</artifactId>

   <packaging>pom</packaging>

-  <version>2.8.2-SNAPSHOT</version>

+  <version>3.0.2-SNAPSHOT</version>

   <name>Apache UIMA Ruta: ${project.artifactId}</name>

   <url>${uimaWebsiteUrl}</url>

   <inceptionYear>2011</inceptionYear>

@@ -130,8 +130,8 @@
       (http://www.famfamfam.com/lab/icons/silk/), licensed under the

       Creative Commons Attribution 3.0 License.

     </postNoticeText>

-    <uimaVersion>2.10.4</uimaVersion>

-    <uimafit-version>2.4.0</uimafit-version>

+    <uimaVersion>3.1.1</uimaVersion>

+    <uimafit-version>3.0.0</uimafit-version>

     <spring-version>4.3.22.RELEASE</spring-version>

     <!--

       BACKWARD_COMPATIBLE_IMPLEMENTER - patch version (=.=.+)

diff --git a/ruta-typesystem/pom.xml b/ruta-typesystem/pom.xml
index db5920a..10bb713 100644
--- a/ruta-typesystem/pom.xml
+++ b/ruta-typesystem/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>ruta-parent</artifactId>
-    <version>2.8.2-SNAPSHOT</version>
+    <version>3.0.2-SNAPSHOT</version>
     <relativePath>../ruta-parent/pom.xml</relativePath>
   </parent>