Skip to content

Commit fb7b402

Browse files
author
Aries Yuwono
committed
add sparql tx test
1 parent 7954b3f commit fb7b402

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test-complete/nodejs-sparql-update.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,30 @@ describe('sparql update test', function(){
302302
});
303303
});
304304

305+
/*TO BE VERIFIED it('should not do sparql update on with optimize value greater than 2', function(done){
306+
var myData = "PREFIX bb: <http://marklogic.com/baseball/players#>\n" +
307+
"INSERT DATA\n" +
308+
"{\n" +
309+
" GRAPH <http://marklogic.com/sparqlupdate/baseball>" +
310+
" {\n" +
311+
" bb:345 bb:id 345 .\n" +
312+
" }\n" +
313+
"}"
314+
db.graphs.sparqlUpdate({
315+
data: myData,
316+
optimizeLevel: 3
317+
}).
318+
result(function(response){
319+
//console.log(JSON.stringify(response, null, 2));
320+
response.should.equal('SHOULD HAVE FAILED');
321+
done();
322+
}, function(error) {
323+
console.log(JSON.stringify(error, null, 2));
324+
//error.body.errorResponse.message.should.containEql('Invalid type in optimize: -10 is not a value of type unsignedInt');
325+
done();
326+
});
327+
});*/
328+
305329
it('should do sparql update on with default ruleset graph', function(done){
306330
var myData = "PREFIX bb: <http://marklogic.com/baseball/players#>\n" +
307331
"INSERT DATA\n" +
@@ -346,6 +370,19 @@ describe('sparql update test', function(){
346370
})
347371
.then(function(response){
348372
//console.log(JSON.stringify(response, null, 2));
373+
var myQuery = "PREFIX bb: <http://marklogic.com/baseball/players#>\n" +
374+
"SELECT *\n" +
375+
"FROM <http://marklogic.com/sparqlupdate/baseball>\n" +
376+
"WHERE {?s bb:id 987}"
377+
return db.graphs.sparql({
378+
contentType: 'application/sparql-results+json',
379+
query: myQuery,
380+
txid: tid
381+
}).result();
382+
})
383+
.then(function(response){
384+
//console.log(JSON.stringify(response, null, 2));
385+
response.results.bindings[0].s.value.should.equal('http://marklogic.com/baseball/players#987');
349386
return db.transactions.commit(tid).result();
350387
})
351388
.then(function(response) {

0 commit comments

Comments
 (0)