Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


How RDF Beats Basic XML: Web-Based Data Sharing : Page 2

The XML format provides the flexibility to describe anything, but it is also prone to errors and miscommunication. Find out how Resource Description Framework (RDF) can be a solution to these limitations.


How Does RDF Work?

RDF works by expressing statements about resources, which can be anything. A resource does not even have to exist. One can describe whatever one wants to in RDF by putting together an RDF statement about that resource. In theory, a single RDF statement resembles a simple English sentence. For example, a typical simple English sentence is structured in the following way: Subject-Verb-Object. A typical RDF statement is made up of the three following components: Subject-Predicate-Object. These Subject-Predicate-Object triples are often referred to as just that: RDF triples.

The Subject is always a web resource. In RDF, a resource is represented by a URI. Unlike a URL, a URI is not used to locate resources, only to identify them (hence the I for Identifier instead of the L for Locator). A Predicate describes the Subject (an example of this is upcoming). Finally, the Object can be either another resource or a simple constant, possibly representing a number, string or date.

The expression "Alex is writing an article" would look something like this in an RDF triple:

Alex isWriting Article

While the triples concept is intuitive because of its close relation to English, RDF syntax is a bit cryptic because it is meant for machine readability. In recent years, more human-readable RDF syntaxes have been introduced, but simple statements can still produce bulky and cryptic XML. For example, here is a snippet of real RDF that represents the simple expression "Alex is writing an article":

<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:j.0="http://www.w3.org/2001/XMLSchema#" xmlns:socterms="http://semanticalley.com/onto/2009/socrates#" xmlns:RDFS="http://www.w3.org/2000/01/rdf-schema#" xmlns:RFDExample="http://semanticalley.com/onto/2009/rdfExample#" > <RDF:Description RDF:about="http://semanticalley.com/onto/2009/rdfExample#Alex"> <RFDExample:isWriting RDF:resource="http://semanticalley.com/onto/2009/rdfExample#Article <RDF:type RDF:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> </RDF:Description> <RDF:Description RDF:about="http://semanticalley.com/onto/2009/rdfExample#Article"> <RDF:type RDF:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> </RDF:Description> <RDF:Description RDF:about="http://semanticalley.com/onto/2009/rdfExample#isWriting"> <RDF:type RDF:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/> </RDF:Description> </RDF:RDF>

Ultimately, the size and complexity of the XML is not a huge concern because the cryptic syntax is meant for computers. Also because it is meant for machines, one can put together large collections of statements. A large and/or comprehensive collection of statements about a subject (such as wine for example) is a body of data that in the philosophy of knowledge is known as an ontology. Hence, in Semantic Web, one can make ontologies in RDF and infinitely share them.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.