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
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.
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?
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”?
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.