Skip to content

Commit 6882f5f

Browse files
authored
In .patch serializer, default to "add" operation if no operation or no target is given on the commandline. (#2898)
1 parent 91f959a commit 6882f5f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rdflib/plugins/serializers/patch.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ def write_triples(contexts, op_code, use_passed_contexts=False):
8181

8282
if operation:
8383
assert operation in add_remove_methods, f"Invalid operation: {operation}"
84-
84+
elif not target:
85+
# No operation specified and no target specified
86+
# Fall back to default operation of "add" to prevent a no-op
87+
operation = "add"
8588
write_header()
8689
if operation:
8790
operation_code = add_remove_methods.get(operation)

0 commit comments

Comments
 (0)