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

Silently ignore statements that cannot be deleted #573

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,17 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
if (binding) ds = ds.substitute(binding)
// console.log('applyPatch: delete: ' + ds)
ds = ds.statements as Statement[]
var bad: Quad[] = []
var ds2 = ds.map(function (st: Quad) { // Find the actual statements in the store
var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target)
if (sts.length === 0) {
// log.info("NOT FOUND deletable " + st)
bad.push(st)
// Ignore statements that cannot be deleted.
return null
} else {
// log.info("Found deletable " + st)
return sts[0]
}
})
if (bad.length) {
// console.log('Could not find to delete ' + bad.length + 'statements')
// console.log('despite ' + targetKB.statementsMatching(bad[0].subject, bad[0].predicate)[0])
return patchCallback('Could not find to delete: ' + bad.join('\n or '))
}
});
ds2 = ds2.filter(function (st: Quad) { return st !== null }) as Statement[];
ds2.map(function (st: Quad) {
targetKB.remove(st)
})
Expand Down