uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Matthias Eckart de Castilho <eckar...@tk.informatik.tu-darmstadt.de>
Subject Re: Getting non-annotations (e.g. TOP) from a CAS
Date Mon, 01 Feb 2010 17:22:34 GMT
>> 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.

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()


-- Richard

Richard Eckart de Castilho
Software Engineer
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone +49 (6151) 16 - 6218, fax -5455, room S2/02/E225

View raw message