On 02/01/2010 18:22, Richard Matthias Eckart de Castilho wrote: >>> How can one get access now to types that directly inherit from TOP? >> >> All access methods should still work. What exactly does >> no longer work for you? > > > I believe I had some code that initially already didn't work, but due to UIMA > 2.2.2 not supporting generics, I didn't notice it. I had something like this: > > class MetaData extends TOP > > MetaData metaData = (TOP) > jcas.getAnnotationIndex(MetaData.type).iterator().next(); > > In 2.2.2 this did not cause an error, but it likely also didn't work and I > just failed to notice it.
Correct, that wouldn't have worked. > > The problem here is that RunInformation inherits from TOP, not from > Annotation. But getAnnotationIndex(...) returns an index of <Annotation> > which in turn gets me an FSIterator<Annotation> so that next() returns an > Annotation. Since RunInformation does not inherit from Annotation, that does > not work. > > Digging into the API again, I believe the fix should be this: > > MetaData metaData = (MetaData) > jcas.getIndexRepository().getAllIndexedFS(MetaData.type).next() Yes, that should work. > > Cheers, > > -- Richard >
