W3C home > Mailing lists > Public > public-hydra@w3.org > July 2014

RE: Please help with JSON-LD processing

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Thu, 10 Jul 2014 13:32:13 +0200
To: <public-hydra@w3.org>
Message-ID: <05ff01cf9c32$9939e5c0$cbadb140$@gmx.net>
-CC public-linked-json as this isn't really about JSON-LD anymore

On 9 Jul 2014 at 21:55, Tomasz Pluskiewicz wrote:
> On Wed, Jul 9, 2014 at 6:07 PM, Markus Lanthaler wrote:
>> On 9 Jul 2014 at 10:49, Tomasz Pluskiewicz wrote:
>>> var resource = hydra.$get('/some/resource', context /* optional */ );
>>> 
>>> var links = hydra.$links(); links['http://some/link/propety'].$get();
>>> 
>>> var operations = resource.$operations();
>>> operations['http://some/OperationType'].$invoke()
>> 
>> Do not forget that a representation can contain information about
>> multiple resources. Think of the representation of a collection.
>> There's not only the collection itself but also a number of members
>> of that collection and each of them can support various
>> links/operations.
> 
> That's a good point. Each resource contained in a representation
> should get equal processing treatment to discover the links
> operations. In fact each such resource should be a separate JavaScript
> object, so if they are shared, they are accessed be reference. Also as
> a client I would expect the JSON object to always contain the actual
> requested resource as the tree's root, regardless of how the raw
> response was structured.

Yeah. The application shouldn't really have to care how the response was structured. It is just interested in the data that was returned.


> I know there is a work item for an 'objectify' operation [1]. Does it
> intend to achieve a similar goal when implemented?

Kind of. Objective turns the data contained in a JSON-LD document into a JavaScript object graph that you can navigate in-memory.


>>> I expect the $get() and $invoke() methods on links and operations to
>>> allow optional parameters such as template params or operation body.
>>> 
>>> Does this make sense?
>> 
>> Yep. There *probably* also needs to be a way to find out what parameters
>> are available. 
> 
> I think I know what you mean, but could you please elaborate. Are
> there some edge cases you are concerned about?

No, there aren't any edge cases I'm concerned with but an application might need to know what data it has to supply to the client. So something like

   operations['http://some/OperationType'].getExpects()

would probably be helpful to find that out.


Please keep us posted on your progress



--
Markus Lanthaler
@markuslanthaler
Received on Thursday, 10 July 2014 11:32:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:29:42 UTC