Hello! I want to insert something in a dataset in my pod using a sparql update query. According to this it should be possible:
But after reading different posts, my understanding is that its not possible after all as not all servers support it? (Inrupt.com/.net/nss)
Can someone confirm this?
I also tried using store.query() in rdflib.js. Is it possible to insert data on store through queries, or is store.add() the only option?
I really want to update the dataset through a query, is this possible at all? Either clientside or remotely?
Yes, SPARQL patches do work. You can use rdflib’s updater which uses rdflib statement objects, or you can use Solid File Client’s patch method. The docs for Solid-File-Client show the basic syntax of two different kinds of patches - ‘text/n3’ or 'application/sparql. You could also use those examples with straight fetches with only an auth library and without Solid-File-Client.
The text/n3 form of patch is more flexible and will be the format of patch that is standardized in the Solid spec.
Both forms of patch work on NSS. If you try them on other platforms, you might report back here.
Thank you for the reply. So i tried sending a patch through the session fetch, but then i get an 415 error that says ‘Unsupported Media Type’. I also tried it with content type ‘text/turtle’ and ‘text/n3’.
Thank you for the reply. I might want to work on the store yes! But i need to be able to update the dataset/store through sparql update.
For example: const myQuery = ‘INSERT { <#http://example.org/something> <#http://example.org/hasSomething> ‘some value’ . } WHERE { ?s ?p ?o . }’
I read that the store.applyPatch() is expecting an array of Statement Objects. I could not find a way to convert my query into a Statement…
Do you know if this is possible to achieve with my requirement ?
I have another question regarding the limited SPARQL support in Solid Pods:
The ‘Solid HTTP REST API Spec’ that I linked to earlier, also mention support for SELECT queries encoded in the url.
No NSS does not support SPARQL SELECT. CSS has a SPARQL endpoint option. Client-side SPARQL queries can be done against Solid Servers including with authenticated fetch using either rdflib or comunica.