linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
561 stars 142 forks source link

deleteDocument() : Error : Statement to be removed is not on store #631

Open bourgeoa opened 5 months ago

bourgeoa commented 5 months ago

For example trying to edit with the source-pane https://bourgeoa.solidcommunity.net:8443/public/

Statement to be removed is not on store: _:n185 <http://www.w3.org/2007/ont/link#status> _:186 .

_:186 object is the term.value of Collection

The issue occurs only at the st.object being an (object) Collection in the metadata status part. It looks like if st.object do not get the Collection elements.

removeMatches() calls removeMany() that calls remove() that fails on that object Collection.

bourgeoa commented 5 months ago

This must be better explained : This is the serialization of the metadata for https://bob.localhost:8443/profile/card

    @prefix : <#>.
    @prefix http: <http://www.w3.org/2007/ont/http#>.
    @prefix httph: <http://www.w3.org/2007/ont/httph#>.
    @prefix tabont: <http://www.w3.org/2007/ont/link#>.
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
    @prefix pro: <https://bob.localhost:8443/profile/>.
    @prefix tur: <http://www.w3.org/ns/iana/media-types/text/turtle#>.

    pro:card a tabont:Document, tabont:RDFDocument, tur:Resource.
    [
      rdfs:label "[0:16:34]  Request for https://bob.localhost:8443/profile/card";
      tabont:requestedURI "https://bob.localhost:8443/profile/card";
      tabont:response
              [
                  http:status 200;
                  http:statusText "OK";
                  httph:accept-patch
                      "text/n3, application/sparql-update, application/sparql-update-single-match";
                  httph:accept-post "*/*";
                  httph:accept-put "*/*";
                  httph:access-control-allow-credentials "true";
                  httph:access-control-expose-headers
                      "Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Accept-Put, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate, MS-Author-Via, X-Powered-By";
                  httph:allow "OPTIONS, HEAD, GET, PATCH, POST, PUT, DELETE";
                  httph:connection "keep-alive";
                  httph:content-type "text/turtle";
                  httph:date "Thu, 08 Feb 2024 23:16:35 GMT";
                  httph:keep-alive "timeout=5";
                  httph:link
                    '<card.acl>; rel=\"acl\", <card.meta>; rel=\"describedBy\", <http://www.w3.org/ns/ldp#Resource>; rel=\"type\"';
                  httph:ms-author-via "SPARQL";
                  httph:transfer-encoding "chunked";
                  httph:updates-via "wss://bob.localhost:8443";
                  httph:vary "Accept, Authorization, Origin";
                  httph:wac-allow 'user=\"read write append control\",public=\"read\"';
                  httph:x-powered-by "solid-server/5.7.9-beta"
              ];
      tabont:status
              ( "[0:16:35.259] N3 parsed: 13 triples in 26 lines."
              "[0:16:35.259] Done." )
  ].

The issue is with the last object Collection

  [
     .......
     tabont:status
              ( "[0:16:35.259] N3 parsed: 13 triples in 26 lines."
              "[0:16:35.259] Done." )
  ].
bourgeoa commented 5 months ago

@angelo @timbl I have prepared 2 working solutions (tested on NSS)

bourgeoa commented 3 months ago

@timbl The collection issue on store.removeMetadata() is not resolved One way to HACK the issue is to replace the status collection with simple triples

A hack has been implemented in source-pane to move the error to a console.log()