From 14b4c221f337cb736318322ce27ef387eea49ba6 Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Tue, 30 Nov 2021 15:58:36 +0530 Subject: [PATCH 01/10] fix: #78 updated woql schema Signed-off-by: NeelParihar --- lib/query/woqlCore.js | 4 ++-- lib/query/woqlQuery.js | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/query/woqlCore.js b/lib/query/woqlCore.js index 969b6bad..54748b23 100644 --- a/lib/query/woqlCore.js +++ b/lib/query/woqlCore.js @@ -55,8 +55,8 @@ function WOQLQuery(query) { 'DeleteTriple', 'AddQuad', 'DeleteQuad', - 'DeleteObject', - 'UpdateObject', + 'DeleteDocument', + 'UpdateDocument', ] this.vocab = this.loadDefaultVocabulary() diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index a2c2ac81..fe8760cd 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -12,8 +12,8 @@ let WOQLQuery = require('./woqlCore') WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { //if (IRI && IRI == 'args') return ['document_uri', 'document'] if (this.cursor['@type']) this.wrapCursorWithAnd() - this.cursor['@type'] = 'ReadObject' - this.cursor['document_uri'] = this.expandValueVariable(IRI) + this.cursor['@type'] = 'ReadDocument' + this.cursor['identifier'] = this.expandValueVariable(IRI) this.cursor['document'] = this.expandValueVariable(OutputVar) return this.wform(Format) } @@ -39,14 +39,14 @@ WOQLQuery.prototype.wrapCursorWithAnd = function() { } } -WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { - //if (IRI && IRI == 'args') return ['document_uri', 'document'] - if (this.cursor['@type']) this.wrapCursorWithAnd() - this.cursor['@type'] = 'ReadObject' - this.cursor['document_uri'] = this.expandValueVariable(IRI) - this.cursor['document'] = this.expandValueVariable(OutputVar) - return this.wform(Format) -} +// WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { +// //if (IRI && IRI == 'args') return ['document_uri', 'document'] +// if (this.cursor['@type']) this.wrapCursorWithAnd() +// this.cursor['@type'] = 'ReadObject' +// this.cursor['document_uri'] = this.expandValueVariable(IRI) +// this.cursor['document'] = this.expandValueVariable(OutputVar) +// return this.wform(Format) +// } WOQLQuery.prototype.using = function(Collection, Subq) { //if (Collection && Collection == 'args') From b962e0be93cfe66318bd42709c1a78056557fa47 Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Thu, 2 Dec 2021 12:29:59 +0530 Subject: [PATCH 02/10] added new document modification functions for WOQL Signed-off-by: NeelParihar --- docs/_sidebar.md | 5 +++- docs/api/woql.js.md | 52 ++++++++++++++++++++++++++++++++++- lib/query/woqlQuery.js | 61 +++++++++++++++++++++++++++++++++++------- lib/woql.js | 47 +++++++++++++++++++++++++++++++- 4 files changed, 153 insertions(+), 12 deletions(-) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 4e695277..9420b928 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -66,7 +66,10 @@ - [select](api/woql.js?id=select) - [distinct](api/woql.js?id=distinct) - [and](api/woql.js?id=and) - - [read_object](api/woql.js?id=read_object) + - [read_document](api/woql.js?id=read_document) + - [insert_document](api/woql.js?id=insert_document) + - [update_document](api/woql.js?id=update_document) + - [delete_document](api/woql.js?id=delete_document) - [or](api/woql.js?id=or) - [from](api/woql.js?id=from) - [into](api/woql.js?id=into) diff --git a/docs/api/woql.js.md b/docs/api/woql.js.md index a04ba573..85475bef 100644 --- a/docs/api/woql.js.md +++ b/docs/api/woql.js.md @@ -93,7 +93,22 @@ WOQL.and( ``` ### read_object -#### WOQL.read\_object(IRI, output, formatObj) ⇒ object +#### ~~WOQL.read\_object(IRI, output, formatObj) ⇒ object~~ +***Deprecated*** + +[Instead use read_document] Read a node identified by an IRI as a JSON-LD document + +**Returns**: object - WOQLQuery + +| Param | Type | Description | +| --- | --- | --- | +| IRI | string | The document id or a variable | +| output | string | variable name | +| formatObj | object | | + + +### read_document +#### WOQL.read\_document(IRI, output, formatObj) ⇒ object Read a node identified by an IRI as a JSON-LD document **Returns**: object - WOQLQuery @@ -105,6 +120,41 @@ Read a node identified by an IRI as a JSON-LD document | formatObj | object | | +### insert_document +#### WOQL.insert\_document(docjson, [IRI]) ⇒ object +Insert a document in the graph. + +**Returns**: object - WOQLQuery + +| Param | Type | Description | +| --- | --- | --- | +| docjson | object | The document to insert. Must either have an '@id' or have a class specified key. | +| [IRI] | string | An optional returned identifier specifying the documentation location. | + + +### update_document +#### WOQL.update\_document(docjson, [IRI]) ⇒ object +Update a document identified by an IRI + +**Returns**: object - WOQLQuery + +| Param | Type | Description | +| --- | --- | --- | +| docjson | object | The document to update. Must either have an '@id' or have a class specified key. | +| [IRI] | string | An optional returned identifier specifying the documentation location. | + + +### delete_document +#### WOQL.delete\_document(IRI) ⇒ object +Delete a document from the graph. + +**Returns**: object - WOQLQuery + +| Param | Type | Description | +| --- | --- | --- | +| IRI | string | The document id or a variable | + + ### or #### WOQL.or(...subqueries) ⇒ WOQLQuery Creates a logical OR of the arguments diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index fe8760cd..969cf0c2 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -12,12 +12,63 @@ let WOQLQuery = require('./woqlCore') WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { //if (IRI && IRI == 'args') return ['document_uri', 'document'] if (this.cursor['@type']) this.wrapCursorWithAnd() - this.cursor['@type'] = 'ReadDocument' + this.cursor['@type'] = 'ReadObject' this.cursor['identifier'] = this.expandValueVariable(IRI) this.cursor['document'] = this.expandValueVariable(OutputVar) return this.wform(Format) } +WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { + //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (this.cursor['@type']) this.wrapCursorWithAnd() + this.cursor['@type'] = 'ReadDocument' + this.cursor['identifier'] = this.cleanNodeValue(IRI) + this.cursor['document'] = this.expandValueVariable(OutputVar) + return this.wform(Format) +} + +WOQLQuery.prototype.insert_document = function(docjson, IRI) { + //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (this.cursor['@type']) this.wrapCursorWithAnd() + this.cursor['@type'] = 'InsertDocument' + if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) + + let doc; + if(typeof docjson === 'string') { + doc = this.expandValueVariable(docjson); + } else { + doc = docjson; + } + + this.cursor['document'] = doc; + return this.updated() +} + +WOQLQuery.prototype.update_document = function(docjson, IRI) { + //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (this.cursor['@type']) this.wrapCursorWithAnd() + this.cursor['@type'] = 'UpdateDocument' + if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) + + let doc; + if(typeof docjson === 'string') { + doc = this.expandValueVariable(docjson); + } else { + doc = docjson; + } + + this.cursor['document'] = doc; + return this.updated() +} + +WOQLQuery.prototype.delete_document = function(IRI) { + //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (this.cursor['@type']) this.wrapCursorWithAnd() + this.cursor['@type'] = 'DeleteDocument' + this.cursor['identifier'] = this.cleanNodeValue(IRI) + return this.updated() +} + /** * Contains definitions of the WOQL functions which map directly to JSON-LD types * All other calls and queries can be composed from these @@ -39,14 +90,6 @@ WOQLQuery.prototype.wrapCursorWithAnd = function() { } } -// WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { -// //if (IRI && IRI == 'args') return ['document_uri', 'document'] -// if (this.cursor['@type']) this.wrapCursorWithAnd() -// this.cursor['@type'] = 'ReadObject' -// this.cursor['document_uri'] = this.expandValueVariable(IRI) -// this.cursor['document'] = this.expandValueVariable(OutputVar) -// return this.wform(Format) -// } WOQLQuery.prototype.using = function(Collection, Subq) { //if (Collection && Collection == 'args') diff --git a/lib/woql.js b/lib/woql.js index 93632000..23cb7b9a 100644 --- a/lib/woql.js +++ b/lib/woql.js @@ -92,17 +92,62 @@ WOQL.and = function(...subqueries) { /** - * Read a node identified by an IRI as a JSON-LD document + * [Instead use read_document] Read a node identified by an IRI as a JSON-LD document * @param {string} IRI - The document id or a variable * @param {string} output - variable name * @param {object} formatObj * @return {object} WOQLQuery + * @deprecated */ WOQL.read_object = function(IRI, output, formatObj) { return new WOQLQuery().read_object(IRI, output, formatObj) } +/** + * Read a node identified by an IRI as a JSON-LD document + * @param {string} IRI - The document id or a variable + * @param {string} output - variable name + * @param {object} formatObj + * @return {object} WOQLQuery + */ + + WOQL.read_document = function(IRI, output, formatObj) { + return new WOQLQuery().read_document(IRI, output, formatObj) +} + +/** + * Insert a document in the graph. + * @param {object} docjson - The document to insert. Must either have an '@id' or have a class specified key. + * @param {string} [IRI] - An optional returned identifier specifying the documentation location. + * @return {object} WOQLQuery + */ + +WOQL.insert_document = function(docjson, IRI) { + return new WOQLQuery().insert_document(docjson, IRI) +} + +/** + * Update a document identified by an IRI + * @param {object} docjson - The document to update. Must either have an '@id' or have a class specified key. + * @param {string} [IRI] - An optional returned identifier specifying the documentation location. + * @return {object} WOQLQuery + */ + +WOQL.update_document = function(docjson, IRI) { + return new WOQLQuery().update_document(docjson, IRI) +} + +/** + * Delete a document from the graph. + * @param {string} IRI - The document id or a variable + * @return {object} WOQLQuery + */ + +WOQL.delete_document = function(IRI) { + return new WOQLQuery().delete_document(IRI) +} + /** * Creates a logical OR of the arguments * @param {...WOQLQuery} subqueries - A list of one or more woql queries to execute as alternatives From 6d56272b37bfb5937017a88e491415ded25cebbf Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Thu, 2 Dec 2021 12:32:34 +0530 Subject: [PATCH 03/10] updated ready_object Signed-off-by: NeelParihar --- lib/query/woqlQuery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index 969cf0c2..be851edc 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -13,7 +13,7 @@ WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { //if (IRI && IRI == 'args') return ['document_uri', 'document'] if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'ReadObject' - this.cursor['identifier'] = this.expandValueVariable(IRI) + this.cursor['document_uri'] = this.expandValueVariable(IRI) this.cursor['document'] = this.expandValueVariable(OutputVar) return this.wform(Format) } From ca9b5dec7f8c88025b8ea132655f2b4b8a8a35c7 Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Sun, 5 Dec 2021 12:35:48 +0530 Subject: [PATCH 04/10] updated schema documentation Signed-off-by: NeelParihar --- docs/api/woql.js.md | 4 ++-- lib/woql.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api/woql.js.md b/docs/api/woql.js.md index 85475bef..e8b42141 100644 --- a/docs/api/woql.js.md +++ b/docs/api/woql.js.md @@ -129,7 +129,7 @@ Insert a document in the graph. | Param | Type | Description | | --- | --- | --- | | docjson | object | The document to insert. Must either have an '@id' or have a class specified key. | -| [IRI] | string | An optional returned identifier specifying the documentation location. | +| [IRI] | string | An optional identifier specifying the document location. | ### update_document @@ -141,7 +141,7 @@ Update a document identified by an IRI | Param | Type | Description | | --- | --- | --- | | docjson | object | The document to update. Must either have an '@id' or have a class specified key. | -| [IRI] | string | An optional returned identifier specifying the documentation location. | +| [IRI] | string | An optional identifier specifying the document location. | ### delete_document diff --git a/lib/woql.js b/lib/woql.js index 23cb7b9a..b296e998 100644 --- a/lib/woql.js +++ b/lib/woql.js @@ -101,7 +101,7 @@ WOQL.and = function(...subqueries) { */ WOQL.read_object = function(IRI, output, formatObj) { - return new WOQLQuery().read_object(IRI, output, formatObj) + return new WOQLQuery().read_document(IRI, output, formatObj) } /** @@ -119,7 +119,7 @@ WOQL.read_object = function(IRI, output, formatObj) { /** * Insert a document in the graph. * @param {object} docjson - The document to insert. Must either have an '@id' or have a class specified key. - * @param {string} [IRI] - An optional returned identifier specifying the documentation location. + * @param {string} [IRI] - An optional identifier specifying the document location. * @return {object} WOQLQuery */ @@ -130,7 +130,7 @@ WOQL.insert_document = function(docjson, IRI) { /** * Update a document identified by an IRI * @param {object} docjson - The document to update. Must either have an '@id' or have a class specified key. - * @param {string} [IRI] - An optional returned identifier specifying the documentation location. + * @param {string} [IRI] - An optional identifier specifying the document location. * @return {object} WOQLQuery */ From 393d1830bf7cc89b753603b4deb332a522176d47 Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Sun, 5 Dec 2021 12:36:32 +0530 Subject: [PATCH 05/10] updated document schma logic Signed-off-by: NeelParihar --- lib/query/woqlQuery.js | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index be851edc..9632b4fc 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -9,17 +9,8 @@ let WOQLQuery = require('./woqlCore') } }*/ -WOQLQuery.prototype.read_object = function(IRI, OutputVar, Format) { - //if (IRI && IRI == 'args') return ['document_uri', 'document'] - if (this.cursor['@type']) this.wrapCursorWithAnd() - this.cursor['@type'] = 'ReadObject' - this.cursor['document_uri'] = this.expandValueVariable(IRI) - this.cursor['document'] = this.expandValueVariable(OutputVar) - return this.wform(Format) -} - WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { - //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (IRI && IRI === 'args') return ['document_uri', 'document']; if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'ReadDocument' this.cursor['identifier'] = this.cleanNodeValue(IRI) @@ -28,41 +19,37 @@ WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { } WOQLQuery.prototype.insert_document = function(docjson, IRI) { - //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (IRI && IRI === 'args') return ['document_uri', 'document']; if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'InsertDocument' if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) - let doc; if(typeof docjson === 'string') { - doc = this.expandValueVariable(docjson); + this.cursor['document'] = this.expandValueVariable(docjson); } else { - doc = docjson; + this.cursor['document'] = docjson; } - this.cursor['document'] = doc; return this.updated() } WOQLQuery.prototype.update_document = function(docjson, IRI) { - //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (IRI && IRI === 'args') return ['document_uri', 'document']; if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'UpdateDocument' if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) - let doc; if(typeof docjson === 'string') { - doc = this.expandValueVariable(docjson); + this.cursor['document'] = this.expandValueVariable(docjson); } else { - doc = docjson; + this.cursor['document'] = docjson; } - this.cursor['document'] = doc; return this.updated() } WOQLQuery.prototype.delete_document = function(IRI) { - //if (IRI && IRI == 'args') return ['document_uri', 'document'] + if (IRI && IRI === 'args') return ['document_uri', 'document'] if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'DeleteDocument' this.cursor['identifier'] = this.cleanNodeValue(IRI) From 6d9959794a334de54e7a9886a568c4cc29f3b41f Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Sun, 5 Dec 2021 13:05:17 +0530 Subject: [PATCH 06/10] added tests for document woql schema queries Signed-off-by: NeelParihar --- test/woql.spec.js | 24 ++++++++++++++++++++++++ test/woqlJson/woqlJson.js | 19 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/test/woql.spec.js b/test/woql.spec.js index 3e69a5c5..4814c4bf 100644 --- a/test/woql.spec.js +++ b/test/woql.spec.js @@ -393,4 +393,28 @@ describe('woql queries', function () { //console.log(JSON.stringify(woqlObject01.json(), null, 4)); }) + it('check the read_document method',function(){ + const woqlObject=WOQL.read_document("A", "B", {}); + + expect(woqlObject.json()).to.eql(woqlJson.readDocJson); + }) + + it('check the insert_document method',function(){ + const woqlObject=WOQL.insert_document("A", "B"); + + expect(woqlObject.json()).to.eql(woqlJson.insertDocJson); + }) + + it('check the update_document method',function(){ + const woqlObject=WOQL.update_document("A", "B"); + + expect(woqlObject.json()).to.eql(woqlJson.updateDocJson); + }) + + it('check the delete_document method',function(){ + const woqlObject=WOQL.delete_document("A"); + + expect(woqlObject.json()).to.eql(woqlJson.deleteDocJson); + }) + }) diff --git a/test/woqlJson/woqlJson.js b/test/woqlJson/woqlJson.js index e24bd054..75de9df4 100644 --- a/test/woqlJson/woqlJson.js +++ b/test/woqlJson/woqlJson.js @@ -1102,4 +1102,23 @@ module.exports = { }, ], }, + readDocJson: { + '@type': 'ReadDocument', + identifier: { '@type': 'NodeValue', node: 'A' }, + document: { '@type': 'Value', node: 'B' } + }, + insertDocJson: { + '@type': 'InsertDocument', + identifier: { '@type': 'NodeValue', node: 'B' }, + document: { '@type': 'Value', node: 'A' } + }, + updateDocJson: { + '@type': 'UpdateDocument', + identifier: { '@type': 'NodeValue', node: 'B' }, + document: { '@type': 'Value', node: 'A' } + }, + deleteDocJson: { + '@type': 'DeleteDocument', + identifier: { '@type': 'NodeValue', node: 'A' }, + }, } From 67174c2edf14cfede55757e24de4e2ae2170697b Mon Sep 17 00:00:00 2001 From: NeelParihar Date: Mon, 6 Dec 2021 18:07:17 +0530 Subject: [PATCH 07/10] updated documentation for read_object Signed-off-by: NeelParihar --- docs/api/woql.js.md | 12 ++---------- lib/woql.js | 8 ++------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/docs/api/woql.js.md b/docs/api/woql.js.md index e8b42141..c52aeeb7 100644 --- a/docs/api/woql.js.md +++ b/docs/api/woql.js.md @@ -93,18 +93,10 @@ WOQL.and( ``` ### read_object -#### ~~WOQL.read\_object(IRI, output, formatObj) ⇒ object~~ +#### ~~WOQL.read\_object()~~ ***Deprecated*** -[Instead use read_document] Read a node identified by an IRI as a JSON-LD document - -**Returns**: object - WOQLQuery - -| Param | Type | Description | -| --- | --- | --- | -| IRI | string | The document id or a variable | -| output | string | variable name | -| formatObj | object | | +Use [#read_document](#read_document) instead. ### read_document diff --git a/lib/woql.js b/lib/woql.js index b296e998..3e7d6088 100644 --- a/lib/woql.js +++ b/lib/woql.js @@ -92,12 +92,8 @@ WOQL.and = function(...subqueries) { /** - * [Instead use read_document] Read a node identified by an IRI as a JSON-LD document - * @param {string} IRI - The document id or a variable - * @param {string} output - variable name - * @param {object} formatObj - * @return {object} WOQLQuery - * @deprecated + * Use {@link #read_document} instead. + * @deprecated */ WOQL.read_object = function(IRI, output, formatObj) { From 2873cc30a1ed9ff427442b463517e2d6416d7b5c Mon Sep 17 00:00:00 2001 From: Sean Leather Date: Mon, 6 Dec 2021 19:45:22 +0200 Subject: [PATCH 08/10] Minor fixes --- docs/api/woql.js.md | 2 +- lib/query/woqlQuery.js | 4 ---- lib/woql.js | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/api/woql.js.md b/docs/api/woql.js.md index c52aeeb7..1a239df7 100644 --- a/docs/api/woql.js.md +++ b/docs/api/woql.js.md @@ -96,7 +96,7 @@ WOQL.and( #### ~~WOQL.read\_object()~~ ***Deprecated*** -Use [#read_document](#read_document) instead. +Use [read_document](#read_document) instead. ### read_document diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index 9632b4fc..964ff0a2 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -10,7 +10,6 @@ let WOQLQuery = require('./woqlCore') }*/ WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { - if (IRI && IRI === 'args') return ['document_uri', 'document']; if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'ReadDocument' this.cursor['identifier'] = this.cleanNodeValue(IRI) @@ -19,7 +18,6 @@ WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { } WOQLQuery.prototype.insert_document = function(docjson, IRI) { - if (IRI && IRI === 'args') return ['document_uri', 'document']; if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'InsertDocument' if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) @@ -34,7 +32,6 @@ WOQLQuery.prototype.insert_document = function(docjson, IRI) { } WOQLQuery.prototype.update_document = function(docjson, IRI) { - if (IRI && IRI === 'args') return ['document_uri', 'document']; if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'UpdateDocument' if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) @@ -49,7 +46,6 @@ WOQLQuery.prototype.update_document = function(docjson, IRI) { } WOQLQuery.prototype.delete_document = function(IRI) { - if (IRI && IRI === 'args') return ['document_uri', 'document'] if (this.cursor['@type']) this.wrapCursorWithAnd() this.cursor['@type'] = 'DeleteDocument' this.cursor['identifier'] = this.cleanNodeValue(IRI) diff --git a/lib/woql.js b/lib/woql.js index 3e7d6088..2caaa540 100644 --- a/lib/woql.js +++ b/lib/woql.js @@ -92,7 +92,7 @@ WOQL.and = function(...subqueries) { /** - * Use {@link #read_document} instead. + * Use {@link #read_document|read_document} instead. * @deprecated */ From df00759b205b3f1cb5b8738b4a70562af2eef90d Mon Sep 17 00:00:00 2001 From: Sean Leather Date: Mon, 6 Dec 2021 19:48:43 +0200 Subject: [PATCH 09/10] Remove extra WOQL.read_object --- lib/woql.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/woql.js b/lib/woql.js index 2caaa540..5210d5f5 100644 --- a/lib/woql.js +++ b/lib/woql.js @@ -1156,10 +1156,6 @@ WOQL.string = function(val) { return new WOQLQuery().string(val) } -WOQL.read_object = function(IRI, output, formatObj) { - return new WOQLQuery().read_object(IRI, output, formatObj) -} - /** * Generates explicitly a JSON-LD string literal from the input * @param {string} val - any literal type From 570098e422b8a935cf7d0c806a3da96414690139 Mon Sep 17 00:00:00 2001 From: Sean Leather Date: Mon, 6 Dec 2021 19:53:38 +0200 Subject: [PATCH 10/10] Fix space --- lib/query/woqlQuery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index 9e73865c..28fdadf1 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -27,7 +27,7 @@ WOQLQuery.prototype.insert_document = function(docjson, IRI) { } else { this.cursor['document'] = docjson; } - + return this.updated() }