Typically people think of RDF as graph. But it is actually a subject of research on how to represent RDF as formal Graph.

I will show examples of RDFs and how they would be represented as formal graph if we do naive “transformation”.

See: A Comparative Study on Representing RDF as Graph and Hypergraph Data Model.

Directed graph

RDF

:a → ex:1 → :b
:c → ex:1 → :d

Graph

flowchart LR
	:a --> ex:1 --> :b
	:c --> ex:1 --> :d

Not quite what we want - we can’t distinguish that there is no connection between :a and :d.

Directed labeled graph

RDF

:a → ex:1 → :b
ex:1 → ex:2 → :d

Graph

flowchart LR
	:a -- ex:1 --> :b
	c[ex:1] -- ex:2 --> :d

Not quite what we want - we can’t use label as start (or end) of an edge.

Bipartite graph

See: Bipartite Graphs as Intermediate Model for RDF-star, Inductive Triple Graphs: A purely functional approach to represent RDF

RDF

:a → ex:1 → :b
ex:1 → ex:2 → :d

Graph

flowchart LR
	classDef red fill:red
	classDef blue fill:blue
	e1:::red
	e2:::red
	:a:::blue
	:b:::blue
	:d:::blue
	x:::blue
	y:::blue
	e1 -- s --> :a
	e1 -- p --> x[ex:1]
	e1 -- o --> :b
	e2 -- s --> x[ex:1]
	e2 -- p --> y[ex:2]
	e2 -- o --> :d

Some observations:

  • it is bipartite graph
  • but also directed labeled graph with only three labels:
    • s - subject
    • p - predicate
    • o - object
  • It is also visually reminds standard RDF reification
  • but it looks nothing like what original RDF “graph”

Directed hypergraph

See: Directed hyper-graphs for RDF documents

To be precise it is 3-unifor F-hypergraph with additionally defined function(s), which tells which node is subject, object and tail (on the graph I use edge labels to denote this, but this is for visual purposes only, this is no labeled graph)

RDF:

:a → ex:1 → :b
ex:1 → ex:2 → :d

Graph:

flowchart TD
	:a -- s --- e1( ) -- o --> :b
	ex:1 -- p --- e1
	ex:1 -- s --- e2( ) -- o --> :d
	ex:2 -- p --- e2( )

as bipartite graph

flowchart TD
	classDef red fill:red
	classDef blue fill:blue
	e1:::red
	e2:::red
	:a:::blue
	:b:::blue
	:d:::blue
	x:::blue
	y:::blue
	:a -- s --> e1 -- o --> :b
	x[ex:1] -- p --> e1
	x[ex:1] -- s --> e2 -- o --> :d
	y[ex:2] -- p --> e2

The Labeled Directed Multigraph with Triple Nodes (LDM-3N)

See: A Formal Graph Model for RDF and Its Implementation

RDF:

:a → ex:1 → :b
ex:1 → ex:2 → :d
flowchart LR
	:a --"e1(I)"--> ex:1 --"e1(T)"--> :b
	ex:1 --"e2(I)"--> ex:2 --"e2(T)"--> :d

RDF triple is splitted into two labeled edges - they get same unique suffix and one of two suffixes: I stands for initial, T stands for terminal.