Skip to content

Commit 5a6d4f9

Browse files
added less and greater
1 parent 50864a7 commit 5a6d4f9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/woql.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ WOQLQuery.prototype.comment = function(val){
457457
this.cursor['comment'] = [val.json()];
458458
}
459459
else if(typeof val == "string"){
460-
this.cursor['comment'] = [val];
460+
this.cursor['comment'] = [{"@value": val, "@language": "en"}];
461461
}
462462
else if(typeof val == "object"){
463463
if(val.length) this.cursor['comment'] = val;
@@ -466,7 +466,9 @@ WOQLQuery.prototype.comment = function(val){
466466
else {
467467
this.cursor['comment'] = [];
468468
}
469-
this.cursor = this.cursor['comment'][this.cursor['comment'].length];
469+
var last_index = this.cursor['comment'].length;
470+
this.cursor['comment'][last_index] = {};
471+
this.cursor = this.cursor['comment'][last_index];
470472
return this;
471473
}
472474

test/woql.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ describe('triple builder', function () {
317317

318318
const woqlObject=WOQL.deleteClass("id");
319319

320-
const jsonObj= { and: [ { delete_quad: [ 'scm:id', 'v:All', 'v:Al2', 'db:schema' ] }, { delete_quad: [ 'v:Al3', 'v:Al4', 'scm:id', 'db:schema' ] } ] };
320+
const jsonObj= { and: [ { delete_quad: [ 'scm:id', 'v:All', 'v:Al2', 'db:schema' ] }, { opt: [{delete_quad: [ 'v:Al3', 'v:Al4', 'scm:id', 'db:schema' ] }]} ] };
321321

322322
expect(woqlObject.json()).to.eql(jsonObj);
323323

@@ -446,17 +446,17 @@ describe('triple builder chanier', function () {
446446

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

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

451451
expect(woqlObject.json()).to.eql(jsonObj);
452452

453453
})
454454

455455
it('check the comment method',function(){
456456

457-
const woqlObject=WOQL.node("doc:x", "add_quad").comment("my comment");
457+
const woqlObject=WOQL.comment("Comments Out the Following").add_triple("doc:x", "type", "scm:Yoke");
458458

459-
const jsonObj={ add_quad: ['doc:x', 'rdfs:comment', { '@value': 'my comment', '@language': 'en' }, 'db:schema'] };
459+
const jsonObj={ comment: [{ "@value": 'Comments Out the Following', "@language": 'en' }, {"add_triple": ["doc:x", "rdf:type", "scm:Yoke"]}] };
460460

461461
expect(woqlObject.json()).to.eql(jsonObj);
462462

@@ -466,7 +466,7 @@ describe('triple builder chanier', function () {
466466

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

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

471471
expect(woqlObject.json()).to.eql(jsonObj);
472472

@@ -512,7 +512,7 @@ describe('triple builder chanier', function () {
512512

513513
console.log(woqlObject.json());
514514

515-
const jsonObj={ add_quad: [ 'doc:x', 'tcs:tag', 'tcs:relationship', 'db:schema' ] };
515+
const jsonObj={ add_quad: [ 'doc:x', 'rdfs:subClassOf', 'tcs:Entity', 'db:schema' ] };
516516

517517
expect(woqlObject.json()).to.eql(jsonObj);
518518

0 commit comments

Comments
 (0)