N3Patch
data class N3Patch(val deletes: String? = null, val inserts: String? = null, val where: String? = null)
Represents a Solid N3 Patch document for use with HTTP PATCH requests.
A valid N3 Patch document declares rdf:type solid:InsertDeletePatch and may contain solid:deletes, solid:inserts, and solid:where formulae.
Building a patch
DSL builder — no raw N3 strings required:
// Simple insert
val patch = N3Patch.build {
insertLiteral(contactUri, VCARD.FN, "Alice")
}
// Safe replace — bind the old value via where, then swap it
val patch = N3Patch.build {
where(contactUri, VCARD.FN, variable = "oldName")
deleteVar(contactUri, VCARD.FN, variable = "oldName")
insertLiteral(contactUri, VCARD.FN, "Alice")
}Content copied to clipboard
Diff factory — automatically derives the patch from two resource states:
val patch = N3Patch.fromDiff(originalResource, modifiedResource)Content copied to clipboard
Content-Type: text/n3 Spec: https://solidproject.org/TR/protocol#n3-patch
Constructors
Functions
Link copied to clipboard
Returns the toN3String document as a byte stream.
Link copied to clipboard
Serializes this patch to an N3 Patch document (text/n3).
Link copied to clipboard
Renders this patch as a SPARQL 1.1 Update document (application/sparql-update).