The RDF Graph Model


RDF is mainly represented through a graph model. However, you may find XML representations of the RDF document. The RDF tools present in the industry today visually represent this XML document as an RDF graph.

The simplest form of an RDF graph is a single triplet that is composed of a subject, predicate, and object. An example is presented in Figure 24-3.

image from book
Figure 24-3

When working with a graph, note the two main parts of the graph:

  • q Nodes

  • q Arcs

A node is either the subject or the object. The arc on the other hand is the predicate. An arc is the item that connects two nodes, thereby forming a relationship between the nodes. An arc also has a direction. In this case, the subject is acting upon the object using the predicate.

Although the nodes in Figure 24-3 might look similar, you can always tell which node is the subject and which node is the object by the direction in which the predicate is applied. For instance, if you go back to the Ernest Hemingway example, you can find the set of nodes presented in Figure 24-4.

image from book
Figure 24-4

From this figure, you can plainly see that the Ernest Hemingway node is the subject and that the The Sun Also Rises node is the object. You determine this by the direction of the predicate, wrote a book, which is pointing to the The Sun Also Rises node-implying that the Ernest Hemingway node is acting upon it.

Graphs, of course, get more complex as more nodes are added. This is because you add the relationships between the nodes which are present (using predicates). For instance, you can add another node that has a relationship to the object, The Sun Also Rises, to the diagram presented in Figure 24-4. This extension is shown in Figure 24-5.

image from book
Figure 24-5

In this case, you have three nodes that have some sort of relationship among them, even if it is indirect. In this case, you have Ernest Hemingway who wrote a book called The Sun Also Rises which was published by a company by the name of Charles Scribner's Sons. All the nodes are related in a way, and the two predicates define that relationship between the nodes. You could provide additional metadata to the RDF graph, thereby showing a circular relationship. This is shown in Figure 24-6.

image from book
Figure 24-6

From the diagram in Figure 24-6, you can see that all three nodes now have a direct relationship. Ernest Hemingway has a relationship with the book, The Sun Also Rises, because he wrote the book. Ernest Hemingway also has a relationship to the company, Charles Scribner's Sons, because this firm was his publisher.

A triples, which is broken down as the subject, predicate, and object, is called a statement. A statement is usually represented in a graph as shown in Figure 24-7.

image from book
Figure 24-7

In this case, the statement definition is presented using a dashed line that forms a box around the entire triples.




Professional XML
Professional XML (Programmer to Programmer)
ISBN: 0471777773
EAN: 2147483647
Year: 2004
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net