Resource Description Framework
The Resource Description Framework (RDF) is intended to offer a solution to the problem that although everything on the Web is machine-readable, it is not machine-understandable. RDF proposes a scheme of metadata, data about data, to describe the data on the Web.
Drawing on previous work from the PICS initiative and the Dublin Core (two other important metadata initiatives), RDF emphasizes facilities to enable the automated processing of Web resources. RDF is intended for use in a variety of application areas, and so the distinction between what is data and what is metadata is left open for the application itself to decide. The authors of the RDF working draft see the following areas as their prime targets:
- • Facilitating "resource discovery" to provide better search engine capabilities
- • Cataloging the content and content relationships available at a particular Web site, page, or digital library
- • Enabling intelligent software agents for knowledge sharing and exchange
- • Providing content ratings to describe collections of pages that represent a single logical document
- • Guarding the intellectual property rights of Web pages
- • Specifying user privacy preferences and the privacy policies of a Web site
- • Implementing digital signatures for electronic commerce
| The Platform for Internet Content Selection (PICS) was originally developed for the more down-to-earth task of providing a means for "adult" Web sites to implement a form of screening so that filter software could shield "unsuitable" content from accidental access. |
| Named after Dublin, Ohio, the home of the Online Computer Library Center, the Dublin Core is a set of elements developed by librarians, digital library researchers, and text-markup specialists that identify certain basic atoms of information. These elements include, for example, DATE, TITLE, SUBJECT, and LANGUAGE. |
In practice (although I am simplifying a great deal), the mechanism of RDF is extremely simple. The model consists of just three parts: a resource (a URI), a property type, and a value. All three of these items of information are straightforward XML elements and so, to identify them, the XML code uses the RDF namespace. Listing 17.1 shows the RDF code (in XML of course) for a book. According to the Dublin Core, a book has a title and the author is called the creator.
|
Listing 17.1 A Simple RDF Example for a Book
|
1: <?xml version="1.0"?> 2: <rdf:RDF 3: xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#" 4: xmlns:books="http://www.booksRus.com/schemas/books/"> 5: <rdf:Description about="http://www.xs4all.nl/~sintac"> 6: <books:Creator>Simon North</books:Creator> 7: </rdf:Description> 8: </rdf:RDF>
| The RDF namespace (you don't have to use the string rdf as the namespace identifier-you can use whatever you like), refers back to the W3C Web page that describes RDF (http://www.w3.org/TR/WD-rdf-syntax). The books namespace points, supposedly, to a location on the Books'R'Us site where there would be a vocabulary of what these elements mean. By using namespaces and Web sites in this way, you aren't limited as to what element names you use; by referring back to the vocabulary, any application can find the significance or purpose of the information contained inside the element. |
In addition to using simple elements, RDF also allows you to assemble collections of resources called bags and sequences. They are basically the same; the difference is that in a bag the order doesn't matter while in a sequence the order does matter. Listing 17.2 shows the use of a bag where the book has more than one author.
|
Listing 17.2 A Simple RDF Example for a Book
|
1: <?xml version="1.0"?> 2: <rdf:RDF 3: xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#" 4: xmlns:books="http://www.booksRus.com/schemas/books/"> 5: <rdf:Description about="http://www.xs4all.nl/~sintac"> 6: <books:Creator> 7: <RDF:Seq> 8: <books:LI>Simon North</books:LI> 9: <books:LI>Paul Hermans</books:LI> 10: </RDF:Seq> 11: </books:Creator> 12: </rdf:Description> 13: </rdf:RDF>
| I used a Seq element to group the two authors because the order of their listing does matter; if it didn't I'd have used the Bag element instead. |
There is, obviously, a lot more to RDF than what I have described so far, but that lies beyond the scope of this book because it is all rather theoretical. One practical side of RDF that you will notice, though, is that Netscape is already implementing RDF in Mozilla (its testbed for future Netscape Communicator versions) for describing bookmarks. RDF is, in this sense, Netscape's counterpart of Microsoft's Active Desktop and channels (which are based of CDF, another XML application). Listing 17.3 shows a typical Mozilla RDF file.
Listing 17.3-A Mozilla RDF Resource File
1: <RDF:RDF> 2: <Topic id="NC:Toolbar"> 3: <child> 4: <Topic id="NC:CommandToolBar" name="Command Toolbar" 5: toolbarBitmapPosition="top" 6: toolbarButtonsFixedSize="yes" > 7: <child href="command:back" name="Back"/> 8: <child buttonTooltipText="Reload this page from the server" 9: buttonStatusbarText="Reload the current page" 10: href="command:reload" name="Reload"/> 11: <child href="command:stop" name="Stop"/> 12: <child href="command:forward" name="Forward"/> 13: <child name="separator0" href="nc:separator0"/> 14: <child href="command:urlbar" name=" " 15: buttonStatusBarText="Location/Search Bar" 16: buttonTooltipText="Location/Search Bar" 17: urlBar="Yes" urlBarWidth="*"/> 18: <child name="separator2" href="nc:separator2"/> 19: </Topic> 20: </child> 21: 22: <child> 23: <Topic id="NC:InfoToolbar" name="Info Toolbar"> 24: <child> 25: <Topic id="NC:Bookmarks" name="Bookmarks"></Topic> 26: </child> 27: <child> 28: <Topic id="NC:History" 29: largeIcon="icon/large:workspace,history" name="History"> 30: <child href="NC:HistoryMostVisited" 31: name="Most Frequented Pages"/> 32: <child href="NC:HistoryBySite" name="History By Site"/> 33: <child href="NC:HistoryByDate" name="History By Date"/> 34: </Topic> 35: </child> 36: <child href="NC:Sitemaps" name="Related" 37: htmlURL="http://rdf.netscape.com/rdf/navcntradvert.html"/> 38: </Topic> 39: </child> 40: 41: <child> 42: <Topic id="NC:PersonalToolbar" name="Personal Toolbar"> 43: </Topic> 44: </child> 45: </Topic> 46: 47: <Topic id="NC:NavCenter"> 48: <child href="NC:Bookmarks" name="Bookmarks"/> 49: <child href="NC:Search" 50: largeIcon="icon/large:workspace,search" name="Search"/> 51: <child href="NC:History" name="History"/> 52: <child id="NC:Sitemaps" name="Site Tools" 53: htmlURL="http://rdf.netscape.com/rdf/navcntradvert.html" /> 54: <child id="NC:LocalFiles" name="Files" 55: largeIcon="http://rdf.netscape.com/rdf/heabou.gif"/> 56: </Topic> 57: 58: <Topic id="NC:SmartBrowsingProviders"> 59: <child href="http://altavista.digital.com/ 60: cgi-bin/query?q=link%3A" 61: name="Who points to me?" 62: resultType="TEXT/HTML"/> 63: <child href="http://www-rl1.netscape.com/wtgn?" 64: name="Related Links" 65: resultType="TEXT/RDF" /> 66: </Topic> 67: 68: </RDF:RDF>