uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Schor (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-5601) uv3: CasCopier problems with custom subclasses of DocumentAnnotation
Date Tue, 03 Oct 2017 21:12:00 GMT

    [ https://issues.apache.org/jira/browse/UIMA-5601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16190359#comment-16190359

Marshall Schor commented on UIMA-5601:

Commenting on the comment "I think UIMA should continue..."

I think for the CAS Copier, it should not do the side effect which causes the creation of
the DocumentAnnotation (if it doesn't already exist).

A later cas copier copy of a documentAnnotation subtype could occur without any special handling...

I think this covers all of your cases, except that there's no exception thrown for a 2nd instance...
CAS Copy would no longer create any default documentAnnotation instances, so no need for special
replace code.

> uv3: CasCopier problems with custom subclasses of DocumentAnnotation
> --------------------------------------------------------------------
>                 Key: UIMA-5601
>                 URL: https://issues.apache.org/jira/browse/UIMA-5601
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 3.0.0SDK-beta
>            Reporter: Richard Eckart de Castilho
> It seems as if there may be a bug in the way that CasCopier handles the documen annotation.

> Specifically, it seems as if the CasCopier incorrectly handles the case where the target
CAS already contains a document annotation. In my case, I do:
> * create the target CAS
> * add a document annotation (DocumentMetaData extends DocumentAnnotation) to the target
> * create the CasCopier with the source and target CAS
> * copy several FSes but *not* the document annotation
> Expected:
> * target CAS contains 1 DocumentMetaData annotation
> Actual
> * target CAS contains 2 DocumentMetaData annotation
> Also, it seems that `isDocumentAnnotation` may not able to handle it if a CAS uses a
custom subclass of DocumentAnnotation:
> {noformat}
>   private <T extends FeatureStructure> boolean isDocumentAnnotation(T aFS) {
>     if (((TOP)aFS)._getTypeCode() != TypeSystemConstants.docTypeCode) {
>       return false;
>     }
>     if (srcCasDocumentAnnotation == null) {
>       srcCasDocumentAnnotation = srcCasViewImpl.getDocumentAnnotationNoCreate(); 
>     }
>     return aFS == srcCasDocumentAnnotation;
>   }
> {noformat}

This message was sent by Atlassian JIRA

View raw message