Resources and Objects: RDF and OOP talk about different things

Here’s a thing that I think has been at the root of some long discussions that I have been involved in where people involved in modelling data just don’t seem to agree on what goes in to a domain model, or on fine details of definitions. If it seems wrong or trivial to you, I’ld really appreciate any comments along the lines of ‘nope, you’ve misunderstood that …’ or ‘nope, everyone knows this and works around it, the disagreement must have been about something else’.

What I’m thinking causes these long discussions is that RDF and Object Oriented modeling methods (e.g. UML) talk about different things with the same terms. The resulting confusion is somewhat like a speaker of British English asking for something to be tabled in a meeting with folk from the US only to be mystified and offended when it is ignored

table transitive verb

1 a [US] to remove (something, such as a parliamentary motion) from consideration indefinitely
b British to place on the agenda

Merriam-Webster dictionary definition of table

RDF starts with resources, which are the things being described. Although identified with web identifiers (URIs, IRIs) they can be concrete objects, concepts, imaginary beings, in fact “anything that can be identified”. A relationship between a resource and something else can be asserted as being a property of the described resource. Resources of the same type can be grouped into classes so that a property can be associated with all instances of that type of resource. For example, in schema.org resources of type Person have a property name that is a string.In RDF terms I am a resource identified by <http://people.pjjk.net/phil#id> of type <http://schema.org/Person>. I am an instance of a <http://schema.org/Person>. Note that while I am identified by a URI you cannot retrieve me via that URI, instead you get sent a different resource with a different URI, that is a description of me.

Object Oriented methods start with objects, which are constructs that live only in information systems; the most important type of object in metadata contexts is a data object that is a description of something. Objects of the same type can be created through the definition of a class that defines the properties and methods of a type of object. While it is common practice to name object classes after the real-world thing that they represent, e.g. Person, when we create an object instance of such a class we do not create a person in the real world. The identifier for an object instance of type person is the identifier of the artifact in the computer.

So in RDF we have real things and write descriptions of them; in object oriented methods we have data things that we define. But we use terms like class, type, object, resource, instance when talking about both.

Context and shared understanding within communities is enough to avoid confusion between RDF and Object Oriented terms most of the time, but in JSON-LD they collide. In JSON-LD I can express the information about myself provided above as a description about me, or in terms of the W3C web architecture a representation of me.

{ "@context": {
        "sdo": "http://schema.org/"
    },
    "@id": "http://pjjk.net/phil#id",
    "@type": "sdo:Person",
    "sdo:name": "Phil Barker",
    "sdo:url": "http://blogs.pjjk.net/phil/about/"
}

This translates to RDFXML as

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:sdo="http://schema.org/"
>
  <rdf:Description rdf:about="http://pjjk.net/phil#id">
    <rdf:type rdf:resource="http://schema.org/Person"/>
    <sdo:url>http://blogs.pjjk.net/phil/about/</sdo:url>
    <sdo:name>Phil Barker</sdo:name>
  </rdf:Description>
</rdf:RDF>

I could represent the UML class diagram for the JSON data object as something like: I could represent the UML class diagram for the JSON data object as something like:Note that @id and @type, which identify and provide a type for the JSON node, refer to objects in the real world for RDF.

Why does this matter? Well, it’s one thing to say that you like/don’t like me, it’s another to say that you like/don’t like a description of me. It’s one thing to make a copy of a description of me, another to make a copy of me.  We can make descriptions of things in RDF and make assertions about things in RDF, but if we say that a thing in our RDF model is a Description of Assertion, then we had better have a reason for wanting to be so meta as using RDF to make descriptions of Descriptions and assertions about Assertions. But when someone suggests that an RDF model should have PersonDescription in a oval in place of Person, maybe they really want a PersonDescription in box in a different type of entity relationship diagram.

1 thought on “Resources and Objects: RDF and OOP talk about different things

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.