Modified: 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java?rev=1506596&r1=1506595&r2=1506596&view=diff
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
 (original)
+++ 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
 Wed Jul 24 15:24:43 2013
@@ -49,13 +49,15 @@ public class WildCardRuleElement extends
     super(null, conditions, actions, container, parent);
   }
 
-  public void startMatch(RuleMatch ruleMatch, RuleApply ruleApply,
+  public List<RuleMatch> startMatch(RuleMatch ruleMatch, RuleApply ruleApply,
           ComposedRuleElementMatch containerMatch, RuleElement entryPoint, 
RutaStream stream,
           InferenceCrowd crowd) {
-    continueMatch(true, null, ruleMatch, ruleApply, containerMatch, null, 
entryPoint, stream, crowd);
+    List<RuleMatch> result = continueMatch(true, null, ruleMatch, ruleApply, 
containerMatch, null,
+            entryPoint, stream, crowd);
+    return result;
   }
 
-  public void continueMatch(boolean after, AnnotationFS annotation, RuleMatch 
ruleMatch,
+  public List<RuleMatch> continueMatch(boolean after, AnnotationFS annotation, 
RuleMatch ruleMatch,
           RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
           RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream 
stream,
           InferenceCrowd crowd) {
@@ -75,40 +77,38 @@ public class WildCardRuleElement extends
     if (nextElement == null) {
       nextDepth = 0;
     }
-    tryWithNextRuleElement(nextElement, after, annotation, ruleMatch, 
ruleApply, containerMatch,
-            nextDepth, sideStepOrigin, entryPoint, stream, crowd);
-
+    List<RuleMatch> result = tryWithNextRuleElement(nextElement, after, 
annotation, ruleMatch,
+            ruleApply, containerMatch, nextDepth, sideStepOrigin, entryPoint, 
stream, crowd);
+    return result;
   }
 
-  private void tryWithNextRuleElement(RuleElement nextElement, boolean after,
+  private List<RuleMatch> tryWithNextRuleElement(RuleElement nextElement, 
boolean after,
           AnnotationFS annotation, RuleMatch ruleMatch, RuleApply ruleApply,
           ComposedRuleElementMatch containerMatch, int nextDepth, 
RutaRuleElement sideStepOrigin,
           RuleElement entryPoint, RutaStream stream, InferenceCrowd crowd) {
+    List<RuleMatch> result = new ArrayList<RuleMatch>();
     // what is the next stuff that should match?
     if (nextElement == null) {
       AnnotationFS afs = getCoveredByWildCard(after, annotation, null, stream);
       doMatch(afs, ruleMatch, containerMatch, annotation == null, stream, 
crowd);
       ComposedRuleElement composed = (ComposedRuleElement) getContainer();
-      composed.fallbackContinue(after, ruleMatch.matched(), afs, ruleMatch, 
ruleApply,
+      result = composed.fallbackContinue(after, ruleMatch.matched(), afs, 
ruleMatch, ruleApply,
               containerMatch, sideStepOrigin, entryPoint, stream, crowd);
     } else if (nextElement instanceof RutaRuleElement) {
       RutaRuleElement re = (RutaRuleElement) nextElement;
       RutaMatcher matcher = re.getMatcher();
       if (matcher instanceof RutaTypeMatcher) {
-        tryWithNextType(after, annotation, nextElement, null, ruleMatch, 
ruleApply, containerMatch,
-                nextDepth, sideStepOrigin, stream, crowd);
+        result = tryWithNextType(after, annotation, nextElement, null, 
ruleMatch, ruleApply,
+                containerMatch, nextDepth, sideStepOrigin, stream, crowd);
       } else if (matcher instanceof RutaLiteralMatcher) {
-        tryWithNextLiteral(after, annotation, re, ruleMatch, ruleApply, 
containerMatch, nextDepth,
-                sideStepOrigin, stream, crowd);
-      } else if (matcher instanceof RutaDisjunctiveMatcher) {
-        tryWithNextType(after, annotation, re, null, ruleMatch, ruleApply, 
containerMatch,
+        result = tryWithNextLiteral(after, annotation, re, ruleMatch, 
ruleApply, containerMatch,
                 nextDepth, sideStepOrigin, stream, crowd);
-      }
+      } 
 
     } else if (nextElement instanceof ComposedRuleElement) {
       ComposedRuleElement cre = ((ComposedRuleElement) nextElement);
-      tryWithNextComposed(after, annotation, cre, ruleMatch, ruleApply, 
containerMatch, nextDepth,
-              sideStepOrigin, stream, crowd);
+      result = tryWithNextComposed(after, annotation, cre, ruleMatch, 
ruleApply, containerMatch,
+              nextDepth, sideStepOrigin, stream, crowd);
       // RuleElement nextInnerRuleElement = null;
       // if (after) {
       // nextInnerRuleElement = cre.getFirstElement();
@@ -130,14 +130,17 @@ public class WildCardRuleElement extends
     } else if (nextElement instanceof WildCardRuleElement) {
       // another wildcard? seriously? then just assume its an "Annotation" type
       CAS cas = stream.getCas();
-      tryWithNextType(after, annotation, nextElement, cas.getAnnotationType(), 
ruleMatch,
+      result = tryWithNextType(after, annotation, nextElement, 
cas.getAnnotationType(), ruleMatch,
               ruleApply, containerMatch, nextDepth, sideStepOrigin, stream, 
crowd);
     }
+    return result;
   }
 
-  private void tryWithNextComposed(boolean after, AnnotationFS annotation, 
ComposedRuleElement cre,
-          RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch 
containerMatch,
-          int nextDepth, RutaRuleElement sideStepOrigin, RutaStream stream, 
InferenceCrowd crowd) {
+  private List<RuleMatch> tryWithNextComposed(boolean after, AnnotationFS 
annotation,
+          ComposedRuleElement cre, RuleMatch ruleMatch, RuleApply ruleApply,
+          ComposedRuleElementMatch containerMatch, int nextDepth, 
RutaRuleElement sideStepOrigin,
+          RutaStream stream, InferenceCrowd crowd) {
+    List<RuleMatch> result = new ArrayList<RuleMatch>();
     AnnotationFS nextOne = annotation;
     boolean doneHere = false;
     while (!doneHere && (nextOne = getNextPositionForComposed(cre, after, 
nextOne, stream)) != null) {
@@ -154,10 +157,10 @@ public class WildCardRuleElement extends
         // Hotfix for UIMA-3002
         int applied = ruleApply.getApplied();
         if (endAnchor == null) {
-          cre.startMatch(extendedMatch, ruleApply, nextContainerMatch, cre, 
stream, crowd);
+          result = cre.startMatch(extendedMatch, ruleApply, 
nextContainerMatch, cre, stream, crowd);
         } else {
-          cre.continueMatch(after, endAnchor, extendedMatch, ruleApply, 
nextContainerMatch,
-                  sideStepOrigin, cre, stream, crowd);
+          result = cre.continueMatch(after, endAnchor, extendedMatch, 
ruleApply,
+                  nextContainerMatch, sideStepOrigin, cre, stream, crowd);
         }
         List<RuleElementMatch> nextList = 
nextContainerMatch.getInnerMatches().get(cre);
         boolean matched = hasMatched(nextList);
@@ -180,9 +183,10 @@ public class WildCardRuleElement extends
     if (!doneHere) {
       ComposedRuleElementMatch nextContainerMatch = 
getContainerMatchOfNextElement(containerMatch,
               nextDepth);
-      cre.continueMatch(after, annotation, ruleMatch, ruleApply, 
nextContainerMatch,
+      result = cre.continueMatch(after, annotation, ruleMatch, ruleApply, 
nextContainerMatch,
               sideStepOrigin, null, stream, crowd);
     }
+    return result;
   }
 
   private boolean hasMatched(List<RuleElementMatch> nextList) {
@@ -200,41 +204,69 @@ public class WildCardRuleElement extends
           AnnotationFS annotation, RutaStream stream) {
     RuleElement element = getNextAtomicRuleElement(cre, after);
     AnnotationFS result = null;
+    Boolean conjunct = cre.getConjunct();
     if (element instanceof WildCardRuleElement) {
       if (after) {
         return stream.getAnchor(after, annotation.getEnd());
       } else {
         return stream.getAnchor(after, annotation.getBegin());
       }
-    } else {
-      RutaRuleElement re = (RutaRuleElement) element;
-      RutaMatcher matcher = re.getMatcher();
-      if (matcher instanceof RutaTypeMatcher) {
-        FSIterator<AnnotationFS> iterator = getIterator(after, annotation, re, 
null, stream);
-        // moveOn(after, iterator);
-        if (iterator.isValid()) {
-          result = iterator.get();
-        }
-      } else if (matcher instanceof RutaLiteralMatcher) {
-        RutaLiteralMatcher lm = (RutaLiteralMatcher) matcher;
-        StringExpression expression = lm.getExpression();
-        String stringValue = expression.getStringValue(parent, annotation, 
stream);
-        AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
-        int delta = documentAnnotation.getBegin();
-        String document = documentAnnotation.getCoveredText();
-        int pointer = annotation.getEnd() - delta;
-        int indexOf = document.indexOf(stringValue, pointer);
-        if (indexOf < 0) {
-          return null;
-        } else {
-          return stream.getAnchor(after, indexOf);
+    } else if(conjunct != null && !conjunct){
+      // disjunctive
+      List<RuleElement> ruleElements = cre.getRuleElements();
+      List<AnnotationFS> nextPostions = new ArrayList<AnnotationFS>();
+      for (RuleElement ruleElement : ruleElements) {
+        if(ruleElement instanceof ComposedRuleElement) {
+          AnnotationFS nextPositionForComposed = 
getNextPositionForComposed((ComposedRuleElement) ruleElement, after, 
annotation, stream);
+          if(nextPositionForComposed != null) {
+            nextPostions.add(nextPositionForComposed);
+          }
+        } else if(ruleElement instanceof RutaRuleElement) {
+          AnnotationFS nextPositionForAtomic = getNextPositionForAtomic(after, 
annotation, stream, ruleElement, result);
+          if(nextPositionForAtomic != null) {
+            nextPostions.add(nextPositionForAtomic);
+          }
         }
       }
+      if(!nextPostions.isEmpty()) {
+        Collections.sort(nextPostions, new AnnotationComparator());
+        result = nextPostions.get(0);
+      }
+    } else {
+      result = getNextPositionForAtomic(after, annotation, stream, element, 
result);
     }
 
     return result;
   }
 
+  private AnnotationFS getNextPositionForAtomic(boolean after, AnnotationFS 
annotation,
+          RutaStream stream, RuleElement element, AnnotationFS result) {
+    RutaRuleElement re = (RutaRuleElement) element;
+    RutaMatcher matcher = re.getMatcher();
+    if (matcher instanceof RutaTypeMatcher) {
+      FSIterator<AnnotationFS> iterator = getIterator(after, annotation, re, 
null, stream);
+      // moveOn(after, iterator);
+      if (iterator.isValid()) {
+        result = iterator.get();
+      }
+    } else if (matcher instanceof RutaLiteralMatcher) {
+      RutaLiteralMatcher lm = (RutaLiteralMatcher) matcher;
+      StringExpression expression = lm.getExpression();
+      String stringValue = expression.getStringValue(parent, annotation, 
stream);
+      AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
+      int delta = documentAnnotation.getBegin();
+      String document = documentAnnotation.getCoveredText();
+      int pointer = annotation.getEnd() - delta;
+      int indexOf = document.indexOf(stringValue, pointer);
+      if (indexOf < 0) {
+        return null;
+      } else {
+        return stream.getAnchor(after, indexOf);
+      }
+    }
+    return result;
+  }
+
   private RuleElement getNextAtomicRuleElement(ComposedRuleElement cre, 
boolean after) {
     if (after) {
       RuleElement firstElement = cre.getFirstElement();
@@ -253,10 +285,11 @@ public class WildCardRuleElement extends
     }
   }
 
-  private void tryWithNextType(boolean after, AnnotationFS annotation, 
RuleElement nextElement,
-          Type defaultType, RuleMatch ruleMatch, RuleApply ruleApply,
+  private List<RuleMatch> tryWithNextType(boolean after, AnnotationFS 
annotation,
+          RuleElement nextElement, Type defaultType, RuleMatch ruleMatch, 
RuleApply ruleApply,
           ComposedRuleElementMatch containerMatch, int nextDepth, 
RutaRuleElement sideStepOrigin,
           RutaStream stream, InferenceCrowd crowd) {
+    List<RuleMatch> result = new ArrayList<RuleMatch>();
     FSIterator<AnnotationFS> iterator = getIterator(after, annotation, 
nextElement, defaultType,
             stream);
     boolean doneHere = false;
@@ -273,12 +306,12 @@ public class WildCardRuleElement extends
         ComposedRuleElementMatch nextContainerMatch = 
getContainerMatchOfNextElement(
                 extendedContainerMatch, nextDepth);
         if (endAnchor == null) {
-          nextElement.startMatch(extendedMatch, ruleApply, nextContainerMatch, 
nextElement, stream,
-                  crowd);
+          result = nextElement.startMatch(extendedMatch, ruleApply, 
nextContainerMatch,
+                  nextElement, stream, crowd);
         } else {
           // TODO match and containermatch should be on the correct level!
-          nextElement.continueMatch(after, endAnchor, extendedMatch, 
ruleApply, nextContainerMatch,
-                  sideStepOrigin, nextElement, stream, crowd);
+          result = nextElement.continueMatch(after, endAnchor, extendedMatch, 
ruleApply,
+                  nextContainerMatch, sideStepOrigin, nextElement, stream, 
crowd);
         }
         List<RuleElementMatch> nextList = 
nextContainerMatch.getInnerMatches().get(nextElement);
         if (nextList == null || nextList.isEmpty() || 
!nextList.get(nextList.size() - 1).matched()) {
@@ -292,6 +325,7 @@ public class WildCardRuleElement extends
         moveOn(after, iterator);
       }
     }
+    return result;
   }
 
   private ComposedRuleElementMatch getContainerMatchOfNextElement(
@@ -315,9 +349,6 @@ public class WildCardRuleElement extends
         List<Type> types = typeMatcher.getTypes(parent, stream);
         Type type = types.get(0);
         iterator = getIteratorOfType(after, type, annotation, stream);
-      } else if (matcher instanceof RutaDisjunctiveMatcher) {
-        List<Type> types = matcher.getTypes(parent, stream);
-        iterator = getIteratorForDisjunctive(cas, types, after, annotation, 
stream);
       } else {
         // should not happen
       }
@@ -369,10 +400,11 @@ public class WildCardRuleElement extends
     return result;
   }
 
-  private void tryWithNextLiteral(boolean after, AnnotationFS annotation,
+  private List<RuleMatch> tryWithNextLiteral(boolean after, AnnotationFS 
annotation,
           RutaRuleElement nextElement, RuleMatch ruleMatch, RuleApply 
ruleApply,
           ComposedRuleElementMatch containerMatch, int nextDepth, 
RutaRuleElement sideStepOrigin,
           RutaStream stream, InferenceCrowd crowd) {
+    List<RuleMatch> result = new ArrayList<RuleMatch>();
     RutaLiteralMatcher matcher = (RutaLiteralMatcher) nextElement.getMatcher();
     StringExpression expression = matcher.getExpression();
     String stringValue = expression.getStringValue(parent, null, stream);
@@ -407,11 +439,11 @@ public class WildCardRuleElement extends
         ComposedRuleElementMatch nextContainerMatch = 
getContainerMatchOfNextElement(
                 extendedContainerMatch, nextDepth);
         if (endAnchor == null) {
-          nextElement.startMatch(extendedMatch, ruleApply, nextContainerMatch, 
nextElement, stream,
-                  crowd);
+          result = nextElement.startMatch(extendedMatch, ruleApply, 
nextContainerMatch,
+                  nextElement, stream, crowd);
         } else {
-          nextElement.continueMatch(after, endAnchor, extendedMatch, 
ruleApply, nextContainerMatch,
-                  sideStepOrigin, nextElement, stream, crowd);
+          result = nextElement.continueMatch(after, endAnchor, extendedMatch, 
ruleApply,
+                  nextContainerMatch, sideStepOrigin, nextElement, stream, 
crowd);
         }
         List<RuleElementMatch> nextList = 
nextContainerMatch.getInnerMatches().get(nextElement);
         if (nextList == null || nextList.isEmpty()) {
@@ -423,6 +455,7 @@ public class WildCardRuleElement extends
         pointer = getNextPointer(after, anchor);
       }
     }
+    return result;
   }
 
   private int getNextPointer(boolean after, AnnotationFS anchor) {
@@ -544,14 +577,14 @@ public class WildCardRuleElement extends
     ruleMatch.setMatched(ruleMatch.matched() && result.matched());
     List<RuleElementMatch> rems = new ArrayList<RuleElementMatch>();
     rems.add(result);
-    ruleMatch.processMatchInfo(this, rems, stream);
   }
 
-  public void continueOwnMatch(boolean after, AnnotationFS annotation, 
RuleMatch ruleMatch,
-          RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
+  public List<RuleMatch> continueOwnMatch(boolean after, AnnotationFS 
annotation,
+          RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch 
containerMatch,
           RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream 
stream,
           InferenceCrowd crowd) {
     // won't happen
+    return Collections.emptyList();
   }
 
   public Collection<AnnotationFS> getAnchors(RutaStream symbolStream) {

Modified: 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/NormalQuantifier.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/NormalQuantifier.java?rev=1506596&r1=1506595&r2=1506596&view=diff
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/NormalQuantifier.java
 (original)
+++ 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/NormalQuantifier.java
 Wed Jul 24 15:24:43 2013
@@ -45,7 +45,9 @@ public class NormalQuantifier implements
       return null;
     }
     boolean result = true;
+    boolean resultOr = false;
     boolean allEmpty = true;
+    
     for (RuleElementMatch match : matches) {
       result &= match.matched();
       allEmpty &= match.getTextsMatched().isEmpty();

Modified: 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java?rev=1506596&r1=1506595&r2=1506596&view=diff
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java
 (original)
+++ 
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java
 Wed Jul 24 15:24:43 2013
@@ -36,7 +36,6 @@ import org.apache.uima.ruta.expression.t
 import org.apache.uima.ruta.rule.ComposedRuleElement;
 import org.apache.uima.ruta.rule.RegExpRule;
 import org.apache.uima.ruta.rule.RuleElement;
-import org.apache.uima.ruta.rule.RutaDisjunctiveMatcher;
 import org.apache.uima.ruta.rule.RutaMatcher;
 import org.apache.uima.ruta.rule.RutaRule;
 import org.apache.uima.ruta.rule.RutaRuleElement;
@@ -145,9 +144,18 @@ public class ScriptVerbalizer {
     StringBuilder result = new StringBuilder();
     List<RuleElement> ruleElements = cre.getRuleElements();
     result.append("(");
+    String sep = " ";
+    Boolean conjunct = cre.getConjunct();
+    if(conjunct != null) {
+      if(conjunct) {
+        sep = " & ";
+      } else {
+        sep = " | ";
+      }
+    }
     for (RuleElement each : ruleElements) {
       if (cre.getRuleElements().indexOf(each) != 0) {
-        result.append(" ");
+        result.append(sep);
       }
       result.append(verbalizeRuleElement(each));
     }
@@ -158,20 +166,7 @@ public class ScriptVerbalizer {
   public String verbalizeMatcher(RutaRuleElement tmre) {
     StringBuilder result = new StringBuilder();
     RutaMatcher matcher = tmre.getMatcher();
-    if (matcher instanceof RutaDisjunctiveMatcher) {
-      RutaDisjunctiveMatcher dmatcher = (RutaDisjunctiveMatcher) matcher;
-      List<RutaExpression> expressions = dmatcher.getExpressions();
-      result.append("(");
-      for (RutaExpression each : expressions) {
-        if (expressions.indexOf(each) != 0) {
-          result.append(" | ");
-        }
-        result.append(verbalizer.verbalize(each));
-      }
-      result.append(")");
-    } else {
-      result.append(verbalizer.verbalize(matcher.getExpression()));
-    }
+    result.append(verbalizer.verbalize(matcher.getExpression()));
     return result.toString();
   }
 

Added: 
uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/ConjunctRuleTest.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/ConjunctRuleTest.java?rev=1506596&view=auto
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/ConjunctRuleTest.java
 (added)
+++ 
uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/ConjunctRuleTest.java
 Wed Jul 24 15:24:43 2013
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+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.RutaTestUtils.TestFeature;
+import org.apache.uima.ruta.engine.RutaEngine;
+import org.junit.Test;
+
+public class ConjunctRuleTest {
+
+  @Test
+  public void test() {
+    String name = this.getClass().getSimpleName();
+    String namespace = 
this.getClass().getPackage().getName().replaceAll("\\.", "/");
+    CAS cas = null;
+    try {
+      cas = RutaTestUtils.process(namespace + "/" + name + 
RutaEngine.SCRIPT_FILE_EXTENSION, namespace + "/" + name
+              + ".txt", 50);
+    } catch (Exception e) {
+      e.printStackTrace();
+      assert (false);
+    }
+    Type t = null;
+    AnnotationIndex<AnnotationFS> ai = null;
+    FSIterator<AnnotationFS> iterator = null;
+
+    t = RutaTestUtils.getTestType(cas, 1);
+    ai = cas.getAnnotationIndex(t);
+//    assertEquals(4, ai.size());
+//    iterator = ai.iterator();
+//    assertEquals("Peter", iterator.next().getCoveredText());
+//    assertEquals("Jochen", iterator.next().getCoveredText());
+//    assertEquals("Flo", iterator.next().getCoveredText());
+//    assertEquals("Georg", iterator.next().getCoveredText());
+
+    
+    if (cas != null) {
+      cas.release();
+    }
+
+  }
+}

Added: 
uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.ruta
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.ruta?rev=1506596&view=auto
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.ruta
 (added)
+++ 
uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.ruta
 Wed Jul 24 15:24:43 2013
@@ -0,0 +1,4 @@
+DECLARE T1, T2, T3, T4, T5, T6;
+
+(CW & W){-> T1};
+(CW | SW){-> T2};
\ No newline at end of file

Added: 
uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.txt
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.txt?rev=1506596&view=auto
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.txt
 (added)
+++ 
uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/ConjunctRuleTest.txt
 Wed Jul 24 15:24:43 2013
@@ -0,0 +1 @@
+Peter Kluegl, Joern Kottmann, Marshall Schor.
\ No newline at end of file

Modified: 
uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
URL: 
http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g?rev=1506596&r1=1506595&r2=1506596&view=diff
==============================================================================
--- 
uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
 (original)
+++ 
uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
 Wed Jul 24 15:24:43 2013
@@ -576,7 +576,7 @@ simpleStatement returns [RutaRule stmt =
        : 
        (regexpRule)=> rer = regexpRule {stmt = rer;}
        |
-       elements=ruleElements 
+       elements=ruleElementsRoot
                s = SEMI 
                {stmt = scriptFactory.createRule(elements, s);}
                
@@ -623,10 +623,15 @@ regexpRule returns [RutaRule stmt = null
 
 
 
+ruleElementsRoot returns [List<Expression> elements = new 
ArrayList<Expression>()]
+       :
+       re = ruleElement {if(re!=null) elements.add(re);} PERCENT? (re = 
ruleElement {if(re!=null) elements.add(re);})*
+       ;       
+
 ruleElements returns [List<Expression> elements = new ArrayList<Expression>()]
        :
        re = ruleElement {if(re!=null) elements.add(re);} (re = ruleElement 
{if(re!=null) elements.add(re);})*
-       ;       
+       ;
        
 blockRuleElement returns [RutaRuleElement rElement = null] 
//[List<RutaRuleElement> elements = new ArrayList<RutaRuleElement>()]
        :
@@ -671,23 +676,20 @@ List<RutaCondition> dummyConds = new Arr
        
 ruleElementComposed returns [ComposedRuleElement re = null] 
 @init{
-       boolean disjunctive = false;
+       Boolean disjunctive = null;
+       List<Expression> res = new ArrayList<Expression>();
 }
        :
        ft = LPAREN
-        
-       (((ruleElementType | ruleElementLiteral) VBAR)=>  (re11 
=ruleElementType| re12 = ruleElementLiteral) 
-       {disjunctive = true; res = new ArrayList<Expression>(); if(re11!=null) 
res.add(re11);if(re12!=null) res.add(re12);} 
-       VBAR (re21 = ruleElementType| re22 = ruleElementLiteral) 
-       { if(re21!=null) res.add(re21);if(re22!=null) res.add(re22);}
        (
-       VBAR (re31 = ruleElementType| re32 = ruleElementLiteral) 
-       { if(re31!=null) res.add(re31);if(re32!=null) res.add(re32);}
-       )*
-        |(ruleElements)=>res = ruleElements)
-       
+       (ruleElement VBAR)=> re1 = ruleElement {res.add(re1);} (VBAR re1 = 
ruleElement {disjunctive = true; res.add(re1);})+
+       |
+       (ruleElement AMPER)=> re2 = ruleElement {res.add(re2);} (AMPER re2 = 
ruleElement {disjunctive = false; res.add(re2);})+
+       |
+       res2 = ruleElements {res = res2;}
+       )
        lt1 = RPAREN q = quantifierPart? (LCURLY c = conditions? (THEN a = 
actions)? lt2 = RCURLY)?
-       {re = scriptFactory.createComposedRuleElement(res, q, c, a, 
disjunctive,$blockDeclaration::env, ft, lt1, lt2);}
+       {re = scriptFactory.createComposedRuleElement(res, q, c, a, 
disjunctive, $blockDeclaration::env, ft, lt1, lt2);}
        ;
 
 ruleElementType returns [RutaRuleElement re = null] 


Reply via email to