annotation_service/commit

Check if Head variable is instanciated, allowing to delete annotation without committing.

authorChris Dijkshoorn
Wed Jun 29 14:33:10 2016 +0200
committerChris Dijkshoorn
Wed Jun 29 14:33:10 2016 +0200
commit5671e05753e46be816b2c550d01cf4a5b6b04363
treeecc7099a45d058a234a7269ad6623b1bfd0f3ec5
parent04c534eaf68e7e271cbb717c259b7fbd67e46342
Diff style: patch stat
diff --git a/api/annotation.pl b/api/annotation.pl
index 3450f80..8d4b18b 100644
--- a/api/annotation.pl
+++ b/api/annotation.pl
@@ -54,7 +54,7 @@ http_add_annotation(Request) :-
 			description('Body of the annotation')]),
 		  graph(Graph,
 			[ optional(true),
-			  description('Named graph to store the triples of this annotation in.  Defaults to uri of the target')
+			  description('Named graph to store the triples of this annotation in, defaults to uri of the target')
 			  ]),
 		  field(FieldURI,
 			[uri,
@@ -142,8 +142,9 @@ http_remove_annotation(Request) :-
 		   (   rdf_remove_annotation(Annotation),
 		       remove_meta_annotations(Annotation),
 		       commit_when_needed(Graph, User, CommitComment, Head))),
-	reply_json(json([annotation=Annotation,
-			 head=Head])).
+	( var(Head)
+	-> reply_json(json([annotation=Annotation]))
+	; reply_json(json([annotation=Annotation, head=Head]))).
 
 http_get_annotation(Request) :-
 	http_parameters(Request,