Skip to content

Commit b5e1871

Browse files
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents 309ed5a + 8aab765 commit b5e1871

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

lib/terminusRule.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TerminusRule.prototype.type = function(...list){
3131
}
3232

3333
/**
34-
* Specifies the scope of a rule - row / cell / object / property / * .. what part of the result does the rule apply to
34+
* Specifies the scope of a rule - row / cell / object / property / * .. what part of the result does the rule apply to
3535
*/
3636
TerminusRule.prototype.scope = function(scope){
3737
if(typeof scope == "undefined"){
@@ -49,7 +49,6 @@ TerminusRule.prototype.value = function(...val){
4949
return this.pattern.value;
5050
}
5151
this.pattern.value = val;
52-
console.log(this.pattern.value);
5352
return this;
5453
}
5554

@@ -72,7 +71,7 @@ TerminusRule.prototype.json = function(mjson){
7271

7372
/**
7473
* Contained Pattern Object to encapsulate pattern matching
75-
* @param {Object} pattern
74+
* @param {Object} pattern
7675
*/
7776
function TerminusPattern(pattern){};
7877

@@ -99,7 +98,7 @@ TerminusPattern.prototype.testBasics = function(scope, value){
9998
if(this.scope && scope && this.scope != scope) return false;
10099
if(this.type){
101100
var dt = value["@type"];
102-
if(!dt || !this.testValue(dt, this.type)) return false;
101+
if(!dt || !this.testValue(dt, this.type)) return false;
103102
}
104103
if(typeof this.literal != "undefined"){
105104
if(!(this.literal == !(typeof value["@type"] == "undefined"))) return false;
@@ -141,7 +140,7 @@ TerminusPattern.prototype.unpack = function(arr, nonstring){
141140
str += arr[i];
142141
}
143142
if(i < (arr.length - 1)) str += ", ";
144-
}
143+
}
145144
}
146145
else {
147146
str = '"' + arr.join('","') + '"';
@@ -192,4 +191,4 @@ TerminusPattern.prototype.stringMatch = function (vala, valb) {
192191
};
193192

194193

195-
module.exports = {TerminusRule, TerminusPattern};
194+
module.exports = {TerminusRule, TerminusPattern};

test/woql.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,21 @@ describe('woql queries', function () {
347347

348348
})
349349

350+
it('check the split method',function(){
351+
352+
const woqlObject=WOQL.split("A, B, C", ", ", "v:list_obj");
353+
354+
const jsonObj={
355+
'split': [
356+
{ '@value': 'A, B, C', '@type': 'xsd:string' },
357+
{"@type": "xsd:string", "@value": ", "},
358+
"v:list_obj"
359+
]
360+
};
361+
362+
expect(woqlObject.json()).to.eql(jsonObj);
363+
364+
})
350365

351366
it('check the list method',function(){
352367

@@ -358,6 +373,15 @@ describe('woql queries', function () {
358373

359374
})
360375

376+
it('check the member method',function(){
377+
378+
const woqlObject=WOQL.member("v:member", "v:list_obj");
379+
const jsonObj={ 'member': [ 'v:member', 'v:list_obj' ] };
380+
381+
expect(woqlObject.json()).to.eql(jsonObj);
382+
383+
})
384+
361385
it('check the group_by method',function(){
362386
const woqlObject=WOQL.group_by(["v:A", "v:B"],["v:C"],"v:New");
363387
const jsonObj={ group_by: [ {list: ['v:A', "v:B"]}, {list: ["v:C"]}, {}, "v:New"] };

0 commit comments

Comments
 (0)