W3C home > Mailing lists > Public > public-linked-json@w3.org > November 2011

Re: HTTP POST and @subject IRI

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Thu, 3 Nov 2011 14:11:59 -0400
To: Thomas Steiner <tomac@google.com>
CC: Werner Wilms <contact@blue-age.de>, "public-linked-json@w3.org" <public-linked-json@w3.org>
Message-ID: <9B5321CC-5F8F-4C8E-96F1-A4B6C9E916BD@greggkellogg.net>
Another thing you can do is post a JSON-LD using relative IRIs, which then resolve to the base IRI given to the document.

For example, if you state the following:

{
   "@subject": "",
   "@type": "schema:Person",
   "name": "Werner Wilms"
}

It would create a simple graph with a description of a person (waving hands over the @context that defines "schema"). The empty subject is interpreted as a relative IRI resolved against the document base, which is assigned during the POST.

Gregg

On Nov 3, 2011, at 10:58 AM, Thomas Steiner wrote:

> Hi Werner,
> 
>> I'm not sure if this was discussed before, because I subscribed only
>> recently to this list. A (admittingly only short) research in the
>> archive didn't answer my question:
>> 
>> I'm trying to do a HTTP POST for a newly to create subject with a
>> json-ld message from the client to the server.
>> 
>> Unfortunately I have no idea what the identifier of the subject will be,
>> because the server will define it. So I can't give a full IRI yet. What
>> can I do to cope with that? Right now I have my own tool parsing the
>> json, but I want to use one of your API implementations soon, and I
>> guess they won't let me pass without a subject, right? Because you can't
>> build triples without a subject, correct?
> 
> I guess the question is more an underlying REST design principle. This
> article http://www.infoq.com/articles/webber-rest-workflow describes
> the idea quite well.
> 
> Short: you do a POST to a generic resource /things. The server
> responds with a 201 Created response telling you the Location where it
> has generated the actual thing, like /things/123. Then you can use
> this Location as the subject.
> 
> Does this help?
> 
> Best,
> Tom
> 
> -- 
> Thomas Steiner, Research Scientist, Google Inc.
> http://blog.tomayac.com, http://twitter.com/tomayac
> 
Received on Thursday, 3 November 2011 18:13:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:35 GMT