2016-04-21 94 views
1

我在我的java应用程序中使用Jena(apache-jena-libs 3.0.1)来创建RDF模型并序列化为RDF/XML。我使用的是https://jena.apache.org/documentation/io/rdfxml_howto.htmlApache Jena RDFWriter.setProperty没有效果

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没有影响一样。有任何想法吗?

回答

1

有(只是记录为耶拿1168)

一种解决方法是使用

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

由于一个错误,这有助于!链接到该问题:https://issues.apache.org/jira/browse/JENA-1168 –