简体   繁体   English

Apache Jena RDFWriter.setProperty 没有效果

[英]Apache Jena RDFWriter.setProperty has no effect

I'm using Jena (apache-jena-libs 3.0.1) in my java application to create RDF model and serialize to RDF/XML.我在我的 java 应用程序中使用 Jena (apache-jena-libs 3.0.1) 创建 RDF 模型并序列化为 RDF/XML。 I am using the same way that is documented in https://jena.apache.org/documentation/io/rdfxml_howto.html我使用的方式与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);

However, the writer ignores any of the properties, they have no effect on the resulting XML.但是,作者忽略了任何属性,它们对生成的 XML 没有影响。 Any ideas?有任何想法吗?

There is a bug (just record as JENA-1168)有一个错误(只记录为 JENA-1168)

A workaround is to use一种解决方法是使用

RDFWriter rdfWriter = new org.apache.jena.rdfxml.xmloutput.impl.Abbreviated() ;

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

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