2016-04-05 27 views
0

的命名空間:糾正鑑於這種(很做作)的代碼片斷詞彙

System.out.println(VCARD.uri); 
System.out.println(SKOS.uri); 

Resource johnSmith = model.createResource("http://somewhere/js") 
     .addProperty(VCARD.FN, "John Smith") 
     .addProperty(SKOS.notation, "John Smith"); 

model.write(System.out); 

我們得到

http://www.w3.org/2001/vcard-rdf/3.0# 
http://www.w3.org/2004/02/skos/core# 

<rdf:RDF 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" 
    xmlns:j.0="http://www.w3.org/2004/02/skos/core#"> 
    <rdf:Description rdf:about="http://somewhere/js"> 
    <j.0:notation>John Smith</j.0:notation> 
    <vcard:FN>John Smith</vcard:FN> 
</rdf:RDF> 

鑑於SKOS在耶拿內部表示,爲什麼仍然返回j.0符號(但不適用於vcard屬性)?我讀過類似的問題(例如this onethis onethis one),但他們似乎指的是提到他們自己的本體論的人。鑑於uri常數對於SKOS是正確的,爲什麼它會在RDF表示中發生變化?

回答

0

該代碼已使用SKOS的URI,但未在模型上設置前綴。見setNsPrefix

您不妨使用漂亮的打印輸出形式,默認只有基本的RDF/XML。在model.write調用中設置語法名稱(有關詳細信息,請參閱javadoc)。

+0

我無法看到文檔中哪裏有哪些'詞彙表中有ns在內部設置的ns(顯然'vcard'確實,但'skos'沒有) - 列表是否存在? – ChrisW