RDF instance ¶
This is a few lines of a CD list:
Title | Artists | The 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 the XML declaration. This XML declaration is followed by the root element of the RDF document: <rdf:RDF> .
xmlns:rdf Namespace, which specifies that elements with the prefix rdf come from the namespace “ http://www.w3.org/1999/02/22-rdf-syntax -ns#”.”
xmlns:cd Namespace, which specifies that elements with the prefix cd come from the namespace “ http://www.recshop.fake /cd#”.”
<rdf:Description> The element contains a response to the rdf:about The description of the resource identified by the.
Elements: <cd:artist> 、 <cd:country> 、 <cd:company> And so on are properties of this resource.
RDF online verifier ¶
W3C 的 RDF 验证服务 It is very helpful when you learn RDF. Here you can experiment with RDF files.
The RDF online validator parses your RDF document, checks its syntax, and generates tables and graphical views for your RDF document.
Copy and paste the following example into the W3C RDF validator:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="http://www.runoob.com/rdf/">
<rdf:Description rdf:about="http://www.runoob.com">
<si:title>runoob.com</si:title>
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
After you parse the above example, the result will look something like this.