On 8/30/07, Marshall Schor <[EMAIL PROTECTED]> 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
--
Roberto Franchini
CELI s.r.l. (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:[EMAIL PROTECTED] skype:ro.franchini
package org.apache.uima.tools.components;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.apache.uima.UIMAFramework;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASRuntimeException;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Feature;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
import org.apache.uima.collection.CollectionException;
import org.apache.uima.collection.CollectionReaderDescription;
import org.apache.uima.examples.SourceDocumentInformation;
import org.apache.uima.resource.CasManager;
import org.apache.uima.resource.ResourceInitializationException;
public class TestFileSystemCollectionReader extends TestCase {
private FileSystemCollectionReader fcr;
protected void setUp() throws Exception {
super.setUp();
CollectionReaderDescription aSpecifier= FileSystemCollectionReader.getDescription();
fcr = (FileSystemCollectionReader) UIMAFramework.produceCollectionReader(aSpecifier);
}
public void testGetNext() {
try {
CasManager casManager = fcr.getCasManager();
casManager.defineCasPool("pool", 2, null);
while (fcr.hasNext()) {
CAS cas = casManager.getCas("pool");
fcr.getNext(cas);
Type fileLocType = cas.getTypeSystem().getType(SourceDocumentInformation.class.getName());
Feature fileNameFeat = fileLocType.getFeatureByBaseName("uri");
FSIterator it = cas.getAnnotationIndex(fileLocType).iterator();
FeatureStructure fileLoc = it.get();
Logger.getRootLogger().info("Processed Document " + fileLoc.getStringValue(fileNameFeat));
// AnnotationIndex annotationIndex =
// cas.getJCas().getAnnotationIndex(SourceDocumentInformation.type);
// FSIterator iterator = annotationIndex.iterator();
casManager.releaseCas(cas);
}
} catch (CollectionException e) {
fail();
} catch (IOException e) {
fail();
} catch (CASRuntimeException e) {
e.printStackTrace();
fail();
} catch (ResourceInitializationException e) {
fail();
}
}
}