uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinod <vkag...@gmail.com>
Subject annotation type
Date Wed, 11 Apr 2012 03:10:31 GMT
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.


Mime
View raw message