RE: Please help with JSON-LD processing

+CC public-hydra


On 8 Jul 2014 at 23:16, Tomasz Pluskiewicz wrote:
> On Stackoverflow [1] Dave gave me some advice about how a client would
> either expand or use a well-known context to compact a resource
> representation to inspect its contents.
> 
> I intend to implement a Hydra client,

That's great!


> which would allow passing a well-known context.

What do you mean by this? Do you mean a client which can be "configured" by passing it a context?


> Now I'm wondering what is your suggested algorithm to process the
> resource to discover hydra:Links and hydra:Operations.

It depends on what exactly you are trying to achieve. The Hydra console [2] does everything by just using JSON-LD that is framed by a proxy [3]. An alternative would be to convert everything to triples and put it in a triple store (client side) that can be queried to get the hydra:Links/Operations of interest.


> 1.Would you keep an expanded/flattened document for processing and a
> compacted to return to the client?

Keep it where?


> or
> 2. Would you only keep the compacted document and use the
> processContext() method to expand any prefixed URIs?

No, I definitely wouldn't hack into the processContext method.


> [1] http://stackoverflow.com/questions/23996953/json-ldhydra-link-discovery
[2] https://github.com/lanthaler/HydraConsole
[3] https://github.com/lanthaler/HydraConsole/blob/master/proxy.php#L95-L143



--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 8 July 2014 22:12:29 UTC