InputStream inCollectionReaderDescripton = getClass()
.getResourceAsStream("CorporaCollectionReader.xml");
// TODO: inCollectionReaderDescripton check for null
CollectionReaderDescription collectionReaderDescripton;
try
{
collectionReaderDescripton = (CollectionReaderDescription)
UIMAFramework.getXMLParser().parseResourceSpecifier(
new XMLInputSource(inCollectionReaderDescripton,
new File("")));
}
catch (InvalidXMLException e)
{
throw new InvocationTargetException(e, "CorporaCollectionReader.xml"
+ " could ne be parsed!");
}
NlpProject project =
mConfiguration.getConsumerElement().getNlpProject();
InputStream inTypeSystemDescription;
try
{
inTypeSystemDescription =
project.getDotCorpus().getTypeSystemFile().getContents();
}
catch (CoreException e)
{
throw new InvocationTargetException(e);
}
TypeSystemDescription typeSystemDescriptor;
try
{
typeSystemDescriptor = UIMAFramework.getXMLParser()
.parseTypeSystemDescription(
new XMLInputSource(inTypeSystemDescription, new File("")));
typeSystemDescriptor.resolveImports();
}
catch (InvalidXMLException e)
{
throw new InvocationTargetException(e);
}
// set type system to collection reader
ProcessingResourceMetaData collectionReaderMetaData =
collectionReaderDescripton.getCollectionReaderMetaData();
collectionReaderMetaData.setTypeSystem(typeSystemDescriptor);
XMLParser xmlParser = UIMAFramework.getXMLParser();