1

我在我的 java 应用程序中使用 Jena (apache-jena-libs 3.0.1) 来创建 RDF 模型并序列化为 RDF/XML。我使用的方式与https://jena.apache.org/documentation/io/rdfxml_howto.html中记录的方式相同

FileOutputStream out = new FileOutputStream( new File(dir, filename + ".xml") );
RDFWriter rdfWriter = notificationModel.getWriter("RDF/XML-ABBREV");
rdfWriter.setProperty("showXmlDeclaration", "true");
rdfWriter.setProperty("showDoctypeDeclaration", "true");
rdfWriter.write(notificationModel, out, null);

但是,作者忽略了任何属性,它们对生成的 XML 没有影响。有任何想法吗?

4

1 回答 1

1

有一个bug(只记录为JENA-1168)

一种解决方法是使用

RDFWriter rdfWriter = new org.apache.jena.rdfxml.xmloutput.impl.Abbreviated() ;
于 2016-04-22T17:39:01.277 回答