Dear Richard:

I am attaching a patch with a series of selectIntersects and indexIntersects methods. There's more signatures than the corresponding selectCovered/Covering methods, as "intersects" could include covering annotations or not. If they are excluded, the methods use the same approach you used in selecCovered, advancing the iterator. Otherwise, they defer to the int interval method used in selectCovering.

Maybe this is useful to someone else besides myself?

Also, I have no experience with unit testing, so I didn't even try adding to add tests for the new methods. I did some naive testing by hand, and it seems to work... but I'm particularly bad with interval operations, so I wouldn't be surprised if I made some egregious error. My apologies in advance.

Best,
jta


On Mon Jan 26 2015 at 3:19:37 PM José Tomás Atria <jtatria@gmail.com> wrote:
Cool, I'll look into ti and let you know if I manage to make something useful. Thanks for the tips.

On Sun Jan 25 2015 at 12:47:52 PM Richard Eckart de Castilho <rec@apache.org> wrote:
Hi José,

we had no need for such a method so far ;) The easiest way would probably be to copy the
selectCovering method from uimaFIT and adjust it to catch all intersecting annotations.
You can probably add an optimization to a selectIntersecting method which breaks the loop as soon as the begin offset of an annotation is larger than the end offset of your intersection range.

Cheers,

-- Richard

On 24.01.2015, at 22:25, José Tomás Atria <jtatria@gmail.com> wrote:

> Hello all,
>
> I am looking for the best approach to select all annotations of a given
> type that intersect an annotation of a different type.
>
> I am aware of selectCovered and selectCovering, which, as far as I
> understand, will select all annotations (of a given type) that cover ranges
> of text which are, respectively, subsets or supersets of another
> annotation. Is there a similar method for annotations that cover ranges
> which merely _intersect_ with the range covered by a given annotation?
>
> What would the recommended way of achieving this?
>
> Any help would be apreciated. Thanks!
> jta.
>
> --
> entia non sunt multiplicanda praeter necessitatem