Contoh RDF

Contoh RDF

Ini adalah beberapa baris dari daftar CD:

Judul Artis Negara Perusahaan Harga Tahun
Empire Burlesque Bob Dylan USA Columbia 10.90 1985
Hide your heart Bonnie Tyler UK CBS Records 9.90 1988
...          

Ini adalah beberapa baris dari dokumen RDF ini:

<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:cd="http://www.recshop.fake/cd#"
<rdf:Description
 rdf:about="http://www.recshop.fake/cd/Empire Burlesque"
  <cd:artist>Bob Dylan</cd:artist>
  <cd:country>USA</cd:country>
  <cd:company>Columbia</cd:company>
  <cd:price>10.90</cd:price>
  <cd:year>1985</cd:year>
</rdf:Description>
<rdf:Description
 rdf:about="http://www.recshop.fake/cd/Hide your heart"
  <cd:artist>Bonnie Tyler</cd:artist>
  <cd:country>UK</cd:country>
  <cd:company>CBS Records</cd:company>
  <cd:price>9.90</cd:price>
  <cd:year>1988</cd:year>
</rdf:Description>
.
.
.
</rdf:RDF>

Baris pertama dokumen RDF ini adalah deklarasi XML. Setelah deklarasi XML ini adalah elemen root dokumen RDF:<rdf:RDF>.

xmlns:rdf Namespace, menentukan elemen dengan prefiks rdf berasal dari namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#".

xmlns:cd Namespace, menentukan elemen dengan prefiks cd berasal dari namespace "http://www.recshop.fake/cd#".

<rdf:Description> Elemen mengandung deskripsi untuk sumber daya yang rdf:about Deskripsi sumber daya yang diidentifikasi oleh atribut.

Elemen:<cd:artist><cd:country><cd:company> yang lain adalah properti sumber daya ini.

Validator RDF Online

Layanan Validasi RDF W3CBerguna bagi Anda untuk belajar RDF. Di sini Anda dapat melakukan percobaan file RDF.

Validator RDF Online dapat mengurai dokumen RDF Anda, memeriksa sintaksanya, dan membuat tabel dan tampilan grafis dokumen RDF Anda.

Salin dan tempel contoh di bawah ke Validator RDF W3C:

<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:si="http://www.recshop.fake/siteinfo#">
  <rdf:Description rdf:about="http://www.codew3c.com/RDF">
    <si:author>David</si:author>
    <si:homepage>http://www.codew3c.com</si:homepage>
  </rdf:Description>
</rdf:RDF>

Setelah Anda mengurai contoh di atas, hasilnya akan seperti ini.