简体   繁体   English

如何结合Java序列化对UIMA CAS进行序列化

[英]How to serialize UIMA CAS combined with Java Serialization

I have these classes: 我有这些课:

class DocumentObj implements Serializable {
    ...
    List<SentenceObj> sentenceObjs;
    JCas docJcas;
}
class SentenceObj implements Serializable {
    ...
    annotation.Sentence sentenceAnnotation;
}

I would like to dump each DocumentObj as a file on disk, using the default Java serialization. 我想使用默认的Java序列化将每个DocumentObj转储为磁盘上的文件。 Later they would also be deserialized back into the Java objects. 以后,它们也将反序列化回Java对象。 I understand I would need some special treatment for the JCases and the Sentence Annotations as they are not serializable (now I get NotSerializableException ). 我知道我需要对JCases和Sentence Annotations进行一些特殊处理,因为它们无法序列化(现在我得到NotSerializableException )。 Hopefully the treatment could be as minimal as possible. 希望治疗可以尽可能少。

How do you suggest to do this, regarding serialization of JCas and combining it with Java serialization? 关于JCas的序列化并将其与Java序列化相结合,您如何建议这样做?

I am working on Windows, with Java 1.6 and UIMA 2.4.0. 我正在使用Java 1.6和UIMA 2.4.0的Windows上工作。 I am using the same type system and the same 3 views for all JCases and annotations. 我对所有JCases和注释使用相同的类型系统和相同的3个视图。

Don't use default Java serialization. 不要使用默认的Java序列化。 Use instead the org.apache.uima.cas.impl.Serialization utilities, or even better the BinaryCasWriter from DK-pro. 改用org.apache.uima.cas.impl.Serialization实用程序,或者甚至更好地使用DK-pro的BinaryCasWriter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM