MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / applyPatchUpdate

Method applyPatchUpdate

lib/ldp.mjs:746–766  ·  view source on GitHub ↗
(baseGraph, updates, uri, contentType)

Source from the content-addressed store, hash-verified

744 }
745
746 async applyPatchUpdate (baseGraph, updates, uri, contentType) {
747 const patchedGraph = baseGraph
748
749 for (const update of updates) {
750 if (update.operation === 'delete') {
751 const deleteQuads = this.parseQuads(update.where, uri, contentType)
752 for (const quad of deleteQuads) {
753 patchedGraph.removeMatches(quad.subject, quad.predicate, quad.object)
754 }
755 } else if (update.operation === 'insert') {
756 const insertQuads = this.parseQuads(update.quads, uri, contentType)
757 for (const quad of insertQuads) {
758 patchedGraph.add(quad.subject, quad.predicate, quad.object)
759 }
760 } else {
761 throw error(422, 'Unknown patch operation: ' + update.operation)
762 }
763 }
764
765 return patchedGraph
766 }
767
768 async applyPatchInsertDelete (baseGraph, patchObject, uri, contentType) {
769 const patchedGraph = baseGraph

Callers 1

applyPatchMethod · 0.95

Calls 1

parseQuadsMethod · 0.95

Tested by

no test coverage detected