Skip to content

Commit 29f5ea5

Browse files
committed
#119 fix using «update_triple» with three parameters and «and»
1 parent c903c96 commit 29f5ea5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/query/woqlBuilder.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ WOQLQuery.prototype.iri = function(s) {
5858
}
5959

6060
WOQLQuery.prototype.update_triple = function(subject, predicate, new_object, old_object) {
61-
old_object = old_object || 'v:AnyObject'
61+
const tmp_name = old_object || 'v:AnyObject__'+ Date.now()
6262
return this.and(
6363
new WOQLQuery().opt(
6464
new WOQLQuery()
65-
.triple(subject, predicate, old_object)
66-
.delete_triple(subject, predicate, old_object)
65+
.triple(subject, predicate, tmp_name)
66+
.delete_triple(subject, predicate, tmp_name)
6767
.not()
6868
.triple(subject, predicate, new_object),
6969
),
@@ -81,11 +81,12 @@ WOQLQuery.prototype.update_triple = function(subject, predicate, new_object, old
8181
*/
8282

8383
WOQLQuery.prototype.update_quad = function(subject, predicate, new_object, graph) {
84+
const tmp_name = 'v:AnyObject__'+ Date.now()
8485
return this.and(
8586
new WOQLQuery().opt(
8687
new WOQLQuery()
87-
.quad(subject, predicate, 'v:AnyObject', graph)
88-
.delete_quad(subject, predicate, 'v:AnyObject', graph)
88+
.quad(subject, predicate, tmp_name, graph)
89+
.delete_quad(subject, predicate, tmp_name, graph)
8990
.not()
9091
.quad(subject, predicate, new_object, graph),
9192
),

0 commit comments

Comments
 (0)