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

Predicate values in an @list cannot be deleted #74

Open
Jackamus29 opened this issue Jan 9, 2024 · 8 comments
Open

Predicate values in an @list cannot be deleted #74

Jackamus29 opened this issue Jan 9, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@Jackamus29
Copy link
Collaborator

Description

Using fluree/server:latest on Jan 8th, 2024

where+delete and where+delete+insert transactions do not effectively delete facts stored with an @container value of @list.

Steps to reproduce

Create ledger

{
  "ledger": "list-delete-test",
  "@context": {
    "ex": "http://example.org/ns/",
    "ex:age": {
      "@container": "@list"
    }
  },
  "insert": [
    {
      "@id": "zeti",
      "ex:age": [97, 19, 97, 19, 97]
    }
  ]
}

Query Zeti

{
  "from": "list-delete-test",
  "@context": {
    "ex": "http://example.org/ns/",
    "ex:age": {
      "@container": "@list"
    }
  },
  "selectDistinct": { "?s": ["*"] },
  "where": {
    "@id": "?s",
    "ex:age": "?age"
  }
}

Delete age values

{
  "ledger": "list-delete-test",
  "@context": {
    "ex": "http://example.org/ns/",
    "ex:age": {
      "@container": "@list"
    }
  },
  "where": {
    "@id": "?s",
    "ex:age": "?age"
  },
  "delete": {
    "@id": "?s",
    "ex:age": "?age"
  }
}

Query Zeti again (expected: empty, actual: same result as before delete)

{
  "from": "list-delete-test",
  "@context": {
    "ex": "http://example.org/ns/",
    "ex:age": {
      "@container": "@list"
    }
  },
  "selectDistinct": { "?s": ["*"] },
  "where": {
    "@id": "?s",
    "ex:age": "?age"
  }
}
@Jackamus29
Copy link
Collaborator Author

Note that, when using where+delete+insert with an @list, the previous values are not deleted and the new values are inserted successfully.
This seems to be the cause of a user's issue reported via Discord:
https://discord.com/channels/896089675511508992/1191042410755661834

@zonotope zonotope added the bug Something isn't working label Jan 9, 2024
@aaj3f
Copy link
Collaborator

aaj3f commented Jan 22, 2024

If you pick this up, consider picking up #75 as well (also related to @list)

@Jackamus29
Copy link
Collaborator Author

Hey @dpetran - it looks like fluree/db#720 did not solve this bug.

@dpetran dpetran self-assigned this Feb 12, 2024
@dpetran
Copy link

dpetran commented Feb 12, 2024

Testing this on the db main branch (1fa39b74fa61deb3df1503060569395e86267fd1) seems to work correctly. Can you confirm the commit sha of the db version you were testing against?

@aaj3f
Copy link
Collaborator

aaj3f commented Feb 13, 2024

@dpetran the behavior is seen on HEAD of main on server: 5f5ead9cbfbe25bf10f05a92f517cc0f392c0694 (which uses db git SHA 4b6a864587c4b75b7c7f0fd5de854ca65bea6570)

It wouldn't surprise me if the issue is in the back-and-forth (de)serialization of JSON data (but not sure if it's at the transaction time or query time), which is to say the issue may be more in server than in db (either before the txn is sent to db or after the query results are returned from db

@dpetran
Copy link

dpetran commented Feb 14, 2024

I've updated the server db dep version so it should be working now.

@Jackamus29
Copy link
Collaborator Author

Jackamus29 commented Feb 14, 2024

Hey again @dpetran - I just built a fresh Docker image from your latest fluree/server commit (HEAD of main) and I'm still seeing the inability to delete @list items as described in this bug ticket.
Is there any additional information I can provide or tests I can try that would give you enough to reproduce?

@dpetran
Copy link

dpetran commented Feb 14, 2024

I've added some tests to verify that deletion is working correctly, and it seems to be. Is there a way to verify that the docker image was built correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants