uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: How to test a CollectionReader
Date Thu, 30 Aug 2007 19:24:13 GMT
Hi Roberto -

After some tracing and tracking down, it seems the method you were using
to create your CAS pool
needs an additional statement.  Here's the original, which unfortunately
doesn't set up the type system
from the Collection Reader into the CASes (normally this isn't a
problem, because this happens elsewhere
in the setup to use a collection reader within a CPE):

            CasManager casManager = fcr.getCasManager();
            casManager.defineCasPool("pool", 2, null);

and here's the one which will set up the pool with the right type system:

            CasManager casManager = fcr.getCasManager();
               //  Added line:
           
casManager.addMetaData((ProcessingResourceMetaData)fcr.getMetaData());
            casManager.defineCasPool("pool", 2, null);

This lets the casManager know what the type system is, when setting up
the pool.

There's one other fix needed, also: 

At the end of the iterator is a statement to release the cas back to the
pool.  The form you are using
currently only works when the CAS View is the the base view (we'll fix
this...).  There is another form
which works which is recommended.  Here again, is the original, and the
new way:

       casManager.releaseCas(cas);   // fails because "cas" isn't the
base cas view
 
       cas.release();   // works
 
With those 2 fixes, your test should work.

-Marshall              

Roberto Franchini wrote:
> On 8/30/07, Marshall Schor <msa@schor.com> wrote:
>   
>> Hi Roberto -
>>
>> This might be caused by the Collection Reader Descriptor's type system
>> missing the particular type
>> "it.celi.types.SourceDocumentInformation";  can you verify it is defined
>> (and spelled correctly, etc.) as part of this particular Collection
>> Reader Descriptor?
>>
>> If this type was defined in another descriptor that is deployed with
>> this collection reader, it would work when the whole CPE was run,
>> because all the types from the various descriptors that make up the CPE
>> pipeline are merged.
>>
>>     
>
> I've tried to test the FileSystemCollectionReader provided in
> uimaj-tools and I got the same error.
> Attached (I hope it's possible to send attachements) the test I wrote.
> Regards,
> Roberto
>
>   


Mime
View raw message