BiRel ⇌ RDF: Typed Grothendieck
In Bicategories of Rel ¶ 6.1 "Relation Databases" shows how one can model a database instance D as a functor, from a small relational olog B (a small 2-category playing the role of an ontology, that has some key properties of Rel)
D: B \to Rel
In ¶6.2 "Graph databases" it is shown that each such functor gives rise to a new Bicategory of Relations via the Grothendieck construction \int_B
.
- The objects of
\int_B
are pairs(X,x)
whereX \in B
andx \in D(X)
- the morphisms
(X,x) \to (Y,y)
, are the morphisms inB
R: X \to Y ~\text{such that}~ x D(R) y
This can be seen to be have a structure very similar to that of RDF, and a similar point is made by Spivak in the articles linked to from Patterson's paper. In Spivak the Grothendieck construction is one arising out of a functor from a small category, also playing the role of a schema, to Set. This does not map so nicely to RDF because the morphisms between objects in Set are functions, so that in Spivak's modelling one would not be able to directly express one to many relations such as we have with foaf:knows
(there are other indirect ways to achieve this using Kleisly Database Instances or spans of morphisms A \gets C \to B
).
But we now have the following problem: every object in \int_B
is typed and relations are between typed objects. So for example if one had a schema with types foaf:Person
and foaf:Agent
and an instance DB containing Tim Berners-Lee, one would have objects (Person,timbl)
and (Agent,timbl)
. Yet in RDF we can have statements like
timbl a foaf:Person, w3c:Director .
ie one object can be part of multiple sets/types. How do we map these constructs to RDF?