You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2020/10/19 17:18:53 UTC
[uima-ruta] 01/01: UIMA-6281: Ruta: use uimaFIT instead of
CAS.select().coveredBy() internally
This is an automated email from the ASF dual-hosted git repository.
pkluegl pushed a commit to branch UIMA-6281-uimaFIT-coveredBy
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git
commit c0d655f8f8564d2cc114f4b05c0dca3fd623dc70
Author: Peter Klügl <pe...@averbis.com>
AuthorDate: Mon Oct 19 19:18:04 2020 +0200
UIMA-6281: Ruta: use uimaFIT instead of CAS.select().coveredBy() internally
- replace method in RutaStream method
---
.../src/main/java/org/apache/uima/ruta/RutaStream.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
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 53bce8a..2b49ea5 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
@@ -61,7 +61,6 @@ import org.apache.uima.fit.util.FSCollectionFactory;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
import org.apache.uima.ruta.block.RutaBlock;
-import org.apache.uima.ruta.engine.RutaEngine;
import org.apache.uima.ruta.expression.AnnotationTypeExpression;
import org.apache.uima.ruta.expression.IRutaExpression;
import org.apache.uima.ruta.expression.annotation.IAnnotationExpression;
@@ -1131,15 +1130,15 @@ public class RutaStream {
if (windowAnnotation != null
&& (windowAnnotation.getBegin() != cas.getDocumentAnnotation().getBegin()
|| windowAnnotation.getEnd() != cas.getDocumentAnnotation().getEnd())) {
- AnnotationFS frame = cas.createAnnotation(cas.getTypeSystem().getType(RutaEngine.FRAME_TYPE),
- windowAnnotation.getBegin(), windowAnnotation.getEnd());
- 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();
+ List<AnnotationFS> selectCovered = CasUtil.selectCovered(cas, type, windowAnnotation);
+ if (cas.getTypeSystem().subsumes(type, windowAnnotation.getType())) {
+ if (isVisible(windowAnnotation)) {
+ result.add(windowAnnotation);
+ }
+ }
+
+ for (AnnotationFS each : selectCovered) {
if (isVisible(each)) {
result.add(each);
}