Dec 05 2007

303 Asymmetry

Published by Ian Davis at 1:54 am under Uncategorized

I mentioned a while back that I wanted to talk more about the descriptions vs representations issue. A recent message by timbl provided the impetus to do so. In that message he says the following:

Try thinking of it this way instead. You are going to serve some representation on the web, for this thing. Are those going to be (a) ABOUT the thing, or (b) the CONTENT of this thing denoted by the URI? If the former, you must use # or 303. If the later, you can serve the representations with 200 from that URI. You see, 200 means (basically) “Here comes the content of the document you asked for” and 303 means “Here is the URI of document ABOUT the thing you asked for.

That seems a pretty good characterisation of the 303 decision. Information resources can serve up representations of themselves, other resources cannot so you have to make do with descriptions. (Regular readers will already know that I don’t fully agree with this model, but it’s the accepted one in the SemWeb community)

There appears to be an asymmetry about this though and I think it’s a limitation of the model.

Suppose I have a resource “R” with URI http://example.org/R. If it is an “Information Resource” then I can arrange things so that a GET request for its text/html representation responds with a 200 and the HTML in the body of the response. I could also arrange for a request for its application/rdf+xml representation to respond with a 303 status and the URI of another information resource “RDESC” (e.g. http://example.org/RDESC). In this example the 303 response meand that “R” cannot be represented as RDF, but there’s an alternative RDF document that is a description of R. The user can then re-issue the request on http://example.org/RDESC to obtain that description.

Now, I can arrange for http://example.org/RDESC to return an RDF representation in a 200 response. But, here’s the asymmetry. How can I allow the user to obtain a description of RDESC? The representation I send back is the content of RDESC, not its description. I can’t use the media type to distinguish the type of request any more.

In case you think this is an artificial distinction, it’s not. We’re dealing with it right now at Talis (and have been for a number of months). We give access to a number of RDF graphs via HTTP where naturally the user wants to obtain the content of the graph as the response to a GET. We also serve RDF descriptions of those graphs containing some configuration information. There’s no standard way to link the two things together so that users can select either the description or the content using HTTP.

Now, I happen to think that there is an interesting solution to this asymmetry. Suppose we created a new HTTP header called “resource-description” whose value was the URI of a description of the given resource. Note that it’s a description of the resource, not of any representation that is being sent as part of the response. The asynmmetry goes away because this gives you a method of pointing to the description regardless of the status code and/or content negotiation going on in the request.

Things get even more interesting if you allow multiple resource-description headers: what a great way to cross link to other people’s descriptions of your resource.

I seem to recall something similar to this being proposed a few years back but my Googling doesn’t turn anything up. Going back further takes us to Patrick Stickler’s attempts to solve the description problem using URIQA, which took the approach of introducing another verb, MGET, to obtain the description. This was almost universally disliked, but the underlying problem has remained unsolved in the meantime.

And given where my head has been for the past few weeks, I have to ask what decision would have been taken on the httpRange-14 issue if this header had already existed. Would instead we be returning 406 responses when we cannot supply a suitable representation for resources, or even a 204. Both of those could work with the header pointing to an appropriate description of the resource.

Update: it seems that timbl and I were touched by the same muse tonight: Alternative to 303 response: Description-ID: header

5 Responses to “303 Asymmetry”

  1. Simon Reinhardton 05 Dec 2007 at 7:01 am

    >> I seem to recall something similar to this being proposed a few years back but my Googling doesn’t turn anything up.

    Ian, I think what you were looking for is http://esw.w3.org/topic/LinkHeader .

  2. Ed Davieson 05 Dec 2007 at 12:34 pm

    Ian,

    There was an earlier discussion on the TAG list about this. My question:

    http://lists.w3.org/Archives/Public/www-tag/2007Aug/0075.html

    and TimBL’s reply:

    http://lists.w3.org/Archives/Public/www-tag/2007Aug/0089.html

    It looks like everybody comes up with a slightly different idea for the details of the header(s) but we’re all thinking basically the same thing.

    As to whether they’d have come up with 303 if some such header had existed - I don’t know. But use of 303 and such headers are not exclusive, though combination would perhaps be a bit more complicated than absolutely necessary.

    Ed.

  3. Richard Cyganiakon 05 Dec 2007 at 1:32 pm

    Why not embed the description of RDESC into RDESC? Or publish it as a separate document and link to it from RDESC? After all, RDESC is a document whose content we can GET, unlike R.

    (I realize that you are looking for solutions at the level of web architecture. I just want to point out that there are simple yet limited fixes that work today, and perhaps would work well in the Talis scenario you describe above.)

  4. Tore Erikssonon 06 Dec 2007 at 12:09 am

    (Reposting since the previous post had the markup removed. Please delete it if possible.)

    My non-kosher solution:

    GET /R HTTP/1.1
    Host: example.org
    Accept: application/rdf+xml

    HTTP/1.1 200 OK
    Content-Location: http://example.com/RDESC
    Content-Type: application/rdf+xml

    <?xml version=”1.0″?>
    <rdf:RDF>
    <!– data about R/a representation of R in RDF –>

    <!– data about RDESC in RDF –>
    <rdf:Description rdf:about=”">
    <!– has the BaseURI (http://example.org/RDESC) as subject –>
    <rdfs:comment>The RDF document.</rdfs:comment>
    <dc:creator>Ian Davis</dc:creator>
    </rdf:Description>
    </rdf:RDF>

    I know this is NOT what the TAG recommends, but I still can’t see any semantic problems with this approach. Maybe I think too much in REST terms, but I do not have any problems with serving representations where the information content differs, as the mime-type says what sub-part of information the representation contains.

    Tore

  5. Ed Davieson 06 Dec 2007 at 10:32 am

    P.S:

    In a message on the TAG list you wrote:

    “Yes. We better hurry up and get the link header through the ietf - there
    are more and more uses for it every day :)”

    I fully support that.

    I rather like TimBL’s N3 header for power but any sensible design’s better than ignoring the matter and having a heap of kludges with content negotiation and so on crop up.