Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect working when deleting triplets in a BerkeleyDB store #2698

Open
roelj opened this issue Jan 29, 2024 · 3 comments
Open

Incorrect working when deleting triplets in a BerkeleyDB store #2698

roelj opened this issue Jan 29, 2024 · 3 comments

Comments

@roelj
Copy link

roelj commented Jan 29, 2024

Dear rdflib developers,

I'm running into a problem with the BerkeleyDB backend: It does not delete a triplet from an DELETE/INSERT query.
I made a minimal reproducer here:
https://gist.github.com/roelj/a7b2f1751d8fe23fab96404ec69a10c0

It comes down to this query:

PREFIX test: <http://test.nonexisting/>
PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>

DELETE {
  GRAPH <test://default> {
    ?dataset test:title ?title .
    ?dataset test:modified_date ?modified_date .
  }
}
INSERT {
  GRAPH <test://default> {
    ?dataset test:title "Test"^^xsd:string .
    ?dataset test:modified_date "***variable***"^^xsd:dateTime .
  }
}
WHERE {
  GRAPH <test://default> {
    ?dataset rdf:type test:Dataset .
    ?dataset test:title ?title .
    ?dataset test:modified_date ?modified_date .
  }
}

Where this triplet gets duplicated (so, it isn't DELETEd, but the INSERT works):

?dataset test:modified_date ?modified_date .

This happens only with the BerkeleyDB backend. Using a Virtuoso endpoint works as expected (no duplicated triples).
I hope it's clear.

@roelj
Copy link
Author

roelj commented Jan 30, 2024

After experimenting a bit further, it seems that this only happens when using xsd:dateTime. When using xsd:string the issue is not present.

@nicholascar
Copy link
Member

Are you sure the DELETE command is matching the triple you want to remove? Try running it as a SELECT first to see if it's correctly targetted.

(I think you must target the literal type in the DELETE, i.e. add ^^xsd:dateTime)

@roelj
Copy link
Author

roelj commented Aug 1, 2024

Thanks for your insights. Well, why would it not work being a variable? In fact, it works fine on external RDF stores (I tested Virtuoso, Fuseki and Blazegraph).

How would I write the query from my initial report to target the literal type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants