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