RE: JSON-LD: Skipping keys, but parsing their contents

On Monday, December 16, 2013 10:15 AM, Alexander Dutton wrote:
> On 15/12/13 12:16, Markus Lanthaler wrote:


[...]

> > The other trick you need to use is to map "_links" to a blank node
> > and set its container to @index so that doesn't get ignored. The
> > triples containing blank nodes as predicate are discarded (unless you
> > set a special flag) by default when converting to RDF. Your document
> > would then look as follows:
> >
> > […]
> 
> That's a clever hack, but means that when it comes to HAL's "_embedded",
> properties of the linked resource won't make it in. (I should probably
> have mentioned that part at the beginning).

You can the same trick there. Map "_embedded" to a blank node, assign it an @index container and add an @id to the embedded objects.


> > Is assume this is what you wanted to achieve, right? It would be
> > much simple though to just ignore the _links property altogether and
> > duplicate the links directly in the object itself:
> 
> I hadn't considered that level of duplication, but yes, that'd work.
> 
> Given the triviality of turning a HAL document into a JSON-LD document,
> I reckon the best way forward would be to use HAL as the primary
> representation and convert to JSON-LD as required.

I think the question is what you are trying to achieve resp. what the constraints are under which you are operating. I personally don't like the separation of properties whose values are URLs from other properties but that's mostly a matter of taste. Similarly, moving "embedded" resources into a different subtree might be suboptimal in some cases.


--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 17 December 2013 13:51:23 UTC