Tim Berners-Lee
Date: 2017-11-05 $
Status: personal view only. Editing status: first draft. A little point which sometimes needs careful explanation.

Up to Design Issues


When use a literal for a URI in Linked Data


This note assumes a familiarity with linked data, including the RDF model, and the Turtle (i.e. N3) language.

The RDF model uses URIs a identifiers for things and concepts. So when we say in Turtle

      ex:Joe a foaf:Person;
             foaf:name "Joe Meadows".

that is short for
      <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
      <https://example.com/people#Joe>  <http://xmlns.com/foaf/0.1/name> "Joe Meadows" .

URIs are the symbols in our language. We use often many different URIs to name the same thing. For example, two different databases may have different information about the same person.
      <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

      <https://uni.edu/students#JRMeadows>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uni.edu/vocab#Student> .

It gets interesting of course when we learn the fact that they are the same. We can write that fact traditionally as
      <https://example.com/people#Joe>   owl:sameAs      <https://uni.edu/students#JRMeadows> .

An RDF system which has all these triples can now, if it wants to, normalize its data to use the same URI for Joe in all the data.
      <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

      <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uni.edu/vocab#Student> .

or as we would write in turtle shorthand
       ex:Joe a foaf:Person, uni:Student .

This is all basic RDF inference from owl:sameAs.

Now let's add a triple, where Joe notes in his Example.com profile that actually the URI he prefers to be known by is his university one. He adds to his profile:

      <https://example.com/people#Joe>   contact:preferredURI      "https://uni.edu/students#JRMeadows" .

Note that in RDF the URI is added as a string literal, "https://uni.edu/students#JRMeadows", not as a symbol <https://uni.edu/students#JRMeadows>. This is because we are talking about the string itself, not the person. You can think of the < and > signs around the URI in turtle meaning that identified by.

Lets see this works when the data is all smushed together, so that Example.com URI is used as the symbol for Joe whenever there is information about him. We get:

      <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

      <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uni.edu/vocab#Student> .

      <https://example.com/people#Joe>   contact:preferredURI      "https://uni.edu/students#JRMeadows" .

aka
    ex:Joe a foaf:Person, uni:Student;
       foaf:name "Joe Meadows";
       contact:preferredURI "https://uni.edu/students#JRMeadows".

This works. Even though whenever it is used as a symbol, https://example.com/people#Joe is replaced with https://example.com/people#Joe, when it occurs quoted as a literal string value, it is not. Which is important, otherwise Joe's preference gets lost.

If you try do this with a symbol, if you let Joe's profile look like this (wrong):

    <https://example.com/people#Joe>   contact:preferredURI      <https://uni.edu/students#JRMeadows> .

then when everything is smushed onto one symbol, you get
  <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

  <https://example.com/people#Joe>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uni.edu/vocab#Student> .

  <https://example.com/people#Joe>   contact:preferredURI      <https://uni.edu/students#JRMeadows> .
which is completely wrong. In shorthand turtle you can see it looks wrong, as
ex:Joe a foaf:Person, uni:Student;
   foaf:name "Joe Meadows";
   contact:preferredURI ex:Joe.
When you use RDF, we get used to using URIs a symbols so much that we can slip up and accidentally use it that way on one of the very rare occasions on which we are not talking about the thing the symbol represents, we are talking about the URI itself as a string. Hence this whole DesignIssues note just to make the point.

Up to Design Issues

Tim BL