W3C home > Mailing lists > Public > public-linked-json@w3.org > July 2013

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

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Fri, 5 Jul 2013 12:02:45 +0200
To: <public-rdf-wg@w3.org>
Cc: <public-linked-json@w3.org>, "'Andy Seaborne'" <andy@apache.org>
Message-ID: <00cc01ce7966$cd0fe880$672fb980$@lanthaler@gmx.net>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:38 UTC