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

RDF instance


May 23, 2021 RDF


Table of contents


RDF instance

This section provides an instance of RDF and teaches you how to use the RDF online authenticator.

RDF instance

Here are a few lines of a CD list:

title artist nation company price years
Empire Burlesque Bob Dylan USA Columbia 10.90 1985
Hide your heart Bonnie Tyler UK CBS Records 9.90 1988

Here are a few lines of an RDF document:

<?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:Description
rdf:about="http://www.recshop.fake/cd/Hide your heart">
<cd:artist>Bonnie Tyler</cd:artist>
<cd:country>UK</cd:country>
<cd:company>CBS Records</cd:company>
<cd:price>9.90</cd:price>
<cd:year>1988</cd:year>
</rdf:Description>
.
.
.
</rdf:RDF>

The first line of this RDF document is the XML declaration. This XML declaration is followed by the root element of the RDF document: slt;rdf:RDF.

The xmlns:rdf namespace, which specifies that the element with the prefix rdf comes from the namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns".

The xmlns:cd namespace, which specifies that the element with the prefix cd comes from the namespace "http://www.recshop.fake/cd".

The element contains a description of the resource identified by the rdf:out property.

Elements: slt;cd:artist> slt;cd:country> slt;cd:company?gt; etc. are attributes of this resource.


RDF online authenticator

W3C's RDF verification service is helpful when you're learning RDF. Here you can experiment with the RDF file.

The RDF online validator parses your RDF documents, examines their syntax, and generates tables and graphical views for your RDF documents.

Paste a copy of the following example into the RDF validator of W3C:

<?xml version="1.0"?>

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="//www.w3cschool.cn/rdf/">
<rdf:Description rdf:about="http://www.w3cschools.com">
<si:title>W3Cschools.com</si:title>
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>

After you parse the example above, the result will be something like this.

Related tutorials

XML tutorial