RDF Examples

RDF Examples

Αυτές είναι μερικές γραμμές αυτής της λίστας CD:

Τίτλος Καλλιτέχνης Χώρα Εταιρεία Τιμή Έτος
Empire Burlesque Bob Dylan USA Columbia 10.90 1985
Hide your heart Bonnie Tyler UK CBS Records 9.90 1988
...          

Αυτά είναι μερικές γραμμές αυτού του RDF έγγραφου:

<?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>

Η πρώτη γραμμή αυτού του RDF έγγραφου είναι η διατύπωση XML. Ακολουθεί η ρίζα του έγγραφου RDF:<rdf:RDF>.

xmlns:rdf Το ονοματικό χώρος καθορίζει ότι τα στοιχεία με το πρόθεμα rdf προέρχονται από τον ονοματικό χώρο "http://www.w3.org/1999/02/22-rdf-syntax-ns#".

xmlns:cd Το ονοματικό χώρος καθορίζει ότι τα στοιχεία με το πρόθεμα cd προέρχονται από τον ονοματικό χώρο "http://www.recshop.fake/cd#".

<rdf:Description> The element contains a description of the resource rdf:about The description of the resource identified by the attribute.

Element:<cd:artist>,<cd:country>,<cd:company> etc. are the properties of this resource.

RDF Online Validator

W3C's RDF Validation ServiceIt is very helpful when learning RDF. Here you can experiment with RDF files.

The RDF Online Validator can parse your RDF document, check its syntax, and generate a table and graphical view of your RDF document.

Copy and paste the following example into W3C's RDF Validator:

<?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>

After you parse the above examples, the result will be similar to this.