Is there a timeline for adding write functionality to the ld-flex library


#1

Hi

I am looking to develop an app that will use a solid pod to manage all the user data. But it will require that my app is able to actually add and update data in the user’s pod. I read in Ruben Verborgh’s post that the aim is to realise a read/write web through linked data. Is there any kind of timeline on this?

Also, is there a way I could add new data manually via the web? This would give me the ability to continue developing my app in the interim

Thanks
Des


#2

I don’t know about the status of ld-flex, but you could use solid-file-client for working with files (reading/updating/creating). This project is currently getting a rework which will (hopefully) land within the next few weeks, but the current version should also fit your needs. As an interim solution it should definitely work.


#3

Don’t know if you’ve considered it, but there’s also rdflib.js and it’s Fetcher and UpdateManager that can help you with creating and updating.


#4

Both solid-file-client and rdflib can write to pods. But so can query ldflex. It just isn’t documented yet. I showed a complete working example here : How can I handle data form pod?


#6

As others have mentioned, LDflex indeed does support writing, but those features still require documentation.

There is a roadmap for future LDflex development, which will include easy writing of complex shapes as well. However, no timeline is available. I depend on implementers to add such features (as well as people to write documentation); as soon as I have resources for them, they can start working on this.


#7

I am sorry to say it is still not clear to me how I can add data to my Pod. How for example, can I add a simple text property to my Pod within a new context. So say I would like to add a new context called “tree” and within this context add a property called “oak” with a value of “acorn” (just a string property nothing more) how would I add it? Such that the same way I can call solid.data[“user.name”] in ldflex to return my name - I could now make a similar call sold.data[“tree.oak”] that returns “acorn”?


#8

So, the quick explanation is that ldflex is abstracting out a triple - a Subject/Predicate/Object collection. In the case of solid.data.user.name, the subject is “user” which is an alias for your webID, and the predicate is “name” which is another alias for a name predicate (which one, I’d have to look up).

So to add data, you need to provide a subject to add it to, a predicate that describes it, and a value (aka object) to store.

The syntax for this is solid.data[subject][predicate].add(value); and in this case a subject can be a file or something else. For example, we use a lot of NamedNodes, which are like named collections of predicates. In the profile, an example of this is address - addresses are grouped together under namedNodes with names like id3874387438 (to be unique) and contain street address, locality, and other predicates. This way, one file can contain multiple addresses and keep them separated out and retrievable (instead of just lumping them all in one flat file).

To create a namedNode, it’s a similar syntax as above, except the value you’re adding is namedNode(name), where namedNode is coming from import { namedNode } from '@rdfjs/data-model'; - Then you can use the namedNode as the subject. NamedNodes are separated by # signs in the url.

So if you had a file called trees.ttl, you could make a namedNode called acorn by using

solid.data['path/to/file/trees.ttl'][predicate].add(namedNode('oak') but I’m not sure what predicate you would want there. Then you could do solid.data['path/to/file/trees.ttl#oak'][predicate].add('acorn'); but again I’m not sure what the best predicate is for that example.