我正在使用WebAnno,并且我试图将我创建的压缩文件作为项目导入,但我一直收到错误,因为压缩无效。从WebAnno中导出项目会创建一个压缩文件,该文件在我重新导入时是有效的。但是,当我解压缩它,然后再重新压缩它时,它会稍有不同,并且不会被WebAnno识别为有效。我在源代码中找到了测试有效性的函数,但我不明白它到底在用zip文件测试什么。
public static boolean isZipValidWebanno(File aZipFile)
throws IOException
{
boolean isZipValidWebanno = false;
ZipFile zip = new ZipFile(aZipFile);
for (Enumeration zipEnumerate = zip.entries(); zipEnumerate.hasMoreElements();) {
ZipEntry entry = (ZipEntry) zipEnumerate.nextElement();
if (entry.toString().replace("/", "").startsWith(ImportUtil.EXPORTED_PROJECT)
&& entry.toString().replace("/", "").endsWith(".json")) {
isZipValidWebanno = true;
break;
}
}
return isZipValidWebanno;
}发布于 2019-06-22 06:24:48
重新打包WebAnno项目归档时的典型错误是在ZIP归档中包含一个顶级文件夹。
一个合适的WebAnno project archive的结构是这样的:
+- <project ID>.json - project metadata file
+- annotation
| +- <source document name>
| +- <user ID>.XXX - file representing the annotations for this user in the selected format.
+- annotation_ser
| +- <source document name>
| +- <user ID>.ser - serialized CAS file representing the annotations for this user
+- curation
| +- <source document name>
| +- CURATION_USER.XXX - file representing the state of curation in the selected format.
| +- CORRECTION_USER.XXX - correction project: original document state, automation project automatically generated suggestions
curation_ser
+- <source document name>
| +- CURATION_USER.ser - serialized UIMA CAS representing the state of curation
| +- CORRECTION_USER.ser - correction project: original document state, automation project automatically generated suggestions
+- log
| +- <project ID>.log - project log file
+- source - folder containing the original source files典型的错误是,人们提取这样一个归档文件,然后提取工具创建一个文件夹来放入所有内容。重新打包时,用户倾向于将此文件夹包含到重新打包的归档中。这会产生如下结构:
+- SOME FOLDER NAME
+- <project ID>.json
+- annotation
. +- ...
.WebAnno不会导入这样的归档文件。确保重新打包的归档文件不包含额外的顶级文件夹。
披露:我是WebAnno的维护者
https://stackoverflow.com/questions/56192473
复制相似问题