Re: Conversion of lists of lists to JSON-LD

On May 1, 2013, at 11:24 AM, Markus Lanthaler <markus.lanthaler@gmx.net> wrote:

> The current algorithms in the JSON-LD spec do not support the conversion of
> list of lists to JSON-LD. This is a "Feature at risk" [1].
> 
> I've just updated my implementation to support the conversion of lists of
> lists. The nested lists don't use the @list-construct because that would
> result in invalid in JSON-LD. Instead they remain simple nodes with
> rdf:first/rdf:rest properties.

That seems like the right approach.

> I also fixed a number of other bugs, e.g., properties other than
> rdf:first/rdf:rest are being lost for list nodes in the currently specified
> algorithm. It also converts lists identified by a IRI and thus looses the
> IRI.

This seems wrong to me. The RDF Collection syntactic sugar in all other serializations requires that the list be well-formed, and have all BNode subjects. If a list is not well-formed, has anything other than a BNode subject, or contains properties other than rdf:first and rdf:rest (and possibly rdf:type of rdf:List), it should not use the list syntax, but should revert back to basic object representation, IMO.

Gregg

> The new algorithm is, IMO at least, simpler than the current one. It's not
> dramatically different but I've, e.g., got rid of the list map and instead
> navigate the node map directly. If you are interested, you can find the diff
> at [2].
> 
> Unless someone objects, I will update the algorithm in the spec and add a
> couple of test cases.
> 
> 
> [1] http://www.w3.org/TR/json-ld-api/#convert-from-rdf-algorithm
> [2]
> https://github.com/lanthaler/JsonLD/commit/80d7cbdd65b6a6f2e5e02a3e5e14db36a
> 06655e6
> 
> 
> Cheers,
> Markus
> 
> 
> 
> --
> Markus Lanthaler
> @markuslanthaler
> 
> 

Received on Wednesday, 1 May 2013 19:52:37 UTC