Skip to content

Unable to remove triples with blank nodes using N3 Patch #1977

@joachimvh

Description

@joachimvh

Description

Data:

@prefix ex: <http://example.org>.

<> ex:somePredicate [ a ex:someType; ex:someOtherPredicate "value" ].

N3 Patch query:

@prefix solid: <http://www.w3.org/ns/solid/terms#>.
@prefix ex: <http://example.org>.

_:patch a solid:InsertDeletePatch;
    solid:where   { <http://localhost/document> ex:somePredicate ?blankNode. };
    solid:deletes { ?blankNode ex:someOtherPredicate "value". }.

The query will fail with error "The document does not contain all triples the N3 Patch requests to delete, which is required for patching.".

The reason for this is that we first use Comunica to find bindings for the solid:where clause, but the blank node it returns for ?blankNode will have a different label than the one used in the dataset. We then try to remove the triple with this value directly from the N3.js store, which fails since a different label is used.

Possible solutions:

  1. Rewrite the patching so Comunica handles everything, using an insert/delete query. The problem with this is that there are certain checks that need to happen, such as "If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code.". I'm not sure if all of these can be guaranteed when doing this. Will have to check.
  2. Completely remove the Comunica dependency, but that would require us to have an internal querying engine. Only for BGPs for now so perhaps still doable, but if more complex query requirements are ever added, we would have to build our entire internal querying engine which is not something desired.
  3. Based on the output of Comunica, somehow determine which are the triples that should be matched in the N3.js store. This might be possible and easier than doing the full query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions