Skip to main content
1 of 8
Henry Story
  • 595
  • 2
  • 13

What does the category of RDF models look like in Institution Theory?

The RDF1.1 semantic spec comes with a simple model discussed in a previous Stack Exchange question. The aim of this question is to see how that can be brought into the larger space of Category Theoretical Institutional Theory started by the famous computer scientist Joseph Goguen. The longer term aim is to make sense of modal logic in RDF. For a list of academic papers on Category Theory and RDF as well as institutional theory and modal logic see RDF and Institution Theory (IT) message on ncatlab. These papers are good at locating things in the abstract framework, but don't even get into the detail of what the RDF Models are. I just want to make sureI understand correctly what is going on by developing some simple examples.

So here is a simple example Model written out in the structure presented by the RDF1.1 semantic spec. (As we will see a bit further below this can be made a lot easier to understand with arrow diagrams) We need a set of Resources IR, and Predicates IP, so I chose a simple example with 6 objects in IR, 5 Properties in IP and 4 types of relations on IR

Illustration of model as described by RDF 1.1 Semantics spec

I start with predicates in terms of colors to emphasize that we are dealing with models here. Later we move on to syntax, and so it will be natural to have names for the colored arrows. Initially we just want to say the world contains distinctions. Here the colors represents type of relations, grey {0} for is "older than", dark green {1,3} for "shook hands", light green {2,4} for "knows", pink {5,6} for the relation relating a person to a statement written on their T-Shirt, and light blue {7,8} relating a person to their name (another literal).

We have shown in a previous Stack Exchange question that way of writing things to be isomorphic to the following definition of $RdfModel$

$RdfModel = \mathscr{P}(IR \times IP \times IR)$

So that we can redraw the above diagram in the much clearer category theoretical diagramatic style. We can justify this mathematically because Category Theory defines a Quiver - which other call a Graph, and other call a Directed Graph - as two sets A and N and two functions $domain$ and $codomain$ such that

$domain, codomain: A \to N$

Clearly we have these here since the first projection of $RdfModel$ could be thought of as the $domain$ and the third projection as the $codomain$ function. Note also that every Quiver gives rise to a free category.

What models add to a Quiver is that it can state that a number of arrows have the same type, which we express here by giving arrows colors.

an RDF Model as explained by W3C RDF1.1 spec

This image of Vint Cerf shaking hands with Tim Berners-Lee should make it more intutive, and help show why this is useful, as it helps us describe things like Tim meeting Vint.

Vint Cerf And Tim Berners-Lee

As practical semanticist we like to have non set elements in the sets of our Models to describe practical stuff like that, and that is fine: we have a category of Sets with Ur-elements we can work with.

Ok, that is for an illustrated background.

Now given that any graph is a subset of $IR \times IP \times IR$ we can draw up a simplified version of the relation between all such models using just the subset Partial Order that stems from such a set of subobject (Category Theory's generalisation of the notion of subsets - do we need to generalise? Who knows: it could be useful...). Because this works with powersets and these quickly explode in complexity I have limited myself to 4 elements of IR, to real objects and 2 literals, and 2 types of relations: "older than" and "has name".

category of subset ordered rdf models

In yellow above are all the graphs that describe the actual world. In light blue we have different possible worlds/models (I may be able to have different shades for different incompatible possible worlds there). The biggest graph before Top J7 models worlds where Tim and Vint have the same age, worlds which presumably would require quite a lot of change to the actual one - some complex scenario involving Vint being frozen for over a decade or so before being born... In pink we have models that we don't really want to allow at all, such as model X1 which relates Tim to Vint by the name relation (but Vint Cerf is a person not a name). RDFS and Description Logic Based OWL vocabularies allow one to exclude those as models, but I think the basic RDF framework does not.

This brings us to Institution Theory. The few articles on RDF and Institution Theory (IT) explain as any IT intro does that an institution consists of

  1. a category of $Sig$ of Signatures $\Sigma$: For our example we could have a ground graph signature $\Sigma$ containing only a small subset of IRIs and some literals to correspond to the objects in our model. (No existential quantifiers (aka blank nodes) for example). IRIs are just the web equivalent of mathematical symbols, designed so that people can globally coin new symbols without fearing a name clash. They stand for International Resource Identifiers and are specified syntactically by RFC3987. IRI ⊇ URI ⊇ URL ∪ URN
  2. a functor $Mod$ from $Sig^{op}$ to $Cat$ the category of categories selecting for each object in the category $\vert Sig \vert$ a category of models. So I guess that a signature with 4 IRIs and 2 literals can give us a signature to the category of Partially ordered models I drew above.
  3. a functor $Sen$ from $Sig$ to sets of Sentences in $Set$ (here we need no ur-elements I think, since we can encode the Unicode alphabet with the empty set and sets thereof)
  4. A relation $\models_\Sigma \space \subseteq \vert Mod(\Sigma) \vert \times Sen(\Sigma)$

But those papers don't really tell me what such a category of models is. So that's what I am trying to make sure I have understood correctly with the simple example given above.

Now, IT does not state what their set of sentences look like. RDF has so many different syntaxes (RDF/XML, NTriples, Turtle, JSON-LD, ...) to cater to the different (at times religious) fashions that it would be silly to put real syntactic sentences there. Better have sets of Abstract Syntax Graphs as our sentences. As it happens those look very much like our models. If we can distinguish just IRIs and Literals types as defined by IETF and W3C, and just define the type

$GNode = IRI+Literal$

We may want to specialise this to a signature $\Sigma$ which only contains a subset of IRIs and Literals needed for a model (as the RDF1.1 Semantic web syntax hints at in Appendix B: Finite Interpretations). So we could have $\Sigma_{IRI}$ to refer to the set of IRIs used by that signature, $\Sigma_{Literal}$ to refer to the set of Literals used by that signature and $\Sigma_{GNode}$ to refer the disjoint union of the IRIs and Literals of that signature.

Then we can define the type of (syntactic) RdfGraph for a signature as

$Sen(\Sigma) = \mathscr{P}(\Sigma_{GNode} \times \Sigma_{IRI} \times \Sigma_{GNode}) $

which clearly is a subcategory of our Models. It would be interesting to regard that indeed as a category, in which case we could get from those to the Set required by Institution Theory by selecting the set of objects $|Sen(\Sigma)|$ of our signature.

So now I suppose if G7 is the top yellow model in the model Poset category above then given that $ ":" : IRIRef \times String \to IRIRef$

is the append operation on the string component of a IRIRef, and we have defined the strings

foaf = <http://xmlns.com/foaf/0.1/>
timbl = <https://www.w3.org/People/Berners-Lee/card#i>

where surrounding a string with angle brackets turns it into a IRI reference (as opposed to a literal string)

$ G7 \models \text { { timbl foaf:name "Tim Berners-Lee" . }}$

but so does the top green model $J7$ where Tim and Vint have the same age

$ J7 \models \text { { timbl foaf:name "Tim Berners-Lee" . }}$

So I guess now that the category which is the range of the $Mod$ functor - which remember maps each signature $\Sigma$ to a category of models - must be a category with growing number of objects in IR and PR, up to something like infinity. The morphisms in this category would relate one poset category to the next, in a way that is faithful to the poset structure in some way - presumably by keeping the same types of distinctions. (I am not quite sure what this is yet)

If I have got the above right then my questions are:

  • what the smallest such poset is. (The Final or Initial Category?) Clearly we have the emty set at the bottom, but the smallest set is one containing a single arrow. Perhaps one containing one object related to itself by the identity relation a = a or in RDF x owl:sameAs x?
  • The open world assumption, which is a key feature of the semantic web, must come in somewhere here, to make this different from Boolean algebras, so I wonder where? Perhaps from the fact that there are always larger models that a model is related to?
  • A possible world is a maximal consistent model. I wonder how one can select those. (seems like a final object in the category of these model posets would do the trick, as final objects have the property of being fixedpoints: a model where adding a new relation would just give back the same model...)
Henry Story
  • 595
  • 2
  • 13