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 に答える