RDF main elements
The main elements of RDF are <RDF> and the <Description> element, which represents a resource. The
<rdf:RDF> element
<rdf:RDF> is the root element of the RDF document. It defines an 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 through the about attribute. The
<rdf:Description> element can contain those 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>
artist, country, company The elements , price and year are defined in the namespace http://www.recshop.fake/cd#. This namespace is outside of RDF (not part of RDF). RDF only defines the framework. The elements artist, country, company, price, and year must be defined by someone else (company, organization, individual, etc.).
Properties are used to define attributes.
Property elements can also be defined as attributes (replacing 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>
Properties are used to define attributes.
Property elements can also be defined as attributes (replacing 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 above example, the attribute artist has no value, but it references one To resources containing information about artists.