RDF Examples
RDF Examples
Here are a few lines from 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 |
Here are a few lines from an RDF document:
<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 the XML declaration. After this XML declaration is the root element of the RDF document:<rdf:RDF>。
xmlns:rdfNamespace, specifying that elements with the prefix rdf come from the namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#".
xmlns:cdNamespace, specifying that elements with the prefix cd come from the namespace "http://www.recshop.fake/cd#".
<rdf:Description>The element contains therdf:aboutdescription of the resource identified by the attribute.
Element:<cd:artist>、<cd:country>、<cd:company>etc. are properties of this resource.
RDF Online Validator
W3C's RDF validation serviceIt is very helpful when you learn RDF. Here you can experiment with RDF files.
The RDF online validator can parse your RDF document, check its syntax, and generate tabular and graphical views for your RDF document.
Copy and paste the following example into W3C's RDF validator:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="http://www.example.com/rdf/">
<rdf:Description rdf:about="http://www.example.com">
<si:title>example.com</si:title>
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
After you parse the above example, the result will look like this.
Other Extensions