RDF Examples
- Previous Page RDF Rules
- Next Page RDF Elements
RDF Examples
These are several lines of a CD list:
Title | Artist | Country | Company | Price | Year |
---|---|---|---|---|---|
Empire Burlesque | Bob Dylan | USA | Columbia | 10.90 | 1985 |
Hide your heart | Bonnie Tyler | UK | CBS Records | 9.90 | 1988 |
... |
These are several lines of an RDF document:
<?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>
The first line of this RDF document is an XML declaration. After this XML declaration is the root element of the RDF document:<rdf:RDF>.
xmlns:rdf The namespace specifies that elements with the prefix rdf come from the namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#".
xmlns:cd The namespace specifies that elements with the prefix cd come from the namespace "http://www.recshop.fake/cd#".
<rdf:Description> The element contains a description of the resource being rdf:about The description of the resource identified by the attribute.
Element:<cd:artist>,<cd:country>,<cd:company> and so on 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 table and graphical views for 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.
- Previous Page RDF Rules
- Next Page RDF Elements