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

Method applyPatchInsertDelete

lib/ldp.mjs:768–788  ·  view source on GitHub ↗
(baseGraph, patchObject, uri, contentType)

Source from the content-addressed store, hash-verified

766 }
767
768 async applyPatchInsertDelete (baseGraph, patchObject, uri, contentType) {
769 const patchedGraph = baseGraph
770
771 // Apply deletes first
772 if (patchObject.deletes) {
773 const deleteQuads = this.parseQuads(patchObject.deletes, uri, contentType)
774 for (const quad of deleteQuads) {
775 patchedGraph.removeMatches(quad.subject, quad.predicate, quad.object)
776 }
777 }
778
779 // Apply inserts
780 if (patchObject.inserts) {
781 const insertQuads = this.parseQuads(patchObject.inserts, uri, contentType)
782 for (const quad of insertQuads) {
783 patchedGraph.add(quad.subject, quad.predicate, quad.object)
784 }
785 }
786
787 return patchedGraph
788 }
789
790 parseQuads (quads, uri, contentType) {
791 const graph = $rdf.graph()

Callers 1

applyPatchMethod · 0.95

Calls 1

parseQuadsMethod · 0.95

Tested by

no test coverage detected