Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

Explain RDF with an Example?
 I have given you example of cd list.
Title        Artist        country   Price
The Reader   Kate Winslet    USA     11.80
Just My Luck Lindsay Lohan   USA     12.99

The create this cd list by using RDF like that,
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:cd="http://www.r4r.in/cd#"> 
<rdf:Description
  rdf:about="http://www.r4r.in/cd/The Reader">
  <cd:artist>Kate Winslet</cd:artist>
  <cd:country>USA</cd:country>
  <cd:price>11.80</cd:price>
</rdf:Description>
<rdf:Description
  rdf:about="http://www.r4r.in/cd/Just My Luck">
  <cd:artist>Lindsay Lohan</cd:artist>
  <cd:country>USA</cd:country>
  <cd:price>12.99</cd:price>
</rdf:Description>
</rdf:RDF>   
 In the above example In first step RDF document is the XML declaration by using <rdf:RDF>.
 We use xmlns:rdf namespace to define the elements with the rdf prefix are from the namespace,
"http://www.w3.org/1999/02/22-rdf-syntax-ns#".
 We use xmlns:cd namespace to define the elements with the cd prefix are from the namespace,
"http://www.r4r.in/cd#".
 We use <rdf:Description> element which has whole discription of the source identified by rdf:about aattribute.

And the elements: <cd:artist>, <cd:country>, <cd:price> are properties of the resource.
Posted By: Name:Rajesh Kr URL: Explain RDF with an Example?