Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend

What the Predicate Says

Let's see how we would deconstruct the sentence above ("I crashed my car yesterday") as a bit of RDF. First we have to break down the sentence into a number of assertions. Let's rewrite the sentence as three simpler sentences:

  • "I crashed a car."

  • "The crash happened yesterday."

  • "The car was mine."

These assertions can best be described by a graph, which looks something like Figure 1.

Figure 1Figure 1 Anatomy of a car crash as a directed labeled graph.

This diagram (called a directed labeled graph) asserts that there was a crash: which occurred yesterday; in which I was a driver; and which involved a car, also owned by me. The ovals are things, or resources in RDF-speak, and the lines or arcs represent properties (aspects of the resources), which in RDF-speak we refer to as a predicate. Together, resources and arcs form statements, such as "The crash happened yesterday" or "The car was mine." This is basic grammar school stuff—not rocket science.

Now here's the part that's going to blow your mind: Every resource can be a URI.

You seem underwhelmed by this revelation.

Okay, let's discard my improbable example and imagine something more relevant. How can I use RDF to describe this article you're reading right now? Using a directed labeled graph, a description of the title and author of this article might look like Figure 2.

Figure 2Figure 2 Using a graph to represent metadata.

I've used a URL to specify the thing I'm defining, but literal strings are used for all the other values in Figure 2. This graph accurately depicts the author and title of the article, but in order for me to interpret the graph, I need to know what you mean by "Author" and "Title." This is where the power of RDF really comes into play. If I replace the words "Author" and "Title" with URI references, the meaning of these relationships becomes much more clearly defined, as shown in Figure 3.

Figure 3Figure 3 Metadata graph with URI references.

Unlike words, URIs are non-ambiguous. The word title has different meanings in different contexts (for example, a royal title, job title, or title to a piece of land). You know what you're talking about when you say title because you have the context. But remember, computers are stupid. Computers are essentially souped-up adding machines. (Try teaching an adding machine the meaning of the word title sometime—let me know how that goes.) A computer can easily compare two strings, though, and tell you whether they're the same. Hence, the main thing we get by replacing the literals with URI references is clarity. This clarity allows a computer to do "smart things" with content by doing what it's good at. As a bonus, you can follow the URI reference to find documentation on that relationship, as we'll see later on.

To make this RDF example even more useful, I could replace the author name with another URI reference—something like this rather unfriendly identifier, for instance:

http://www.informit.com/authors/author.asp?authorid={B076D9A2-1541-4FD9
-AB09-CDADEC3FBB81}

This points to a specific author record or description. Like the URI reference for the relationship, it's not important what it points to, as long as its use is internally consistent within your documents.

  • + Share This
  • 🔖 Save To Your Account