Latest web development tutorials

RDF main elements

The main elements of RDF is <RDF> and may represent <Description> element to a resource.


<Rdf: RDF> element

<Rdf: RDF> RDF is the root element of the document. It defined the XML document as an RDF document. It also contains a reference to the RDF namespace:

<?xml version="1.0"?>

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
...Description goes here...
</rdf:RDF>


<Rdf: Description> element

<Rdf: Description> element identifies a resource by about property.

<Rdf: Description> element can contain elements that describe the resources:

<?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:RDF>

artist, country, company, price and year of these elements are defined in the namespace http: //www.recshop.fake/cd# in. This namespace outside of RDF (RDF is not part of). RDF defines only the framework. The artist, country, company, price and year of these elements must be others (companies, organizations or individuals, etc.) are defined.


Properties (property) to define the attributes (attribute)

Property element (property elements) can also be used as attributes (attributes) to be defined (substituted element):

<?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:country="USA"
cd:company="Columbia" cd:price="10.90"
cd:year="1985" />

</rdf:RDF>


Properties (property) to define the attributes (attribute)

Property element (property elements) can also be used as attributes (attributes) to be defined (substituted element):

<?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 rdf:resource="http://www.recshop.fake/cd/dylan" />
...
...
</rdf:Description>

</rdf:RDF>

The above example, the artist has no value property, but refers to a resource that contains information about the artist.