Closed james-martin-jd closed 2 years ago
For reference, there's an abstraction for this in rdf-object: https://github.com/rubensworks/rdf-object.js#conveniently-access-rdf-lists We could easily port this code to LDflex: https://github.com/rubensworks/rdf-object.js/blob/master/lib/RdfListMaterializer.ts
Just want to note that we'll need to be careful with blank nodes (#34).
Resolved upstream in the main LDflex package https://github.com/LDflex/LDflex/pull/122
It would be a very nice feature-add to be able to fetch an RDF collection such as:
... and return the values as a JS array. (This is real data I've used for demos and testing the SDK, using the Form Model syntax and vocabs).
Right now we have to run the results of values through a custom function that parses the collection recursively into an array by removing the
rdf$first
item, appending it to an array, then sendingrdf$rest
recursively into itself. The code snippet we use is here:This currently works and returns a collection as an array, but something like this seems extremely useful for managing other datatypes than just Literals.