Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

RDF in Fifty Words or Less

Okay, so maybe this is a bit more than fifty words, but the key points are pretty simple (and put into bold text for you manager-types who just want to get straight to the point). The Resource Description Framework, or "RDF", is really two things.

First, RDF is a graph-based model for describing Internet resources (like web pages and email messages), and how these resources relate to one another.

But what does that mean, really? To a Mozilla developer, it means that the RDF data model (the "graph") can be used as a mechanism for integrating and organizing Internet resources.

Let's look at an example: bookmarks. Right now, most web browsers let you organize your bookmarks hierarchically into folders. Each bookmark is a pointer to a web page called a URI (Uniform Resource Identifier).

But a web page is just one kind of Internet resource. There are tons of others, including email messages, UseNet news articles (or entire UseNet news groups), and search results from your favorite web crawler, just to name a few. And fundamentally, there's no reason that you shouldn't be able to treat these as "bookmarks" as well, grouping them together into folders as you please, or maybe even creating "smart" folders that, when you open them, dynamically generate their contents by running common search that you define.

And a "bookmark" could really have arbitrary properties associated with it: you might want to invent your own "classification" scheme for a bookmark a la Macintosh's "hot", "warm", "cool" color coding. Or you might want to relate a bookmark to another bookmark, or keep it in multiple "folders" at once.

The RDF graph provides a perfect data model upon which to build a "universal" bookmarking service as described above: the graph can contain pointers to arbitrary resources and can group them in just about any way that you can imagine.

But wait, there's more...

Second, RDF is a serialization syntax. This syntax allows the graph-like model to be communicated between "agents".

Okay, what the heck does that mean? Fundamentally, it means that parts of the RDF data model can be communicated across network boundaries, and the contents of the graph can dynamically change as information arrives from a remote service.

Let's go back to our bookmark example. Say that one of my bookmark "folders" is really a pointer to my email inbox: when I open that folder, voilà! All the messages that I've received over night appear.

But how did that happen? The inbox "folder" was really just a pointer to an Internet resource that contains more RDF that extends the graph. That "Internet resource" was a URI that pointed to a CGI script (say, <tt>https://www.mozilla.org/smart-mail/get-mail.cgi?user=waterson&folder=inbox</tt>). The CGI script actually generates serialized RDF, which is basically just a way of formatting a graph into XML:

 <rdf:RDF
     xmlns:rdf="https://www.w3.org/TR/WD-rdf-syntax#"
     xmlns:sm="https://www.mozilla.org/smart-mail/schema#">
   <rdf:Description
     about="https://www.mozilla.org/smart-mail/get-mail.cgi?user=waterson&folder=inbox">
     <sm:message id="4025293">
        <sm:recipient>
          Chris Waterson "[email protected]"
        </sm:recipient>
        <sm:sender>
          Aunt Helga "[email protected]"
        </sm:sender>
        <sm:received-by>x-wing.mcom.com</sm:received-by>
        <sm:subject>Great recipe for Yam Soup!</sm:subject>
        <sm:body>
          https://www.mozilla.org/smart-mail/get-body.cgi?id=4025293
        </sm:body>
     </sm:message>
     <sm:message id="4025294">
        <sm:recipient>
          Chris Waterson "[email protected]"
        </sm:recipient>
        <sm:sender>
          Sarah Waterson "[email protected]"
        </sm:sender>
        <sm:received-by>x-wing.mcom.com</sm:received-by>
        <sm:subject>We won our ultimate game</sm:subject>
        <sm:body>
          https://www.mozilla.org/smart-mail/get-body.cgi?id=4025294
        </sm:body>
     </sm:message>
   </rdf:Description>
 </rdf:RDF>

Upon receipt of the above monstrosity, the RDF engine folds the RDF into the graph at the appropriate place, and the tree control that actually implements the UI to the bookmarks is notified that it should begin drawing some icons for the latest message about Yam Soup from Aunt Helga.

This is exactly how SmartMail works.

Contact: Chris Waterson ([email protected])

Original Document Information

Interwiki Language Links

Document Tags and Contributors

Tags: 
 Contributors to this page: Mgjbot, Sheppy, glen-84, Leofiore, Nam-Hyung Kim, Andreas Wuest, NickolayBot
 Last updated by: Mgjbot,