Type annotType = jcas.getCasType(type);
Feature beginSpanFeature = annotType.getFeatureByBaseName("begin");
Feature endSpanFeature = annotType.getFeatureByBaseName("end");
FeaturePath beginFeaturePath = jcas.createFeaturePath();
beginFeaturePath.addFeature(beginSpanFeature);
FSMatchConstraint beginSpanConstraint = constraintFactory.embedConstraint(beginFeaturePath, windowConstraint);
FeaturePath endFeaturePath = jcas.createFeaturePath();
endFeaturePath.addFeature(endSpanFeature);
FSMatchConstraint endSpanConstraint = constraintFactory.embedConstraint(endFeaturePath, windowConstraint);