Author: pkluegl Date: Sun Jun 2 17:51:55 2013 New Revision: 1488751 URL: http://svn.apache.org/r1488751 Log: UIMA-2915 - retain all subtypes
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java?rev=1488751&r1=1488750&r2=1488751&view=diff ============================================================================== --- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java (original) +++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/FilterManager.java Sun Jun 2 17:51:55 2013 @@ -52,6 +52,8 @@ public class FilterManager { private ConstraintFactory cf; + private final CAS cas; + public FilterManager(Collection<Type> filterTypes, CAS cas) { super(); this.defaultFilterTypes = filterTypes; @@ -64,6 +66,8 @@ public class FilterManager { this.windowAnnotation = null; this.windowType = null; this.additionalWindow = null; + + this.cas = cas; } public FilterManager(Collection<Type> defaultFilterTypes, Collection<Type> filterTypes, @@ -79,6 +83,8 @@ public class FilterManager { this.windowAnnotation = windowAnnotation; this.windowType = windowType; this.additionalWindow = createWindowConstraint(windowAnnotation, cas); + + this.cas = cas; } private FSMatchConstraint createWindowConstraint(AnnotationFS windowAnnotation, CAS cas) { @@ -110,6 +116,12 @@ public class FilterManager { filterTypes.addAll(defaultFilterTypes); filterTypes.addAll(currentFilterTypes); filterTypes.removeAll(currentRetainTypes); + for (Type type : currentRetainTypes) { + if (type != null) { + List<Type> subsumedTypes = cas.getTypeSystem().getProperlySubsumedTypes(type); + filterTypes.removeAll(subsumedTypes); + } + } FSMatchConstraint typeConstraint = createTypeConstraint(filterTypes);