- From: Dave Longley <dlongley@digitalbazaar.com>
- Date: Thu, 03 Nov 2011 15:14:51 -0400
- To: public-linked-json@w3.org
Or you could just omit the @subject entirely and have your server populate it for you. It is perfectly legal JSON-LD to not specify a @subject. Then your client can either grab the Location header or do a GET to get the full document. On 11/03/2011 02:11 PM, Gregg Kellogg wrote: > 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 >> > -- Dave Longley CTO Digital Bazaar, Inc.
Received on Thursday, 3 November 2011 19:15:26 UTC