Hello,
I have a very basic question on Annotation type and
would appreciate any pointers.
I am using reflection to create an instance of an annotation,
before I add it to the cas, I want to check to
see if there is an instance of that type in the cas. However, the line
'jcas.getJFSIndexRepository().getAnnotationIndex(ann.type).iterator();'
below returns a non-zero set
containing DocumentAnnotation!
<pre>
Class uimaTypeClass = Class.forName(objectName);
Class[] constructorArgs = {JCas.class};
Object[] constructorArgVals = {jcas};
Constructor constructor = uimaTypeClass.getConstructor(constructorArgs);
Annotation ann = (Annotation)constructor.newInstance(constructorArgVals);
Iterator itr =
jcas.getJFSIndexRepository().getAnnotationIndex(ann.type).iterator();
if(itr.hasNext()){
ann = (Annotation)itr.next();
}
</pre>
Thanks.