Archives

Tuesday October 20, 2009

Visualizing RDF and OWL data models

The data models for Resource Description Framework (RDF) and Web Ontology Language (OWL) can be a bit difficult to understand, even at the simplest level. Here are some visualizations (and explanations) I've found useful: I'd be delighted to hear about other ways of thinking about this. All comments and/or corrections are welcome...

Table

The most obvious representation of RDF (and thereby, OWL) is a rectangular table where each row encodes a simple "fact". For example, here is a trivial ontology:

    Subject Predicate Object
    Dogis_aThing
    Catis_aThing
    CatteasesDog
    DogchasesCat

This table is quite similar to ones found in a relational database management system (RDBMS), in that cells contain literal values (eg, integers or strings) or keys (eg, URIs). However, some of the details are quite different. For example:

  • RDF - uses a single table for everything
    RDBMS - uses (many) separate tables

  • RDF - object can be a literal value or a key
    RDBMS - column data types are constrained

  • RDF - queries can follow chains of inferences
    RDBMS - queries examine explicit connections
Conveniently, this visualization of RDF is echoed in the simplest form of Turtle syntax:
    Dog   is_a     Thing.
    Cat   is_a     Thing.
    Cat   teases   Dog.
    Dog   chases   Cat.
    

Abstract 3D Space

As pointed out in Chapter 3 of Semantic Web Programming, the tabular representation of RDF statements can be visualized as points in an abstract three-dimensional (3D) space:

  • The axes represent the subject, predicate, and object.

  • Each axis contains every possible URI or literal.

  • Each point represents a small atom of information.

  • Each point is independent of all other points.

  • Definitions (ie, triples) are unordered.

  • Identical definitions are ignored.

Directed Graph

Ontologies are an application of directed graphs: each RDF triple is an edge, each literal or URI is a node. Diagramming (a subset of) the graph can allow readers to follow connections, recognize patterns, etc. Here is our sample ontology, as drawn by (and encoded for) the Graphviz utility.

digraph DAG { rankdir = "BT";
  Dog -> Thing [label = "  is_a"];
  Cat -> Thing [label = "  is_a"];
  Dog -> Cat   [label = "  chases"];
  Cat -> Dog   [label = "  teases"];
}

Decorated Hierarchy

Although RDF is mostly concerned with entities and relations, OWL raises the level of discourse to include classes, restrictions, and more. In particular, OWL structures ontologies as class hierarchies, decorated by other relations.

This simplifies the notation, because "is_a" relations can be expressed by indentation (etc). Here is an OWLish (ASCII Art) representation of our ontology:

    Thing
    |
    |`--  Cat  (teases Dog)
     `--  Dog  (chases Cat)
    

Sets and Mappings

Each RDF relation defines a mapping between two entities. OWL provides the ability to restrict the domain and range sets of mappings, providing protections analogous to the data type and foreign key constraints found in an RDBMS.

Collections of Triples

Most production ontologies make use of pre-defined collections of triples. Indeed, making use of such collections is widely considered to be a Best Practice, because it reduces error, increases interoperability, etc.

Some of these collections (eg, rdf, rdfs, owl) define general, structural relations. These are used pretty universally, though it's common to pick and choose among owl subsets. Other pre-defined collections (eg, bibo, core, foaf) define topical relations of use in particular domains of discourse. For example, foaf contains relations pertaining to human interactions, while bibo and core handle bibliographic information.

If the relevant pre-defined collections of triples don't cover everything (or cover them in the desired manner), an ontology may define some local, structural triples. Finally, after the ontology is loaded into a triplestore, it will be "populated" by instances (eg, "Berners-Lee knows Hendler"):

Visualizing RDF and OWL data models - posted at Tue, 20 Oct, 13:52 Pacific | «e» | TrackBack


Post a comment

Note: All comments are subject to approval. Spam will be deleted before anyone ever sees it. Excessive use of URLs may cause comments to be auto-junked. You have been warned.

Any posted comments will be viewable by all visitors. Please try to stay relevant ;-) If you simply want to say something to me, please send me email.