Looking Inside the Resource Description Framework (RDF)
RDF is a framework for describing and interchanging metadata. There are four main constructs in RDF:
- Resource. Basically, a resource is anything that can have a URI. This includes web pages, individual elements of an XML document, and just about anything in the universe—whether or not it’s officially on the Web.
- Property. A named attribute that describes a resource. For example, a book with the resource URI of urn:isbn:0201345382 might have an Author and/or a Title property. In RDF, properties can be resources in their own right, with their own properties.
- Value. The value of a property. A value can be just a string, such as Neal Stephenson, or it can be a resource with its own collection of properties. (Clearly, semantic web descriptions can get quite sophisticated.)
- Statement. The sentence constructed from the combination of resource, property, and value. Statements are also resources in their own right, which means that we can ascribe attributes to them—something we do in our discourse all the time.
Figure 2 illustrates the relationship between relational database tables and RDF. Think of the table column names as property descriptors, and the table entry under each column as the value of the property. The tricky part comes in when we need to ask, "What resource are we talking about?" This is where URNs are handy, because URNs are used to specify the name of something (potentially referenced on the Web) independently of its location. Here’s the format of a URN:
urn : naming scheme : id of item
Figure 2 A conventional relational database table and its deconstruction into an RDF representation.
Since we’re free to define our own naming schemes, we can easily convert relational data to RDF.
Despite the resemblance between RDF and database tables, RDF descriptions go beyond traditional database fields and records, by allowing meta descriptions to be applied to properties, values, and even the entire statement itself. All can be treated as a resource with metadata surrounding it. The strength of RDF lies in the way that it can potentially treat everything as a resource.
Properties as Resources
Properties can have their own properties and can be found and manipulated, like any other resource. This fact is important because, in the semantic web, we may want to do a search to discover properties. For example, you might want to determine whether anyone in web land has defined a property that describes the genre of a book, with values such as thriller, technical, or historical. Metadata helps to determine this information.
Values as Resources
Values can be simple or they can be resources. For example, the resource ZwiftBooks can have a property named homepage, which points to the home page at http://www.zwiftbooks.com/. Being able to treat this value as a resource allows us to further describe it with additional metadata properties such as page title, last-modified date, and author’s name.
Statements as Resources
Consider the following RDF statement: "ZwiftBooks’ home page is http://www.zwiftbooks.com." But who said so? What’s the source of this information? Because statements can have properties, we can talk about them intelligently on a meta level.