RDF graphs

TL;DR

Visualizing RDF graphs is useful when you need to present your RDF data, highlight specific patterns, understand its structure, or debug it. To see it in action, you can play with the example RDF graph visualization below or automatically create one for your own RDF data.

Introduction

The Resource Description Framework (RDF) provides a unique way to capture/represent information. In this model, the information is built up from subject–predicate–object triples, each acting as a statement/fact that connects the subject and the object through the predicate.

RDF is used in a variety of applications, including the Semantic Web, knowledge graphs, data integration, and data exchange/interchange. It is really good for highly interconnected data such as social networks and the Internet of Things (IoT) device networks.

RDF datasets are graphs

Here's an example of a small RDF dataset expressed in the Turtle syntax:

@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

ex:John foaf:knows ex:Mary .
ex:Mary foaf:knows ex:Tom .

This dataset consists of two facts: John knows Mary and Mary knows Tom. Intuitively, the dataset represents a social network (a graph) involving three people/resources who are connected to each other through two foaf:knows relationship.

Visualizing RDF graphs and building the demo

The graph "feature" of RDF makes it a natural fit for visual presentation and exploration. Even if you draw them by hand, RDF graphs are very helpful when you want to demo your data or highlight specific patterns.

With this in mind, I went on to explore the ways to visualize RDF graphs automatically and in the end, built the prototype of an RDF graph visualization tool (see below).

In the demo below, I'm using the N3.js library for parsing the input Turtle and d3-force for running force simulations to lay out the graph. The graph algorithm runs in a web worker to keep the UI responsive. You can use cooperative gestures to pan and zoom the graph.

Demo: RDF graph visualization tool

The RDF dataset to visualize.
Graph
Use ⌘ + scroll (ctrl + scroll) to zoom the graph
Use two fingers to move the graph

See also

Made by Anton Vasetenkov.

If you want to say hi, you can reach me on LinkedIn or via email. If you like my work, you can support me by buying me a coffee.