There is something very striking about the similarity in structure between RDF and Category Theory.

  1. The RDF Abstract syntax is a graph, the type known as a Quiver in Category Theory. Every Quiver has a Free Category of that Quiver.
  2. An interpretations can be seen as a functor from the Free Category of a syntactic Quiver to a Universe of interpretation.
  3. That Universe is itself structured very much like a Category: it has objects and arrows between them (which is why a Functor mapping is so attractive).

This parallel is striking, but is it right? What would be the range of the functor? (A Category of Models, or possible worlds?) How does one explain the way RDF constrains the models that can satisfy the Quiver?

Elaboration of the Question

The claims I made above may not be immediately obvious for someone coming either from CT or from RDF, as the main Category that one is introduced to in CT is Set, and the semantic universe to which RDF refers is described as a model consisting not of arrows but of resources IR that are constituted in part of properties which refer to a set $IR × IR$ which does not immediately look like a graph...

The syntax as a Quiver: Benjamin Braatz and Christoph Brandt proposed a Category Theoretic view of RDF in Graph Transformations for the Resource Description Framework that looks mostly at logical transformations through graph transformations. They define an RDF graph consisting of GTRiples as

$GTriple ⊆ (GBlank + URI + Lit) × URI × (GBlank + URI + Lit)$

We can look at this as a Quiver, where a set $GTriple$ represents the edges and the functions $s, t: GTriple \to GBlank + URI + Lit$ take edges to the start and end points, which are the nodes. (This probably is not quite right because blank nodes need to be unique per Quiver).

Below is an updated image from the WebID spec. We see to the left a quiver served by a W3C web server describing Tim. It contains the 3 GTriples that a parser would extract from the following Turtle:

@prefix foaf: <http://xmlns.com/foaf/0.1/> <#i> foaf:name "Tim Berners Lee". <#i> foaf:phone <tel:+1.617.253.702>. <#i> foaf:made <>.

<#i> and <> are relative URLs - relative to the document location in which they appear, which is convenient for helping write things down concisely. In the Quiver they would appear as the full URL <https://www.w3.org/People/Berners-Lee/card#i> and <https://www.w3.org/People/Berners-Lee/card> respectively. The foaf:name is also a notational shortcut for the full URL <https://xmlns.com/foaf/0.1/name>. This can be worked out by a parser by finding a prefix definition for foaf in the document which appears in the first line above.

A published RDF Graph and an interpretation functor (for lack of space only one relation is shown)

As a shorthand in the depiction of the graph/quiver above we name the arrows by the central element of the triple (which is always a URI). But we should think of the arrow as really the full triple including the subject (s) and the object (t). So we really have three arrows ①, ②, ③ each of them triples.

The Interpretation Functor: Since every Quiver generates the Free Category of that quiver, we can use the notion of a functor to map subjects s and objects t to another category, and make sure the arrows follow too. Call such a functor $I$

We see the interpretation of this quiver/graph as the I② arrow in the picture of Tim sitting in his office to the right. That should be understood as the arrow I(<#I> foaf:phone <tel:...>). That is the white arrow going from Tim to his phone. I would like to think of $I$ as the Functor going from the Free Category of that Quiver to the 'real world'.

This would be neat as it would helps explain RDF semantics which is otherwise quite a long standard using terminology widely understood by the CT community. It also shows how close RDF is to categories, which is quite weird and interesting in itself.

The Range of the Interpretation Functor: The RDF Semantics spec does not mention arrows, so we need to do a bit of work to show they are there. They mention a set of Resources R, of which properties $IP \subseteq IR$ which map to subobjects of $IR × IR$. But then we can easily take these properties and create triples from them as follows $\{ \langle s,r,o \rangle | \forall r \in IP, \langle s,o \rangle \in IEXT(r) \}$, which we can think of as our arrows with left and right projections given by $s,t: IR × IR × IR → IR$ . That gives us a Quiver which also generates a Category, so the idea of having the interpretation as a Functor seems very natural.


closed as unclear what you're asking by Matthew Towers, Lord Shark the Unknown, max_zorn, Adrian Keister, José Carlos Santos Aug 31 '18 at 3:23

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Having expressed this question has helped me research if further. In a Tweet conversation B. Braatz pointed me to a paper "Semantic web languages–towards an institutional perspective." which I could try to summarise or at least point to. I have now read that once and understand the outlines of it. $\endgroup$ – Henry Story Sep 1 '18 at 10:53
  • $\begingroup$ I have now refactored the question to be more concise and moved explanatory material to a second clearly distinguished part, now divided into three parts. I think this question it is worth asking the question as it will help make RDF, CT and logical communities aware of each other, and hopefully spur further research. In my research I am exploring Co-algebras, modal logic, SOS, and functional programming. $\endgroup$ – Henry Story Sep 1 '18 at 11:43
  • $\begingroup$ There is a discussion going on in the semantic-web forum of the W3C relating to RDF and the semantic web. lists.w3.org/Archives/Public/semantic-web/2018Sep $\endgroup$ – Henry Story Sep 2 '18 at 13:37
  • $\begingroup$ I have worked out what question I wanted to ask and put it in a new question here math.stackexchange.com/questions/2905226/… . This question is still useful as a background introduction to the problem. $\endgroup$ – Henry Story Sep 4 '18 at 18:28