You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Mario Juric <mj...@unsilo.ai> on 2017/11/01 16:02:33 UTC

uimaFit JCasUtil.selectAt meaning

Hi,

I was wondering what exactly the semantics of JCasUtil.selectAt is supposed to be after looking into the implementation, since the JavaDoc isn’t very precise. I initially thought that it would select annotations of the given type with the exact begin and end, but this is not the case when inspecting the implementation. The problem is in CasUtil.selectAt with the following while loop:

while (it.isValid()) {
  AnnotationFS a = it.get();
  // If the offsets do not match the specified offets, we're done
  if (a.getBegin() != aBegin && a.getEnd() != aEnd) {
    break;
  }
  it.moveToNext();
  list.add(a);
}

I would have expected that either begin or end must be different to drop the item, i.e. "if (a.getBegin() != aBegin || a.getEnd() != aEnd)" instead. This is obviously not the case, and it does not have the same behaviour like selectCovered either, so what is the intend if it’s not a bug?

Best,
Mario













Re: uimaFit JCasUtil.selectAt meaning

Posted by Mario Juric <mj...@unsilo.ai>.
Done.

https://issues.apache.org/jira/browse/UIMA-5637

Best
Mario












> On 2 Nov 2017, at 16:24 , Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> Dear Mario,
> 
> you are right - that appears to be a bug. Could you just copy/paste your analysis into a Jira issue please?
> 
>  https://issues.apache.org/jira/
> 
> Best,
> 
> -- Richard
> 
>> On 01.11.2017, at 18:02, Mario Juric <mj...@unsilo.ai> wrote:
>> 
>> Hi,
>> 
>> I was wondering what exactly the semantics of JCasUtil.selectAt is supposed to be after looking into the implementation, since the JavaDoc isn’t very precise. I initially thought that it would select annotations of the given type with the exact begin and end, but this is not the case when inspecting the implementation. The problem is in CasUtil.selectAt with the following while loop:
>> 
>> while (it.isValid()) {
>> AnnotationFS a = it.get();
>> // If the offsets do not match the specified offets, we're done
>> if (a.getBegin() != aBegin && a.getEnd() != aEnd) {
>>   break;
>> }
>> it.moveToNext();
>> list.add(a);
>> }
>> 
>> I would have expected that either begin or end must be different to drop the item, i.e. "if (a.getBegin() != aBegin || a.getEnd() != aEnd)" instead. This is obviously not the case, and it does not have the same behaviour like selectCovered either, so what is the intend if it’s not a bug?
>> 
>> Best,
>> Mario
> 


Re: uimaFit JCasUtil.selectAt meaning

Posted by Richard Eckart de Castilho <re...@apache.org>.
Dear Mario,

you are right - that appears to be a bug. Could you just copy/paste your analysis into a Jira issue please?

  https://issues.apache.org/jira/

Best,

-- Richard

> On 01.11.2017, at 18:02, Mario Juric <mj...@unsilo.ai> wrote:
> 
> Hi,
> 
> I was wondering what exactly the semantics of JCasUtil.selectAt is supposed to be after looking into the implementation, since the JavaDoc isn’t very precise. I initially thought that it would select annotations of the given type with the exact begin and end, but this is not the case when inspecting the implementation. The problem is in CasUtil.selectAt with the following while loop:
> 
> while (it.isValid()) {
>  AnnotationFS a = it.get();
>  // If the offsets do not match the specified offets, we're done
>  if (a.getBegin() != aBegin && a.getEnd() != aEnd) {
>    break;
>  }
>  it.moveToNext();
>  list.add(a);
> }
> 
> I would have expected that either begin or end must be different to drop the item, i.e. "if (a.getBegin() != aBegin || a.getEnd() != aEnd)" instead. This is obviously not the case, and it does not have the same behaviour like selectCovered either, so what is the intend if it’s not a bug?
> 
> Best,
> Mario