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

Thomas G. commented on UIMA-2808:
---------------------------------

Hi, i don't know exactly how to use AnnotationIndex.subiterator directly.

With 

CAS cas = sa.getCAS();
Iterator<ValueAnnotation> it3 = ((AnnotationIndex<ValueAnnotation>) 
cas.getAnnotationIndex(CasUtil.getType(cas, 
ValueAnnotation.class))).subiterator(sa, false, false);

i get a compilation error:
Compilation failure
com/test/jcasutilsubiteratoruimatest/Annotator.java:[70,93] inconvertible types
found   : 
org.apache.uima.cas.text.AnnotationIndex<org.apache.uima.cas.text.AnnotationFS>
required: 
org.apache.uima.cas.text.AnnotationIndex<com.test.generatedTypes.ValueAnnotation>
                
> JCasUtil Subiterator returns annotations which are not within borders of the 
> container (parent) annotation if parameter "strict" is set to "false"
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: UIMA-2808
>                 URL: https://issues.apache.org/jira/browse/UIMA-2808
>             Project: UIMA
>          Issue Type: Bug
>            Reporter: Thomas G.
>         Attachments: JCasUtilSubiteratorUIMATest.zip
>
>
> * JCasUtil Subiterator returns annotations which are not within the border of 
> the container (parent) annotation if parameter "strict" is set to "false"
> * See attached maven project for test setup, java classes, a SIMPLIFIED 
> typesystem and the test CAS xml-file.
> * We have two annotations, "SentenceAnnotation" and "ValueAnnotation". A 
> "SentenceAnnotation" covers a sentence and the "ValueAnnotation" covers a 
> numerical value. 
> * We have the following example plank text:
> ** "This is sentence A with no value. This is sentence B with value 377."
> ** Creates two sentence annotations ("This is sentence A with no value." and 
> "This is sentence B with value 377.") and one value annotation ("377").
> ** Now, if i want to get all "ValueAnnotation" within a "SentenceAnnotation", 
> i iterate over each "SentenceAnnotation" and use JCasUtil.iterator(...) to 
> get the ValueAnnotations with the following parameters: 
> JCasUtil.iterator(currentSentence, ValueAnnotation.class, false, false);
> ** As a result, i get for the first sentence also the value of the second 
> sentence and this might be wrong because even if "strict" is set to "false", 
> the  begin of the "ValueAnnotation" should be smaller than the end of the 
> "SentenceAnnnotation". But in the example given the begin of the 
> "ValueAnnotation" is after the end of the FIRST "SentenceAnnotation"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to