uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Riebling <e...@cs.cmu.edu>
Subject Annotation vs. FeatureStructure: CAS Consumer in Aggregate AE
Date Tue, 08 Dec 2009 15:11:06 GMT
I'm running a UIMA-AS aggregate that consists of a single annotator, and a Base
UIMA Collection Reader and CAS Consumer.  I configure the annotator and CAS
Consumer as an Aggregate AE, and send it CASes using runRemoteAsyncAE,
specifying the Collection Reader.

The CAS Consumer works fine with base UIMA, but when running it this way as
"pure UIMA-AS" it has trouble in the code which reads annotations out of the
CAS's AnnotationIndex.  Specifically, it gets a ClassCastException:

Caused by: java.lang.ClassCastException: org.apache.uima.cas.impl.AnnotationImpl

in the code that iterates through the AnnotationIndex:

AnnotationIndex idx = (AnnotationIndex) aCAS.getAnnotationIndex( wordType ); 
Iterator<Annotation> it = idx.iterator();
// for each word
while ( it.hasNext() ) {
  Annotation a = (Annotation) it.next();

I'm confused by a couple of points:

1.  How come the code works fine with base UIMA if there's a type casting issue

2.  Since the default type returned by the next() method of an annotation
iterator is normally a FeatureStructure, it seems that I should use
FeatureStructures, not Annotations.  How do I go about obtaining the same
information I would have gotten from Annotations, such as from
Annotation.getBegin(), Annotation.getCoveredText(), etc.?  Those methods are not
present on FeatureStructure, as far as I can tell.

View raw message