You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Marshall Schor <ms...@schor.com> on 2018/01/18 19:06:58 UTC

Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Got to the point where I'm getting a JCas feature offset incompatibility -
starting debug...

-Marshall

Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Marshall Schor <ms...@schor.com>.
There's always a non-official way, dependent on the version (that can change). 
See the Sofa.class method setLocalSofaData.

It, in turn, calls a method which checks if it's been set (and if so, throws).

But you "could" just call the method it would have called... 
(   _setStringValueNcWj(wrapGetIntCatchException(_FH_sofaString), aString);   )

The DocumentAnnotation singleton needs to be updated as a side effect (the end
value changes if the sofa length changes).

We could make some kind of official thing here, if it is warranted.

-Marshall


On 1/18/2018 4:52 PM, Richard Eckart de Castilho wrote:
> On 18.01.2018, at 20:06, Marshall Schor <ms...@schor.com> wrote:
>> Got to the point where I'm getting a JCas feature offset incompatibility -
>> starting debug...
> Great :)
>
> Meanwhile, I'm working off the things you found...
>
> Btw. trying to run the WebAnno UIMAv3 build from the command line, I
> found that the tests of the WebAnno remote API fail now. The reason
> seems to be that you blocked a sneaky little way that I used to change
> the SOFA string even after the CAS has been locked down:
>
> org.apache.uima.cas.CASRuntimeException: Can''t use standard set methods with SofaFS features.
> 	at org.apache.uima.jcas.cas.Sofa.setStringValue(Sofa.java:267) ~[classes/:na]
> 	at org.apache.uima.cas.impl.CASImpl.ll_setStringValue(CASImpl.java:3291) ~[classes/:na]
> 	at de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.forceSetFeatureValue(RemoteApiController2.java:1066) ~[classes/:na]
> 	at de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.createCompatibleCas(RemoteApiController2.java:1003) ~[classes/:na]
> 	at de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.annotationsCreate(RemoteApiController2.java:703) ~[classes/:na]
>
> The code triggering this is here (for your entertainment):
>
>         // Just in case we really had to chomp off a trailing line break from the annotation CAS,
>         // make sure we copy over the proper text from the initial CAS
>         // NOT AT HOME THIS YOU SHOULD TRY
>         // SETTING THE SOFA STRING FORCEFULLY FOLLOWING THE DARK SIDE IS!
>         forceSetFeatureValue(annotationCas.getSofa(), CAS.FEATURE_BASE_NAME_SOFASTRING,
>                 initialCas.getDocumentText());
>
> So Master Schor... you defeated me.
>
> I introduced this because it can happen that an annotation file uploaded through the
> remote API might have a trailing line break while the corresponding reference document 
> that is already in WebAnno does not (or vice versa) - and I am here trying to fix this
> situation to ensure that the sofa strings are equal.
>
> Assuming you had to do that, how would you patch the sofa string?
>
> Cheers,
>
> -- Richard 


Re: UIMAv3 & WebAnno - bugs in v3?

Posted by Marshall Schor <ms...@schor.com>.
yes, looks like a bug.  There is feature validation code, but it only checks if
the feature is appropriate for the type, not whether the feature's range is
appropriate for the caller.

Added Jira https://issues.apache.org/jira/browse/UIMA-5706

-Marshall


On 1/18/2018 5:22 PM, Richard Eckart de Castilho wrote:
> On 18.01.2018, at 22:52, Richard Eckart de Castilho <re...@apache.org> wrote:
>> On 18.01.2018, at 20:06, Marshall Schor <ms...@schor.com> wrote:
>>> Got to the point where I'm getting a JCas feature offset incompatibility -
>>> starting debug...
>> Meanwhile, I'm working off the things you found...
> It seems that UIMAv3 allows code such as this:
>
>   FeatureStructure fsVal = aFS.getFeatureValue(aFS.getType().getFeatureByBaseName(aFeatureName));
>
> where the aFeatureName is e.g. "end" (i.e. a non-FS feature). UIMAv3 seems to
> simply return null in this case.
>
> UIMAv2 had thrown an exception in this case.
>
> Bug?
>
> Cheers,
>
> -- Richard
>
>


Re: UIMAv3 & WebAnno - bugs in v3?

Posted by Richard Eckart de Castilho <re...@apache.org>.
On 18.01.2018, at 22:52, Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> On 18.01.2018, at 20:06, Marshall Schor <ms...@schor.com> wrote:
>> 
>> Got to the point where I'm getting a JCas feature offset incompatibility -
>> starting debug...
> 
> Meanwhile, I'm working off the things you found...

It seems that UIMAv3 allows code such as this:

  FeatureStructure fsVal = aFS.getFeatureValue(aFS.getType().getFeatureByBaseName(aFeatureName));

where the aFeatureName is e.g. "end" (i.e. a non-FS feature). UIMAv3 seems to
simply return null in this case.

UIMAv2 had thrown an exception in this case.

Bug?

Cheers,

-- Richard


Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Richard Eckart de Castilho <re...@apache.org>.
On 18.01.2018, at 20:06, Marshall Schor <ms...@schor.com> wrote:
> 
> Got to the point where I'm getting a JCas feature offset incompatibility -
> starting debug...

Great :)

Meanwhile, I'm working off the things you found...

Btw. trying to run the WebAnno UIMAv3 build from the command line, I
found that the tests of the WebAnno remote API fail now. The reason
seems to be that you blocked a sneaky little way that I used to change
the SOFA string even after the CAS has been locked down:

org.apache.uima.cas.CASRuntimeException: Can''t use standard set methods with SofaFS features.
	at org.apache.uima.jcas.cas.Sofa.setStringValue(Sofa.java:267) ~[classes/:na]
	at org.apache.uima.cas.impl.CASImpl.ll_setStringValue(CASImpl.java:3291) ~[classes/:na]
	at de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.forceSetFeatureValue(RemoteApiController2.java:1066) ~[classes/:na]
	at de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.createCompatibleCas(RemoteApiController2.java:1003) ~[classes/:na]
	at de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.annotationsCreate(RemoteApiController2.java:703) ~[classes/:na]

The code triggering this is here (for your entertainment):

        // Just in case we really had to chomp off a trailing line break from the annotation CAS,
        // make sure we copy over the proper text from the initial CAS
        // NOT AT HOME THIS YOU SHOULD TRY
        // SETTING THE SOFA STRING FORCEFULLY FOLLOWING THE DARK SIDE IS!
        forceSetFeatureValue(annotationCas.getSofa(), CAS.FEATURE_BASE_NAME_SOFASTRING,
                initialCas.getDocumentText());

So Master Schor... you defeated me.

I introduced this because it can happen that an annotation file uploaded through the
remote API might have a trailing line break while the corresponding reference document 
that is already in WebAnno does not (or vice versa) - and I am here trying to fix this
situation to ensure that the sofa strings are equal.

Assuming you had to do that, how would you patch the sofa string?

Cheers,

-- Richard 

Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Marshall Schor <ms...@schor.com>.
strike that - I put in https://issues.apache.org/jira/browse/UIMA-5708
to fix this.

-Marshall


On 1/24/2018 5:23 PM, Marshall Schor wrote:
> I think this already happens (except for this one unusual case).
>
> I'm probably not going to fix the unusual case due to other priorities... :-) )
>
> -Marshall
>
>
> On 1/24/2018 1:25 PM, Richard Eckart de Castilho wrote:
>> On 23.01.2018, at 03:48, Marshall Schor <ms...@schor.com> wrote:
>>> I'm going to try to do that, but it's taking a very long time to download the
>>> dkpro uima-v3 project...
>> Would it be a good idea to add a version information to generated JCas
>> classes and have UIMA check that and generate an error? Similar as when
>> a JVM tried loading a class file it is not compatible with.
>>
>> Cheers,
>>
>> -- Richard
>


Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Marshall Schor <ms...@schor.com>.
I think this already happens (except for this one unusual case).

I'm probably not going to fix the unusual case due to other priorities... :-) )

-Marshall


On 1/24/2018 1:25 PM, Richard Eckart de Castilho wrote:
> On 23.01.2018, at 03:48, Marshall Schor <ms...@schor.com> wrote:
>> I'm going to try to do that, but it's taking a very long time to download the
>> dkpro uima-v3 project...
> Would it be a good idea to add a version information to generated JCas
> classes and have UIMA check that and generate an error? Similar as when
> a JVM tried loading a class file it is not compatible with.
>
> Cheers,
>
> -- Richard


Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Richard Eckart de Castilho <re...@apache.org>.
On 23.01.2018, at 03:48, Marshall Schor <ms...@schor.com> wrote:
> 
> I'm going to try to do that, but it's taking a very long time to download the
> dkpro uima-v3 project...

Would it be a good idea to add a version information to generated JCas
classes and have UIMA check that and generate an error? Similar as when
a JVM tried loading a class file it is not compatible with.

Cheers,

-- Richard

Re: UIMAv3 & WebAnno - success !

Posted by Marshall Schor <ms...@schor.com>.
thanks for providing nice testing scenarios, and carrying out the tests!

-Marshall


On 2/4/2018 3:23 PM, Richard Eckart de Castilho wrote:
> On 24.01.2018, at 19:26, Richard Eckart de Castilho <re...@apache.org> wrote:
>> On 23.01.2018, at 04:33, Marshall Schor <ms...@schor.com> wrote:
>>> I manually updated the DocumentMetaData.java JCas class to the current style,
>>> and now, I can load a document in the Annotation view, without errors :-).
>>>
>>> I'll commit these changes tomorrow.
>> Cool! Looking forward to trying this out!
> I finally got to trying out the latest UIMA v3 SNAPSHOT (i.e. 1 commit beyond
> the latest RC) with WebAnno. Seems it works nicely now.
>
> I tried adding and deleting various annotations with no error - so it looks
> like the UIMAv3 CasCompleteSerializer now also has nicely stable IDs!
>
> Great job!
>
> Thanks for taking into account this use-case!
>
> Best,
>
> -- Richard


Re: UIMAv3 & WebAnno - success !

Posted by Richard Eckart de Castilho <re...@apache.org>.
On 24.01.2018, at 19:26, Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> On 23.01.2018, at 04:33, Marshall Schor <ms...@schor.com> wrote:
>> 
>> I manually updated the DocumentMetaData.java JCas class to the current style,
>> and now, I can load a document in the Annotation view, without errors :-).
>> 
>> I'll commit these changes tomorrow.
> 
> Cool! Looking forward to trying this out!

I finally got to trying out the latest UIMA v3 SNAPSHOT (i.e. 1 commit beyond
the latest RC) with WebAnno. Seems it works nicely now.

I tried adding and deleting various annotations with no error - so it looks
like the UIMAv3 CasCompleteSerializer now also has nicely stable IDs!

Great job!

Thanks for taking into account this use-case!

Best,

-- Richard

Re: UIMAv3 & WebAnno - success !

Posted by Richard Eckart de Castilho <re...@apache.org>.
On 24.01.2018, at 19:26, Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> On 23.01.2018, at 04:33, Marshall Schor <ms...@schor.com> wrote:
>> 
>> I manually updated the DocumentMetaData.java JCas class to the current style,
>> and now, I can load a document in the Annotation view, without errors :-).
>> 
>> I'll commit these changes tomorrow.
> 
> Cool! Looking forward to trying this out!

Just wanted to let you know that I am tryout out the latest UIMAv3 SNAPSHOT.
Looks like I have to regenerate additional DKPro Core classes to be compatible
with the post-alpha code.

I'll post updates when I get ahead.

Cheers,

-- Richard

Re: UIMAv3 & WebAnno - success !

Posted by Richard Eckart de Castilho <re...@apache.org>.
On 23.01.2018, at 04:33, Marshall Schor <ms...@schor.com> wrote:
> 
> I manually updated the DocumentMetaData.java JCas class to the current style,
> and now, I can load a document in the Annotation view, without errors :-).
> 
> I'll commit these changes tomorrow.

Cool! Looking forward to trying this out!

-- Richard

Re: UIMAv3 & WebAnno - success !

Posted by Marshall Schor <ms...@schor.com>.
I manually updated the DocumentMetaData.java JCas class to the current style,
and now, I can load a document in the Annotation view, without errors :-).

I'll commit these changes tomorrow.

-Marshall

On 1/22/2018 9:48 PM, Marshall Schor wrote:
> This bug was due to a wrong design - actually adding JCas implied features into
> the type system. This breaks various "binary" serialization/deserialization
> schemes, which require an exact match between the type system and the serialized
> form.
>
> This is now fixed.
>
> The next problem is a housekeeping one:  The DKPro being used as a uima v3 alpha
> version of the JCas class for DocumentMetaData.
>
> This needs regenerating for the current design.
>
> I'm going to try to do that, but it's taking a very long time to download the
> dkpro uima-v3 project...
>
> -Marshall
>
>
> On 1/18/2018 5:47 PM, Marshall Schor wrote:
>> found an incredibly stupid bug in the code that was supposed to add the extra
>> JCas supplied features.
>>
>> Guess a better test case is needed!.
>>
>> After fixing that, the next bug is a cas complete deserialization issue...
>>
>> investigating...
>>
>> -Marshall
>>
>>
>> On 1/18/2018 2:06 PM, Marshall Schor wrote:
>>> Got to the point where I'm getting a JCas feature offset incompatibility -
>>> starting debug...
>>>
>>> -Marshall
>>>
>


Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Marshall Schor <ms...@schor.com>.
This bug was due to a wrong design - actually adding JCas implied features into
the type system. This breaks various "binary" serialization/deserialization
schemes, which require an exact match between the type system and the serialized
form.

This is now fixed.

The next problem is a housekeeping one:  The DKPro being used as a uima v3 alpha
version of the JCas class for DocumentMetaData.

This needs regenerating for the current design.

I'm going to try to do that, but it's taking a very long time to download the
dkpro uima-v3 project...

-Marshall


On 1/18/2018 5:47 PM, Marshall Schor wrote:
> found an incredibly stupid bug in the code that was supposed to add the extra
> JCas supplied features.
>
> Guess a better test case is needed!.
>
> After fixing that, the next bug is a cas complete deserialization issue...
>
> investigating...
>
> -Marshall
>
>
> On 1/18/2018 2:06 PM, Marshall Schor wrote:
>> Got to the point where I'm getting a JCas feature offset incompatibility -
>> starting debug...
>>
>> -Marshall
>>
>


Re: UIMAv3 & WebAnno - back to debugging JCas feature setup

Posted by Marshall Schor <ms...@schor.com>.
found an incredibly stupid bug in the code that was supposed to add the extra
JCas supplied features.

Guess a better test case is needed!.

After fixing that, the next bug is a cas complete deserialization issue...

investigating...

-Marshall


On 1/18/2018 2:06 PM, Marshall Schor wrote:
> Got to the point where I'm getting a JCas feature offset incompatibility -
> starting debug...
>
> -Marshall
>