uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <eckar...@tk.informatik.tu-darmstadt.de>
Subject Re: Attempted to copy a FeatureStructure of type "org.apache.uima.examples.SourceDocumentInformation:uri", which is not defined in the type system of the destination CAS.
Date Wed, 14 Sep 2011 20:04:52 GMT
>> Throwable occurred: org.apache.uima.UIMARuntimeException: Attempted to copy
>> a FeatureStructure of type
>> "org.apache.uima.examples.SourceDocumentInformation:uri", which is not
>> defined in the type system of the destination CAS.


> It looks like the CAS you're trying to copy from has instances of the type
> "org.apache.uima.examples.SourceDocumentInformation", and that your current
> pipeline doesn't include a definition of that type.

I believe the scenario is roughly this:

- there is some reader which calls CAS.setDocumentMetadata(new SourceDocumentInfo(...))
- in the CasMultiplier a new CAS is fetched with getNewCAS()
- since the new CAS has no document meta data, I suggested to call e.g. setDocumentLanguage()
so that UIMA creates one
- what UIMA creates is not a SourceDocumentInfo feature structure but a DocumentMetadata feature
structure which does not have the "uri" feature
- result: the exception we see here

At least that is the scenario in which I've run into this problem a couple of times as well.

My workaround to handle this is to check what kind of feature structure is used in the source
CAS and create that in the target CAS as well:

		// Need to initialize the document annotation in the target view with a feature structure
of
		// the proper type before copying
		targetView.addFsToIndexes(targetView.getCas().createAnnotation(
				sourceView.getDocumentAnnotation().getType(), 0, 0));
		// Copy the document annotation.
		AnnotationFS copy = (AnnotationFS) copier.copyFs(sourceView.getDocumentAnnotation());
		copy.setIntValue(beginFeature, 0);
		copy.setIntValue(endFeature, segment.getCoveredText().length());

Note that this needs to be done before calling setDocumentText(), setDocumentLanguage() or
the likes. They would create a DocumentMetadata feature structure otherwise. You can safely
call them after these lines.

Cheers,

Richard

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universit├Ąt Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 





Mime
View raw message