XCASParsingException while trying to deserialize xmi into CAS object

喜欢而已 提交于 2020-01-05 04:07:09

问题


I have made Ruta scripts run from Java and have converted the resulting CAS object into an xmi file as below;

FileOutputStream fileOutputStream = new FileOutputStream(outputXmiFile);
XmiCasSerializer.serialize(cas, fileOutputStream);

When I try to convert it back into a CAS object (on another server), as below;

FileInputStream fileInputStream = new FileInputStream(xmiFile);
XmlCasDeserializer.deserialize(fileInputStream, cas);

I get the below exception;

XCASParsingException: Error parsing XCAS or XMI-CAS from source <unknown> at line <unknown>, column <unknown>: unknown type: NULL.

A snapshot of the exception.


回答1:


Ya Thanks ! It worked !

import org.apache.uima.util.CasIOUtils;

CAS to XMI

CasIOUtils.save(cas, fileOutputStream, SerialFormat.XMI);

XMI to CAS

CasIOUtils.load(fileInputStream, cas);


来源:https://stackoverflow.com/questions/47653768/xcasparsingexception-while-trying-to-deserialize-xmi-into-cas-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!