linkeddata / rdflib.js

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

updater.updateMany() may return a wrong result #490

Closed bourgeoa closed 3 years ago

bourgeoa commented 3 years ago

https://github.com/solid/contacts-pane/issues/40

instead of grouping statements by document, the function fail to de-duplicate st.why. With as aconsequence a duplication of statements. On remove this induces PATCH failure.

const uniqueDocs = Array.from(new Set(docs)) is incorrect because all objects are different, we must compare the content. We can use rdflib.js sameTerm that make a node key value comparison in something like :

const uniqueDocs = []
docs.map(doc => {
    if (!uniqueDocs.find(item => item.sameTerm(doc))) uniqueDocs.push(doc)
 })