Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The main element of RDF


May 23, 2021 RDF


Table of contents


The main element of RDF

This section describes two main elements of RDF: slt;rdf:RDF;and slt;rdf:Description.gt;.


The main elements of RDF are the element of slt;RDF and the element of slt;Description, which can represent a resource.


the elements of the RDF

The root element of the RDF document is the RDF. I t defines an 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>


The element of the .lt;rdf:Description

The element identifies a resource by the out property.

The elements can contain those elements that describe the resource:

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

The elements artist, country, company, price, and year are defined in the namespace http://www.recshop.fake/cd . T his namespace is outside of RDF (not part of RDF). R DF defines only this framework. Elements such as artist, country, company, price, and year must be defined by others (companies, organizations, individuals, etc.).


Property defines properties (attributes)

Property elements can also be defined as attributes (replacing elements):

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


Property defines resources

Property elements can also be defined as resources:

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

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

These are the introductions to this section.