* @return
*/
public FSIterator<Annotation> createFilteredIterator(
int problemBegin, int problemEnd, Type sentenceType)
{
ConstraintFactory cf = jcas.getConstraintFactory();
TypeSystem ts = jcas.getTypeSystem();
Iterator<Type> it = ts.getTypeIterator();
//Type annotationType = ts.getType(Annotation.class.getName()); // this returns "org.apache.uima.tcas.Annotation" which isn't in type system
Type annotationType = ts.getType("uima.tcas.Annotation"); // should be safe to hard code this
//System.err.println("annotation type: " + annotationType);
Feature sentenceBeginFeature = annotationType.getFeatureByBaseName("begin");
FeaturePath sentenceBeginFeaturePath = jcas.createFeaturePath();
sentenceBeginFeaturePath.addFeature(sentenceBeginFeature);
Feature sentenceEndFeature = annotationType.getFeatureByBaseName("end");
FeaturePath sentenceEndFeaturePath = jcas.createFeaturePath();
sentenceEndFeaturePath.addFeature(sentenceEndFeature);
FSMatchConstraint beginAndEnd = constructConstraintByBeginEnd(
problemBegin, problemEnd, cf, sentenceBeginFeaturePath,
sentenceEndFeaturePath);
FSTypeConstraint sentenceTypeConstraint = cf.createTypeConstraint();
sentenceTypeConstraint.add(sentenceType);
FSMatchConstraint beginAndEndAndType = cf.and(beginAndEnd, sentenceTypeConstraint);
FSIterator<Annotation> filteredIterator =
jcas.createFilteredIterator(jcas.getAnnotationIndex().iterator(), beginAndEndAndType);
return filteredIterator;
}