1

I'm trying out GraphDB to see if it would fit my usecase or not and I have created a simple ontology in the form of (block) - has_content - (string). I have populated the database with a few triples matching this schema and created a React frontend that displays this data by requesting a response from the SPARQL endpoint. This works well so far.

I have then added the possibility to change the content with simple text fields to update the text content by calling the REST SPARQL template endpoint with a simple delete/insert query:

PREFIX ns: <http://www.example.com#>
DELETE {
  ?block ns:has_content ?oldContent .
} INSERT {
  ?block ns:has_content ?value .
} WHERE {
  ?block ns:has_content ?oldContent .
}

This works in principle but I have observed the following:

When I directly and quickly write in a textfield the text doesn't get updated but new has_content triples are added after each keypress as if the system would not be waiting for each request to finish deleting/inserting triples but trying to delete/add these triples in parallell. If I debounce the requests so they are not fired so quickly, everything works as expected, the has_content triple is deleted before the new data is inserted.

This leads me to my question: I have gotten the impression from the GraphDB documentation that all updates are transactional and that they would be transacted sequential. Is this wrong or do I have to configure GraphDB somehow? Or is my query wrong, I'm new to SPARQL.

yngwi
  • 121
  • 2
  • 8
  • What is `?value`? Have you looked at https://www.w3.org/TR/sparql11-update/#deleteInsert? – Stanislav Kralin May 18 '23 at 10:54
  • @StanislavKralin the values for the template are provided by the REST request, `?block` is the iri of the "block", `?value` is the new string content. I have looked at the documentation of delete/insert, I'm not sure where my error could lie. I'm following the [GraphDB update documentation](https://graphdb.ontotext.com/documentation/10.0/updating-data.html#what-s-in-this-document) where the whole process is outlined. – yngwi May 18 '23 at 11:17

0 Answers0