Hi Timo,
the order relation of the feature structures is defined by the index
definition. Have a look at the index definition of the (built-in)
annotation index. You can if you open any annotator descriptor using the
component editor in eclipse. This helped me a lot in understanding the
behaviour of the iterators.
To put it short, if two annotations of the same type have exactly the
same boundaries, the behaviour is indeed unspecified. However, you can
avoid this indeterminism, by adding a second type and assigning it a
higher priority. If you don't need a second type, you can use it as a
helper, shifting an instance across the CAS as needed ;) - at least, I
don't know of any more elegant method.
-- Hope this helps
Matthias
Timo Boehme schrieb:
Hi,
in my scenario there may be multiple annotations of same type for the
same region. Before I add an annotation I would like to check if such an
annotation already exists.
To accomplish this I use FSIndex.iterator( newAnnotation ) to get an
iterator which starts at the position of my new (but not added)
annotation. According to the method description the iterator should be
positioned so that previous annotations are less compared to newAnnotation.
However sometimes if I call moveToPrevious() (directly after iterator
creation) I will get (with get()) an annotation (of same type) with same
region as newAnnotation - which in my opinion is not less.
Thus I would like to know if annotations of same type for same region
will trigger some 'unspecified' behavior or if my understanding of the
iterator is wrong or if I stumbled upon a bug?
Kind regards
Timo