Skip to content

Commit 449e3fd

Browse files
Simplify object cleaning
1 parent ac6da9d commit 449e3fd

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

lib/query/woqlCore.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,6 @@ WOQLQuery.prototype.asv = function(colname_or_index, vname, type) {
155155
return asvar
156156
}
157157

158-
/**
159-
* Adds a variable to a json-ld as variable list
160-
*/
161-
WOQLQuery.prototype.addASV = function(cursor, asv) {
162-
if (asv['@type'] == 'IndexedAsVar') {
163-
if (!cursor['indexed_as_var']) cursor['indexed_as_var'] = []
164-
cursor['indexed_as_var'].push(asv)
165-
} else {
166-
if (!cursor['named_as_var']) cursor['named_as_var'] = []
167-
cursor['named_as_var'].push(asv)
168-
}
169-
}
170-
171158
/**
172159
* JSON LD Format Descriptor
173160
* @param {object} opts
@@ -320,18 +307,17 @@ WOQLQuery.prototype.cleanPathPredicate = function(p) {
320307
WOQLQuery.prototype.cleanObject = function(o, t) {
321308
let obj = {'@type': 'Value'}
322309
if (typeof o === 'string') {
323-
if (this.looksLikeClass(o)) {
324-
return this.cleanClass(o)
325-
} else if (this.vocab && this.vocab[o]) {
326-
return this.cleanClass(this.vocab[o])
327-
} else if (s.indexOf('v:') !== -1) {
310+
if (o.indexOf('v:') !== -1) {
328311
return this.expandValueVariable(o)
329312
} else {
330-
obj['data'] = this.jlt(o, t)
313+
obj['node'] = o
331314
}
332315
} else if (typeof o == 'number') {
333316
t = t || 'xsd:decimal'
334317
obj['data'] = this.jlt(o, t)
318+
} else if (typeof o == 'boolean') {
319+
t = t || 'xsd:boolean'
320+
obj['data'] = this.jlt(o, t)
335321
} else if (typeof o == 'object' && o) {
336322
if (o['@value']) obj['data'] = o
337323
else return o

0 commit comments

Comments
 (0)