Convert also "partial" lists from RDF to JSON-LD

CC'ing public-linked-json as this discussion might result in a change to the
algorithms and may help the OpenAnnotation people.


On Thursday, July 04, 2013 10:21 PM, Andy Seaborne wrote:
> The set of all heads of well-formed lists can be found quite easily.
> 
> All lists have a common tail (rdf:nil).  Just walk back up the list
> checking nodes have exactly one rdf:first and one rdf:next triple.
> This generates the list head.

You are of course right and the necessary changes to the algorithm should be
quite small.

Currently a @list can never be the value of a rdf:first/rdf:rest. This kind
of ensures that only "complete" lists are transformed to @list and that we
don't produce lists of lists in JSON-LD.

An example might clarify what I mean. Currently we would never produce
something like

  {
    "@id": "http://example.com/",
    "rdf:first": "A",
    "rdf:rest": { "@list": [ "B", "C", "D" ] }
  }

all the list bnodes would be preserved:

  [
    {
      "@id": "http://example.com/",
      "rdf:first": "A",
      "rdf:rest": { "@list": [ "B", "C", "D" ] }
    },
    {
       "@id": "_:b0",
       "rdf:first": "B"
       "rdf:rest": { "@id": "_:b1" }
    },
    ...
  ]


Arguably changing that would result in a nicer result. This might also be a
quite elegant solution for the OpenAnnotation people. I think we could
threat this change as an algorithmic bug fix (meaning, no need for another
LC).

I've created ISSUE-277 for this:
  https://github.com/json-ld/json-ld.org/issues/277


Thoughts?


--
Markus Lanthaler
@markuslanthaler

Received on Friday, 5 July 2013 10:03:46 UTC