RDF MainElements
The main elements of RDF are <RDF> and the <Description> element, which can represent a resource.
<rdf:RDF> Element
<rdf:RDF> is the root element of an RDF document. It defines the XML document as an RDF document. It also contains a reference to the RDF namespace:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
...Description goes here...
</rdf:RDF>
<rdf:Description> Element
The <rdf:Description> element can identify a resource with the about attribute.
The <rdf:Description> element can contain elements that describe the resource:
<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:RDF>
The elements artist, country, company, price, and year are defined in the namespace http://www.recshop.fake/cd#. This namespace is outside of RDF (it is not part of RDF). RDF only defines this framework. The elements artist, country, company, price, and year must be defined by others (companies, organizations, or individuals, etc.).
Using properties to define attributes
Property elements can also be defined as attributes (instead of elements):
<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:country="USA"
cd:company="Columbia" cd:price="10.90"
cd:year="1985" />
</rdf:RDF>
Using properties to define attributes
Property elements can also be defined as attributes (instead of elements):
<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 rdf:resource="http://www.recshop.fake/cd/dylan" />
...
...
</rdf:Description>
</rdf:RDF>
In the example above, the attribute artist has no value, but it references a resource that contains information about the artist.
Other Extensions