Skip to content

Commit f3319c9

Browse files
committed
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents 2e0ba10 + 98a1f31 commit f3319c9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/woql.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -918,12 +918,15 @@ function TripleBuilder(type, cursor, s, query){
918918
this.type = type;
919919
this.cursor = cursor;
920920
this.subject = query.cleanSubject(s);
921-
this.graph = false;
921+
this.g = false;
922922
this.query = query;//the containing query
923923
}
924924

925925
TripleBuilder.prototype.graph = function(g){
926-
this.graph = g;
926+
this.g = this.query.cleanGraph(g);
927+
if(this.type == "triple") this.type = "quad";
928+
if(this.type == "add_triple") this.type = "add_quad";
929+
if(this.type == "delete_triple") this.type = "delete_quad";
927930
return this;
928931
}
929932

@@ -942,8 +945,8 @@ TripleBuilder.prototype.addPO = function(p, o, g){
942945
else {
943946
evstr += o;
944947
}
945-
if(ttype.substring(ttype.length-4) == "quad"){
946-
var g = (g ? g : (this.graph ? this.graph : "db:schema"));
948+
if(ttype.substring(ttype.length-4) == "quad" || this.g){
949+
var g = (g ? g : (this.g ? this.g : "db:schema"));
947950
evstr += ", '" + g + "'";
948951
}
949952
evstr += ")";
@@ -989,7 +992,6 @@ TripleBuilder.prototype.sub = function(s){
989992
return this.addEntry(unit);
990993
}
991994

992-
993995
TripleBuilder.prototype.label = function(l, lang){
994996
lang = (lang ? lang : "en");
995997
var x = this.addPO('rdfs:label', {"@value": l, "@language": lang});
@@ -1001,6 +1003,11 @@ TripleBuilder.prototype.comment = function(c, lang){
10011003
return this.addPO('rdfs:comment', {"@value": c, "@language": lang});
10021004
}
10031005

1006+
TripleBuilder.prototype.property = function(p,val){
1007+
p = this.cleanPredicate(p);
1008+
return this.addPO(p, val);
1009+
}
1010+
10041011
TripleBuilder.prototype.parent = function(...p){
10051012
for(var i = 0 ; i<p.length; i++){
10061013
pn = this.query.cleanClass(p[i]);

0 commit comments

Comments
 (0)