You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (Jira)" <de...@uima.apache.org> on 2020/10/06 17:31:00 UTC

[jira] [Commented] (UIMA-6269) select.coveredBy with includeAnnotationsWithEndBeyondBounds has broken edge case

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

Richard Eckart de Castilho commented on UIMA-6269:
--------------------------------------------------

The select operation internally creates bounding annotation at (0,1). It then creates an FSIterator as part of the select and moves it to the location of the bounding annotation. According to the definition of the annotation index (sort by start asc, by end desc), the position (0,1) is greater than the annotation of the last (only) annotation in the index, namely (0,2). This causes the FSIterator to return invalid due to the following documented behavior:

{quote}
If the fs is greater than all of the entries in the index, the moveTo cannot set the iterator to an insertion point
where the current feature structure is greater than fs, so it marks the iterator "invalid".
{quote}

The case of the invalid iterator is not handled by the coveredBy logic. 

I guess what should happen in the case the the iterator is invalid is, that it should be seeking back from the index end to the first position where the annotation begin is equal to the selection range begin.

> select.coveredBy with includeAnnotationsWithEndBeyondBounds has broken edge case
> --------------------------------------------------------------------------------
>
>                 Key: UIMA-6269
>                 URL: https://issues.apache.org/jira/browse/UIMA-6269
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 3.1.1SDK
>            Reporter: Richard Eckart de Castilho
>            Assignee: Richard Eckart de Castilho
>            Priority: Major
>             Fix For: 3.2.0SDK
>
>
> coveredBy should find any annotations starting in the selection range and optionally including those which do not end in the selection range. There is an edge case where this does not work if the begin of the selection range is equal to the begin of an annotation that extends beyond the end of the selection range. The following test fails:
> {noformat}
> AnnotationFS annotation = cas.createAnnotation(cas.getAnnotationType(), 0, 2);
>     cas.addFsToIndexes(annotation);
>     List<AnnotationFS> result = cas.select(Annotation.class)
>         .coveredBy(0, 1)
>         .includeAnnotationsWithEndBeyondBounds()
>         .collect(toList());
>     assertThat(result)
>         .as("Selection (0-1) including start position (0) but not end position (2)")
>         .containsExactly(annotation);
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)