Skip to content

Commit 4b9da26

Browse files
committed
add more tests in the triple builder API
1 parent f3319c9 commit 4b9da26

File tree

1 file changed

+90
-6
lines changed

1 file changed

+90
-6
lines changed

test/woql.spec.js

Lines changed: 90 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,19 +358,21 @@ describe('triple builder chanier', function () {
358358
it('check the graph method',function(){
359359

360360
const woqlObject=WOQL.node("doc:x", "add_quad").graph("db:schema");
361+
const woqlObject2=WOQL.node("doc:x", "add_quad").graph("db:mySchema").label("my label", "en");
361362

362-
console.log(woqlObject.json());
363-
//const jsonObj={}
363+
const jsonObj={};
364+
const jsonObj2={ add_quad: ['doc:x', 'rdfs:label', { '@value': 'my label', '@language': 'en' }, 'db:mySchema'] };
364365

365-
//expect(woqlObject.json()).to.eql(jsonObj);
366+
expect(woqlObject.json()).to.eql(jsonObj);
367+
expect(woqlObject2.json()).to.eql(jsonObj2);
366368

367369
})
368370

369371
it('check the label method',function(){
370372

371373
const woqlObject=WOQL.node("doc:x", "add_quad").label("my label", "en");
372374

373-
const jsonObj={ add_quad: ['doc:x', 'rdfs:label', { '@value': 'my label', '@language': 'en' }, 'db:schema'] }
375+
const jsonObj={ add_quad: ['doc:x', 'rdfs:label', { '@value': 'my label', '@language': 'en' }, 'db:schema'] };
374376

375377
expect(woqlObject.json()).to.eql(jsonObj);
376378

@@ -380,7 +382,7 @@ describe('triple builder chanier', function () {
380382

381383
const woqlObject=WOQL.node("doc:x", "add_quad").comment("my comment");
382384

383-
const jsonObj={ add_quad: ['doc:x', 'rdfs:comment', { '@value': 'my comment', '@language': 'en' }, 'db:schema'] }
385+
const jsonObj={ add_quad: ['doc:x', 'rdfs:comment', { '@value': 'my comment', '@language': 'en' }, 'db:schema'] };
384386

385387
expect(woqlObject.json()).to.eql(jsonObj);
386388

@@ -390,10 +392,92 @@ describe('triple builder chanier', function () {
390392

391393
const woqlObject=WOQL.node("doc:x", "add_quad").property("myprop", "value");
392394

393-
const jsonObj={ add_quad: ['doc:x', 'rdfs:myprop', { '@value': 'my value', '@language': 'en' }, 'db:schema'] }
395+
const jsonObj={ add_quad: ['doc:x', 'rdfs:myprop', { '@value': 'my value', '@language': 'en' }, 'db:schema'] };
394396

395397
expect(woqlObject.json()).to.eql(jsonObj);
396398

397399
})
398400

401+
it('check the entity method',function(){
402+
403+
const woqlObject=WOQL.node("doc:x", "add_quad").entity();
404+
405+
console.log(woqlObject.json());
406+
407+
//const jsonObj={ add_quad: ['doc:x', 'rdfs:myprop', { '@value': 'my value', '@language': 'en' }, 'db:schema'] }
408+
409+
//expect(woqlObject.json()).to.eql(jsonObj);
410+
411+
})
412+
413+
it('check the parent method',function(){
414+
415+
const woqlObject=WOQL.node("doc:x", "add_quad").parent("Z");
416+
417+
console.log(woqlObject.json());
418+
419+
//const jsonObj={ add_quad: ['doc:x', 'rdfs:myprop', { '@value': 'my value', '@language': 'en' }, 'db:schema'] }
420+
421+
//expect(woqlObject.json()).to.eql(jsonObj);
422+
423+
})
424+
425+
it('check the abstract method',function(){
426+
427+
const woqlObject=WOQL.node("doc:x", "add_quad").abstract();
428+
429+
const jsonObj={ add_quad: [ 'doc:x', 'tcs:tag', 'tcs:abstract', 'db:schema' ] };
430+
431+
expect(woqlObject.json()).to.eql(jsonObj);
432+
433+
})
434+
435+
it('check the relationship method',function(){
436+
437+
const woqlObject=WOQL.node("doc:x", "add_quad").relationship();
438+
439+
console.log(woqlObject.json());
440+
441+
const jsonObj={ add_quad: [ 'doc:x', 'tcs:tag', 'tcs:relationship', 'db:schema' ] };
442+
443+
expect(woqlObject.json()).to.eql(jsonObj);
444+
445+
})
446+
447+
it('check the max method',function(){
448+
449+
const woqlObject=WOQL.addProperty("P", "string").max(4);
450+
451+
console.log(woqlObject.json());
452+
453+
//const jsonObj={ add_quad: [ 'doc:x', 'tcs:tag', 'tcs:relationship', 'db:schema' ] };
454+
455+
//expect(woqlObject.json()).to.eql(jsonObj);
456+
457+
})
458+
459+
it('check the min method',function(){
460+
461+
const woqlObject=WOQL.addProperty("P", "string").min(2);
462+
463+
console.log(woqlObject.json());
464+
465+
//const jsonObj={ add_quad: [ 'doc:x', 'tcs:tag', 'tcs:relationship', 'db:schema' ] };
466+
467+
//expect(woqlObject.json()).to.eql(jsonObj);
468+
469+
})
470+
471+
it('check the cardinality method',function(){
472+
473+
const woqlObject=WOQL.addProperty("P", "string").cardinality(3);
474+
475+
console.log(woqlObject.json());
476+
477+
//const jsonObj={ add_quad: [ 'doc:x', 'tcs:tag', 'tcs:relationship', 'db:schema' ] };
478+
479+
//expect(woqlObject.json()).to.eql(jsonObj);
480+
481+
})
482+
399483
})

0 commit comments

Comments
 (0)