Skip to content

Commit c6d177d

Browse files
author
Aries Yuwono
committed
add test
1 parent fb7b402 commit c6d177d

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

test-complete/nodejs-sparql-update.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('sparql update test', function(){
2929
var graphUri = 'http://marklogic.com/sparqlupdate/people';
3030
var mlGraphUri = 'http://marklogic.com/sparqlupdate/mladd';
3131
var mlGraphPath = './node-client-api/test-complete/data/mlgraph.ttl';
32+
var inferGraphPath = './node-client-api/test-complete/data/inferenceData.nt';
3233

3334
before('should drop all graphs', function(done){
3435
var myData = "DROP ALL ;"
@@ -443,29 +444,36 @@ describe('sparql update test', function(){
443444
}, done);
444445
});
445446

446-
/*it('should run SPARQL update with ruleset', function(done){
447-
var myData = "PREFIX ml: <http://marklogicsparql.com/>\n" +
448-
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
449-
"INSERT DATA\n" +
447+
it('should write graph for inference', function(done){
448+
db.graphs.write({
449+
uri: 'http://marklogic.com/sparqlupdate/infer',
450+
contentType: 'application/n-triples',
451+
data: fs.createReadStream(inferGraphPath)
452+
}).
453+
result(function(response){
454+
//console.log(JSON.stringify(response, null, 4));
455+
done();
456+
}, done);
457+
});
458+
459+
it('should run SPARQL update with ruleset', function(done){
460+
var myData = "INSERT DATA\n" +
450461
"{\n" +
451-
" GRAPH <http://marklogic.com/sparqlupdate/people>" +
462+
" GRAPH <http://marklogic.com/sparqlupdate/infer>" +
452463
" {\n" +
453-
" ml:StaffEngineer rdfs:subClassOf ml:Engineer .\n" +
464+
" <http://marklogicsparql.com/id#3333> <http://marklogicsparql.com/addressbook#firstName> 'Mark' .\n" +
454465
" }\n" +
455466
"}"
456467
db.graphs.sparqlUpdate({
457468
data: myData,
458469
usingNamedGraphs: true,
459-
rulesets: 'subClassOf.rules'
470+
rulesets: 'equivalentClass.rules'
460471
}).
461472
result(function(response){
462-
console.log(JSON.stringify(response, null, 2));
463-
done();
464-
}, function(error) {
465-
console.log(error);
473+
//console.log(JSON.stringify(response, null, 2));
466474
done();
467-
});
468-
});*/
475+
}, done);
476+
});
469477

470478
it('should drop all graphs', function(done){
471479
var myData = "DROP ALL ;"

0 commit comments

Comments
 (0)