-
Notifications
You must be signed in to change notification settings - Fork 16
fix: #78 updated woql schema #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: NeelParihar <neel@terminusdb.com>
Oh okay will do that and let you know if i need anything |
|
Should i keep the name of the functions as delete_document or delete_objects @GavinMendelGleason |
Can you create new names and keep the old ones for backwards-compatibility? The new ones should have the documentation (if there is any), but the old ones don't need to go. |
|
Would this work? WOQLQuery.prototype.read_document = function ... {
...
}
WOQLQuery.prototype.read_object = WOQLQuery.prototype.read_document |
|
I dont think there is already a function in WOQL for delete document and update document, so i dont think it will create any type of problem |
Oh you are talking about the read_object yes it is already there but do we need to rename it as well ? |
|
I see that in #75 gavin has referenced it as delete_document so i will go with this name for now |
I don't know. I'm always for consistent naming, and I see |
|
Oh okay i will create a new function called as read_document and depreciate the old one in documentation |
|
See #78 (comment). |
Signed-off-by: NeelParihar <neel@terminusdb.com>
Signed-off-by: NeelParihar <neel@terminusdb.com>
spl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't suppose we have any tests for things like this, do we? Otherwise, there are just a few simple changes.
lib/query/woqlQuery.js
Outdated
| } | ||
|
|
||
| WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { | ||
| //if (IRI && IRI == 'args') return ['document_uri', 'document'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually that was already commented in the earlier read_object funtion i thought there will be a reason it is like that, i will uncomment it
lib/query/woqlQuery.js
Outdated
| } | ||
|
|
||
| WOQLQuery.prototype.insert_document = function(docjson, IRI) { | ||
| //if (IRI && IRI == 'args') return ['document_uri', 'document'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment.
lib/query/woqlQuery.js
Outdated
| this.cursor['@type'] = 'InsertDocument' | ||
| if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) | ||
|
|
||
| let doc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of declaring doc here, can you just do the assignment to this.cursor['document'] directly in each block of the if/else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh didn't look it that way
lib/query/woqlQuery.js
Outdated
| } | ||
|
|
||
| WOQLQuery.prototype.update_document = function(docjson, IRI) { | ||
| //if (IRI && IRI == 'args') return ['document_uri', 'document'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment.
lib/query/woqlQuery.js
Outdated
| this.cursor['@type'] = 'UpdateDocument' | ||
| if(typeof IRI !== 'undefined') this.cursor['identifier'] = this.cleanNodeValue(IRI) | ||
|
|
||
| let doc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above about assigning this.cursor['document'] directly.
lib/query/woqlQuery.js
Outdated
| } | ||
|
|
||
| WOQLQuery.prototype.delete_document = function(IRI) { | ||
| //if (IRI && IRI == 'args') return ['document_uri', 'document'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment.
| return this.wform(Format) | ||
| } | ||
|
|
||
| WOQLQuery.prototype.read_document = function(IRI, OutputVar, Format) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition of WOQLQuery.prototype.read_object no longer works, so, in the goal of keeping things working and compatible, can you delete the definition and add this?
WOQLQuery.prototype.read_object = WOQLQuery.prototype.read_documentFor clarity, that should probably go after the WOQLQuery.prototype.read_document definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding this here i think it would be better if i add this
return new WOQLQuery().read_document(IRI, output, formatObj)in here
terminusdb-client-js/lib/woql.js
Line 104 in 6d56272
| return new WOQLQuery().read_object(IRI, output, formatObj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but isn't WOQLQuery.prototype.read_object still wrong? We don't have ReadObject anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup so should i just remove it ? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, just remove it. I confirmed with @Francesca-Bit that it's no longer accessible.
lib/woql.js
Outdated
|
|
||
| /** | ||
| * 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than add this, can you add a message to @deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added it but it was not adding the text after the @deprecated so i added the tag and wrote the line here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Fine then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I learned from @Francesca-Bit that you can @link another name. So I suggest removing all documentation for read_object and adding something like this:
/**
* Use {@link WOQL.read_document} instead.
* @deprecated
*/Just check the link to make sure it's correct. I haven't tested it.
lib/woql.js
Outdated
| /** | ||
| * 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An optional identifier specifying the document location. I realize that this is wrong in the woql.json.
lib/woql.js
Outdated
| /** | ||
| * 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An optional identifier specifying the document location.
Signed-off-by: NeelParihar <neel@terminusdb.com>
Signed-off-by: NeelParihar <neel@terminusdb.com>
Signed-off-by: NeelParihar <neel@terminusdb.com>
lib/woql.js
Outdated
|
|
||
| /** | ||
| * 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I learned from @Francesca-Bit that you can @link another name. So I suggest removing all documentation for read_object and adding something like this:
/**
* Use {@link WOQL.read_document} instead.
* @deprecated
*/Just check the link to make sure it's correct. I haven't tested it.
Signed-off-by: NeelParihar <neel@terminusdb.com>
spl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding tests!
|
Thank you so much @spl for the detailed review of the PR 😄 |
fixes #78 #75
Signed-off-by: NeelParihar neel@terminusdb.com