Skip to content

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

@lanthaler

Description

@lanthaler

_This came up in a discussion with @afs:_

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": { "@id": "_"b0" }
  },
  {
     "@id": "_:b0",
     "rdf:first": "B"
     "rdf:rest": { "@id": "_:b1" }
  },
  ...
]

(edit: fixed second example)

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).

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions