0

我在这样的模型中添加了一些资源和属性:

String xyz = "http://www.example.com/xyz";
   String creator = "http://www.example.com/Harry";
   String email = "http://www.example.com/harry@xyz.com";
   Resource creat = m.createResource(creator);
   Resource eId = m.createResource(email);
   Resource res =        m.createResource(xyz).addProperty(DC.creator,creat.addProperty(VCARD.EMAIL, eId));
   m.write(System.out);

结果我得到了这个:

<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:dc="http://purl.org/dc/elements/1.1/" > 
<rdf:Description rdf:about="http://www.example.com/xyz">
<dc:creator rdf:resource="http://www.example.com/Harry"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.example.com/Harry">
<vcard:EMAIL rdf:resource="http://www.example.com/harry@xyz.com"/>
</rdf:Description>
</rdf:RDF>

有没有其他方法可以得到结果,例如:

<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:dc="http://purl.org/dc/elements/1.1/" > 
<rdf:Description rdf:about="http://www.example.com/xyz">
<dc:creator rdf:resource="http://www.example.com/Harry"/>
    <vcard:EMAIL rdf:resource="http://www.example.com/harry@xyz.com"/>
</rdf:Description>
</rdf:RDF>
4

1 回答 1

0

试试 RDF/XML 漂亮的作家:使用

model.write( .... , "RDF/XML_ABBREV") 

或使用海龟。

于 2013-02-21T10:17:15.307 回答