2016-04-21 96 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 –