m-ld-js icon indicating copy to clipboard operation
m-ld-js copied to clipboard

List representation in RDF/JS

Open gsvarovsky opened this issue 2 years ago • 1 comments

Lists in m-ld, using the @list JSON-LD keyword, do not transform to RDF Collections. They are more like RDF Containers (but still, not quite 🙂). Plain RDF Collections don't converge nicely with concurrent edits – more about this in our Semantics poster. If you want to use lists we'll have to consider what to do here.

I read the semantics poster. I can adapt the system to also support the structure m-ld is using. Another idea could be to abstract lists away. Do I see it correct that I could propagate list changes in m-ld specific format, but keep them in my own dataset as a rdf list?

Originally posted by @danielbeeke in https://github.com/m-ld/m-ld-spec/discussions/117#discussioncomment-6873375

gsvarovsky avatar Sep 04 '23 07:09 gsvarovsky

Do I see it correct that I could propagate list changes in m-ld specific format, but keep them in my own dataset as a rdf list?

It would work quite well for m-ld to represent Lists as RDF Containers (I think!).

So, this JSON-LD:

{
  "@id": "ex.shopping",
  "@list": ["bread", "milk"]
}

would look like this:

<ex:shopping>
    a      rdf:Seq, mld:List ;
    rdf:_1 "bread" ;
    rdf:_2 "milk" .

The use of the m-ld vocabulary type would cause m-ld to maintain the List's coherence. So, for example INSERT <ex:shopping> rdf:_2 "cheese" would give:

<ex:shopping>
    a      rdf:Seq, mld:List ;
    rdf:_1 "bread" ;
    rdf:_2 "cheese";
    rdf:_3 "milk" .

(Note that milk has been re-indexed.)

Similarly, deleting items and concurrent edits also always maintain the list to be a continuous sequence, with one item per position.

  • ✅ It's still standard RDF
  • ✅ It maps closely to the JSON-LD (except with one-based indexing!) and to the internal representation
  • ❌ It's not an RDF Collection

gsvarovsky avatar Sep 04 '23 07:09 gsvarovsky