Best practices for adding semantics to a website

I understand that every URI should represent a ressource. I assume that all information provided by RDFa inside a webpage describes the ressource represented by the URI of that webpage.

Well, a HTTP URI could identify the page itself OR the thing the page is about. You can’t tell if an URI identifies the page or the thing by simply looking at it.

Example (in Turtle syntax):

<http://en.wikipedia.org/wiki/The_Lord_of_the_Rings> ex:author "John Doe"

This could mean that the HTML page with the URI http://en.wikipedia.org/wiki/The_Lord_of_the_Rings is authored by “John Doe”. Or it could mean that the thing described by that HTML page (→ the novel) is authored by “John Doe”. Of course this is an important difference.

There are various ways to differentiate what an URI represents, and there is some dispute about it. The discussion around this is known as httpRange-14 issue. See for example the Wikipedia article Web resource.

One way is using hash URIs (see also this answer). Example: http://magma.com/play/42 could identify the page about the play, http://magma.com/play/42#play could identify the play.

Another way is using HTTP status code 303. The code 200 gives the representation of the page about the thing, the code 303 See Other gives an additional URI identifying the thing. This method is used by DBpedia:

  • http://dbpedia.org/resource/The_Lord_of_the_Rings represents the novel

  • http://dbpedia.org/page/The_Lord_of_the_Rings represents the page about the novel

    (resp. http://dbpedia.org/data/The_Lord_of_the_Rings for machines)

See Choosing between 303 and Hash.

Now, when using RDFa, you can make statements about both, the page itself and the thing represented by the page. Just use the corresponding URI as subject (e.g., by using the resource attribute).

So let’s say http://magma.com/#magma represents the theater group. Now you could use this URI on every page (/contact, /play/, …) to make statements about the group resp. to refer to the group.

<div resource="http://magma.com/#magma">
  <span property="ex:name">Magma</span>
</div>

<div resource="http://magma.com/">
  <span property="ex:name">Website of Magma</span>
</div>

Leave a Comment