timothy falconer's semantic weblog
Big Fractal Tangle


RDF
 
RDF intro, part 4

Last time I talked about “triples”, which are the elementary nugget in RDF. What’s a triple? Have a look:


<rdf:Description

rdf:about='http://bigfractaltangle.com'

dc:title='Big Fractal Tangle' />

This triple is saying, “The resource ‘http://bigfractaltangle.com’ has the title ‘Big Fractal Tangle.” It’s a single fact, expressed as an RDF statement, or triple. The three parts that make it a triple are:

  1. resource: http://bigfractaltangle.com
  2. predicate: dc:title
  3. object: Big Fractal Tangle

Every RDF statement has a resource, a predicate, and an object. To see it another way, we can take the Grammar Rock approach: each sentence has a subject and a predicate. The subject is the resource we’re talking about. The predicate is the thing we’re saying about it. Before things get murky, it’s important to understand that what the RDF folks are calling a “predicate” is actually a “predicate name”. Seems like everyone drops the “name” part, even though in grammar (and logic), a predicate is both the name (dc:title) and its object (Big Fractal Tangle) together. Just to make things more confusing, the name/value combo is usually called a property in RDF. So in RDF-land, a predicate is a name and a property is pair.

Once more, an RDF triple (statement) is comprised of a resource (subject), a predicate (property name), and an object (property value). Technically, each piece is actually a URI reference to the thingy in question, with the exception of the object, which can also be a “literal” (right-here, right-now value). Here are two more triples:


<rdf:Description rdf:about='http://zombo.com' dc:subject='everything' />


<rdf:Description rdf:about="#tim">

<qed:favoriteSite rdf:resource='http://zombo.com' />

</rdf:Description>

The first says that the zombo.com resource has a subject of ‘everything’ (a literal). The second says that my favorite website is the resource zombo.com. Take note of the two ways I’m writing the properties. The first is contained in the Description tag. The second is a tag in its own right, between the start and end Description tags. Why have both? Well, some properties, such as the second one, can’t be written “inline”, since you can’t have XML attributes (rdf:resource) inside XML attributes (qed:favoriteSite). Other than that, some people just prefer one way over the other.

Many of you XML fans may still be wondering, “Can’t I do all this in XML? Why RDF? Why triples? Why Zombo?” Well, yesterday I hinted at the “pick-up-sticks” nature of RDF. Tomorrow I’ll rest my case by describing in detail the wholesome goodness of incomplete interconnectedness.

Comments are closed.