solid-client-js icon indicating copy to clipboard operation
solid-client-js copied to clipboard

Support for adding Collections to Things

Open travis opened this issue 3 years ago • 1 comments

Search terms you've used

Collection, Container, Seq

Feature suggestion

I'd like a set of functions (eg, addListToThing and removeListFromThing) that let me add collections to Things. The @rdfdev/collections library has a good set of functions for doing this with the lower level RDF abstractions, but it doesn't play especially nicely with the solid-client Resource and Thing abstractions

Use Cases

I'd like to be able to convert a JavaScript object to a pure-RDF format rather than serializing to JSON and storing as a string. The JSON for note bodies in Mysilio Garden is becoming prohibitively large and we'd like to be able to take advantage of the PATCH support built in to Solid servers to optimize this.

travis avatar Jun 23 '22 19:06 travis

I worked up a version of this that uses rdf:List (as describe in https://ontola.io/blog/ordered-data-in-rdf/) here:

https://github.com/mysilio-co/garden-kit/blob/rdf-note-serialization/src/collections.ts

You can see how we use this with our own "element [de]serializers" here:

https://github.com/mysilio-co/garden-kit/blob/rdf-note-serialization/test/note.test.ts

Would y'all be interested in me porting this code over to this repository? Any thoughts on the API? I'm not convinced it's the right general purpose solution so would love any thoughts.

travis avatar Jun 28 '22 00:06 travis