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

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

Similar tests using preceding instead of following work:

{code}
  @Test
  public void 
thatSelectPrecedingDoesNotFindOtherZeroWidthAnnotationAtSameLocation()
  {
    Annotation a1 = cas.createAnnotation(cas.getAnnotationType(), 10, 10);
    Annotation a2 = cas.createAnnotation(cas.getAnnotationType(), 10, 10);
    
    asList(a1, a2).forEach(cas::addFsToIndexes);
    
    List<Annotation> selection = cas.select(Annotation.class)
        .preceding(a2)
        .asList();
    
    assertThat(selection)
            .isEmpty();
  }

  @Test
  public void thatSelectPrecedingDoesNotFindOtherAnnotationAtSameLocation()
  {
    Annotation a1 = cas.createAnnotation(cas.getAnnotationType(), 10, 20);
    Annotation a2 = cas.createAnnotation(cas.getAnnotationType(), 10, 20);
    
    asList(a1, a2).forEach(cas::addFsToIndexes);
    
    List<Annotation> selection = cas.select(Annotation.class)
        .preceding(a2)
        .asList();
    
    assertThat(selection)
            .isEmpty();
  }
{code}

> select.following() on a zero-width annotation returns other zero-width 
> annotation at same location
> --------------------------------------------------------------------------------------------------
>
>                 Key: UIMA-6285
>                 URL: https://issues.apache.org/jira/browse/UIMA-6285
>             Project: UIMA
>          Issue Type: New Feature
>    Affects Versions: 3.1.1SDK
>            Reporter: Richard Eckart de Castilho
>            Assignee: Richard Eckart de Castilho
>            Priority: Major
>             Fix For: 3.2.0SDK
>
>
> select.following() on a zero-width annotation returns other zero-width 
> annotation at same location. The following test fails:
> {code}
>   @Test
>   public void 
> thatSelectFollowingDoesNotFindOtherZeroWidthAnnotationAtSameLocation()
>   {
>     Annotation a1 = cas.createAnnotation(cas.getAnnotationType(), 10, 10);
>     Annotation a2 = cas.createAnnotation(cas.getAnnotationType(), 10, 10);
>     
>     asList(a1, a2).forEach(cas::addFsToIndexes);
>     
>     List<Annotation> selection = cas.select(Annotation.class)
>         .following(a1)
>         .asList();
>     
>     assertThat(selection)
>             .isEmpty();
>   }
> {code}
> In this case, {{a2}} should not be considered as "following" {{a1}} - it is 
> not following, it is at the very same location.
> Strictly speaking, the code does what the documentation of following says:
> {quote}
> For AnnotationIndex, position to first Annotation whose {{begin <= 
> fs.getEnd()}};
> {quote}
> In this case, {{a2.getBegin() == fs.getEnd()}}. However, I believe it is an 
> edge-case that was not considered when the documentation was written and the 
> intended behavior should be that annotations that are at exactly the same 
> position should never be considered to be following or preceding each other.



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

Reply via email to