Also, at least with the issue Im seeing on my end. When using new 
Annotation(jcas,begin,end) the uima.tcas.Annotation is missing from the 
registered types List . The typeIndexId is 21.. The list below is from my 
eclipse variables inside TypeSystemImpl.getJCasRegisteredType. However the 
annotType variable is set correctly
jcasRegisteredTypes             
        [0...99]                
                [0]     uima.cas.TOP    
                [1]     uima.cas.AnnotationBase 
                [2]     uima.cas.FSArray        
                [3]     uima.cas.FloatArray     
                [4]     uima.cas.IntegerArray   
                [5]     uima.cas.StringArray    
                [6]     uima.cas.BooleanArray   
                [7]     uima.cas.ByteArray      
                [8]     uima.cas.ShortArray     
                [9]     uima.cas.LongArray      
                [10]    uima.cas.DoubleArray    
                [11]    uima.cas.EmptyFSList    
                [12]    uima.cas.NonEmptyFSList 
                [13]    uima.cas.EmptyFloatList 
                [14]    uima.cas.NonEmptyFloatList      
                [15]    uima.cas.EmptyIntegerList       
                [16]    uima.cas.NonEmptyIntegerList    
                [17]    uima.cas.EmptyStringList        
                [18]    uima.cas.NonEmptyStringList     
                [19]    uima.cas.Sofa   
                [20]    uima.tcas.DocumentAnnotation    
                [21]    null    
                [22]    org.apache.ctakes.typesystem.type.textspan.Sentence     
                [23]    
org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation  



        

Daniel Cosio
[email protected]



> On Apr 12, 2022, at 2:39 AM, Richard Eckart de Castilho <[email protected]> 
> wrote:
> 
> Hi Daniel,
> 
>> On 11. Apr 2022, at 23:08, Daniel Cosio <[email protected]> wrote:
>> 
>> I have been using UIMA 2.x and other thanks settling up my type system, I 
>> have some code where I create an Annotation (ie: new 
>> Annotation(jcas,begin,end) ).. 
>> 
>> With 3.2.0 I was getting an exception when instantiating the annotation with 
>> JCas type "org.apache.uima.jcas.tcas.Annotation" used in Java code,  but was 
>> not declared in the XML type descriptor.
>> 
>> I found I could use AnnotaitonFactory.createAnnotation to get around this in 
>> my code..
> 
> Actually, creating new annotations via `new Annotation(jcas, begin, end)` or 
> in general `new ANYANNOTATIONTYPE(jcas, begin, end)` should also work in 
> UIMAv3. For the built-in types like 
> `org.apache.uima.jcas.tcas.Annotation`, it should work immediately while for 
> custom-types, you'd have to build the JCas classes again for UIMAv3 using 
> jcasgen v3.
> 
> I just tried it and this works just nicely:
> 
> ----
>  @Test
>  public void blah() throws Exception {
>    JCas jcas = CasCreationUtils.createCas().getJCas();
>    Annotation ann = new Annotation(jcas, 0, 1);
>    ann.addToIndexes();
>  }
> ----
> 
>> But, I also have third-party code(cleartk) that also instantiates using new 
>> Annotation(JCas,begin,end) that I cannot
>> Modify.. If there something else I can do to get around this issue and allow 
>> using new Annotation(jcas,begin,end)
> 
> I believe ClearTK has never been updated to UIMAv3. It would need to be 
> updated before it can be used. In particular,
> the JCas classes used by ClearTK need to be re-generated. Other than that, I 
> would not expect a significant amount
> of code changes that would need to be done.
> 
> Best,
> 
> -- Richard

Reply via email to