Hi Avanish,

Thanks for sending the code snippet.  Since it is straight out of the Uima 2.7 
reference for jsoncasserializer 
https://uima.apache.org/d/uimaj-2.7.0/references.html#ugr.ref.json.usage
you should definitely expect your code to work.

Assuming that I am correctly following the code, 

The initial call in JsonCasSerializer that claims to start the problem:
http://svn.apache.org/viewvc/uima/uimaj/tags/uimaj-2.9.0/uimaj-json/src/main/java/org/apache/uima/json/JsonCasSerializer.java?view=markup#l835

The call is to TypeImpl.getSuperType();
http://svn.apache.org/viewvc/uima/uimaj/tags/uimaj-2.9.0/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java?view=markup#l74

That method just returns a value from two methods in TypeSystemImpl:
            return 
this.ts.ll_getTypeForCode(this.ts.ll_getParentType(this.code));

The code for the nested call to method ll_getParentType(this.code) in 
TypeSystemImpl:
http://svn.apache.org/viewvc/uima/uimaj/tags/uimaj-2.9.0/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?view=markup#l520

And the code for the outer call to method ll_getTypeForCode( int ) in 
TypeSystemImpl:
http://svn.apache.org/viewvc/uima/uimaj/tags/uimaj-2.9.0/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?view=markup#l1439

All of the required methods appear to be present, so I don't know why java is 
throwing that exception.

At any rate, this is all uima code, not ctakes.  So I suggest that you post it 
on one of the uima mailing lists.  Somebody there may have an answer.
https://uima.apache.org/mail-lists.html

Sean

-----Original Message-----
From: Kumar, Avanish [mailto:avanish.ku...@optum.com] 
Sent: Wednesday, June 07, 2017 1:33 AM
To: dev@ctakes.apache.org
Subject: RE: jcas to json error

Hi Sean,

The code was:

                                          JsonCasSerializer jcs = new 
JsonCasSerializer();
                        jcs.setPrettyPrint(true); // do some configuration
                        StringWriter sw = new StringWriter();                   
       
                        jcs.serialize(jcas.getCas(), sw); // serialize into sw

and the error was:

Exception in thread "main" java.lang.NoSuchMethodError: 
org.apache.uima.cas.impl.TypeImpl.getSuperType()Lorg/apache/uima/cas/impl/TypeImpl;
        at 
org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.collectUsedSubtypes(JsonCasSerializer.java:842)
        at 
org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.serializeJsonLdContext(JsonCasSerializer.java:731)
        at 
org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.writeFeatureStructures(JsonCasSerializer.java:545)
        at 
org.apache.uima.cas.impl.CasSerializerSupport$CasDocSerializer.serialize(CasSerializerSupport.java:439)
        at 
org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:337)
        at 
org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:318)
        at 
org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:308)
        at Main.result(Main.java:62)
        at Main.main(Main.java:96)

-----Original Message-----
From: Finan, Sean [mailto:sean.fi...@childrens.harvard.edu]
Sent: Tuesday, June 06, 2017 8:37 PM
To: dev@ctakes.apache.org
Subject: RE: jcas to json error

Hi Avanish,

I think that Apache email services do not allow markups, embedded images or 
attachments.  Your images didn't come through for me.  Can you paste the code 
as text?  If it is online somewhere public (e.g. github) you can add a link to 
the repository for people to inspect.

Thanks,
Sean

From: Kumar, Avanish [mailto:avanish.ku...@optum.com]
Sent: Tuesday, June 06, 2017 10:24 AM
To: dev@ctakes.apache.org
Subject: jcas to json error

Hi,
I am trying to get the output in Json. I tried it by doing it like this:
But got errors. Can anyone please tell me what is wrong with this code.
[cid:image002.png@01D2DEFE.94FB1CB0]
[cid:image001.png@01D2DEFE.73B1D760]

This e-mail, including attachments, may include confidential and/or proprietary 
information, and may be used only by the person or entity to which it is 
addressed. If the reader of this e-mail is not the intended recipient or his or 
her authorized agent, the reader is hereby notified that any dissemination, 
distribution or copying of this e-mail is prohibited. If you have received this 
e-mail in error, please notify the sender by replying to this message and 
delete this e-mail immediately.

This e-mail, including attachments, may include confidential and/or proprietary 
information, and may be used only by the person or entity to which it is 
addressed. If the reader of this e-mail is not the intended recipient or his or 
her authorized agent, the reader is hereby notified that any dissemination, 
distribution or copying of this e-mail is prohibited. If you have received this 
e-mail in error, please notify the sender by replying to this message and 
delete this e-mail immediately.

Reply via email to