I'm trying to write the code for a filtered iterator using
createFilteredIterator and FSMatchConstraint.
I used jcasgen to create java classes for my type system.
I have a type calles SearchProfile which has a feature isCaseSensitive.
I cannot figure out how to get the path to "isCaseSensitive" from my type
SearchProfile. I want to do it in a type safe way (compile-time).
code:
ConstraintFactory constraintFactory = aJCas.getConstraintFactory();
FSBooleanConstraint booleanConstraint = new FSBooleanConstraintImpl();
booleanConstraint.eq(true);
FeaturePath featurePath = ???
FSMatchConstraint matchConstraint = constraintFactory.embedConstraint(
featurePath ,booleanConstraint);
FSIndex profileFSIndex = aJCas.getAnnotationIndex(SearchProfile.type);
FSIterator<SearchProfile> profileIterator =
aJCas.createFilteredIterator(profileFSIndex.iterator(), matchConstraint);
cheers,
Peter Thygesen
|