Hi, in DKPro Core, we solve this by being careful ;) Our DocumentMetaData inherits from DocumentAnnotation
Mainly we create our own DKPro DocumentMetaData explicitly in the CAS *before* calling setDocumentText or setDocumentLanguage (which implicitly creates the UIMA DocumentAnnotation). Also, we added special methods to the DKPro DocumentMetaData that do not allow more than one instance in the CAS: DocumentMetaData meta = DocumentMetaData.create(jcas); DocumentMetaData.get(jcas); The create() method also takes care of copying over any data from an already existing DocumentAnnotation, deleting that and creating our DocumentMetaData annotation instead. For more examples see our test cases [1]. -- Richard [1] http://code.google.com/p/dkpro-core-asl/source/browse/de.tudarmstadt.ukp.dkpro.core-asl/trunk/de.tudarmstadt.ukp.dkpro.core.api.metadata/src/test/java/de/tudarmstadt/ukp/dkpro/core/api/metadata/type/DocumentMetaDataTest.java?r=450 Am 08.05.2013 um 14:17 schrieb Georg Fette <[email protected]>: > Hello, > I have a type system in which I have created a type which inherits from > DocumentAnnotation. As DocumentAnnotation is not inheritanceFinal I thought > that this is allowed. I have now a CAS in which I have several annotations of > that derived type. In the method copyFSInner of CasCopier the proper target > feature structure to copy instances of my type the first DocumentAnnotation > in the index of documentAnnotation of the target CAS. Is DocumentAnnotation > to be thought a singelton in a CAS ? Why isn't it prevented in the framework > to derive from it or to create further instances of that type and add it to > the CAS ? > If this is done the CasCopier can not be properly used. > Greetings > Georg > > -- > --------------------------------------------------------------------- > Dipl.-Inf. Georg Fette Raum: B009 > Universität Würzburg Tel.: +49-(0)931-31-85516 > Am Hubland Fax.: +49-(0)931-31-86732 > 97074 Würzburg mail: [email protected] > --------------------------------------------------------------------- >
