@@ -918,12 +918,15 @@ function TripleBuilder(type, cursor, s, query){
918
918
this . type = type ;
919
919
this . cursor = cursor ;
920
920
this . subject = query . cleanSubject ( s ) ;
921
- this . graph = false ;
921
+ this . g = false ;
922
922
this . query = query ; //the containing query
923
923
}
924
924
925
925
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" ;
927
930
return this ;
928
931
}
929
932
@@ -942,8 +945,8 @@ TripleBuilder.prototype.addPO = function(p, o, g){
942
945
else {
943
946
evstr += o ;
944
947
}
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" ) ) ;
947
950
evstr += ", '" + g + "'" ;
948
951
}
949
952
evstr += ")" ;
@@ -989,7 +992,6 @@ TripleBuilder.prototype.sub = function(s){
989
992
return this . addEntry ( unit ) ;
990
993
}
991
994
992
-
993
995
TripleBuilder . prototype . label = function ( l , lang ) {
994
996
lang = ( lang ? lang : "en" ) ;
995
997
var x = this . addPO ( 'rdfs:label' , { "@value" : l , "@language" : lang } ) ;
@@ -1001,6 +1003,11 @@ TripleBuilder.prototype.comment = function(c, lang){
1001
1003
return this . addPO ( 'rdfs:comment' , { "@value" : c , "@language" : lang } ) ;
1002
1004
}
1003
1005
1006
+ TripleBuilder . prototype . property = function ( p , val ) {
1007
+ p = this . cleanPredicate ( p ) ;
1008
+ return this . addPO ( p , val ) ;
1009
+ }
1010
+
1004
1011
TripleBuilder . prototype . parent = function ( ...p ) {
1005
1012
for ( var i = 0 ; i < p . length ; i ++ ) {
1006
1013
pn = this . query . cleanClass ( p [ i ] ) ;
0 commit comments