-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat(api-v2): Return value UUID on value creation and update #1602
Conversation
@tobiasschweizer This is a bit more work than I thought it would be, because currently all the UUID creation is done in Twirl templates. |
It's not a problem if you need more time to work on this. So far, we still have a lot of work to do that does not depend on this PR. |
It's done now. |
Sorry, I kind of missed this. Thank you very much, I will do the review asap! |
I will also do a PR on knora-api-js-lib and change the message classes. |
Is there JSON test data for a successful response to a value creation / update? |
I integrated this PR here: dasch-swiss/dsp-js-lib#151 |
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 wonder why you did not have to update JSON test data (adding UUID). Or is it that you don't use JSON test data because you can't know what a value's IRI and UUID are going to be?
@benjamingeer Do you think you could create test data for the responses too (see #1602 (comment))? |
@tobiasschweizer There's no need to ask me three times. :) |
So far, the generation of test data doesn't actually update the repository. This is why there is no test response for creating a value. So I guess there are two options:
Which do you think is better? |
I think a simulated response would do it. Could you generate the simulated response from an instance of a case class that is then serialized to JSON-LD? If the original case class changes or its serialization in JSON-LD, the simulated response will too. |
Good idea, I'll do that. |
Done in e3e1727. |
Thanks a lot for this! I will see if I can integrate this tomorrow, otherwise after my holiday. |
Done in 673bff4. |
@@ -127,7 +128,7 @@ INSERT { | |||
knora-base:valueHasRefCount @linkUpdateForNewLink.newReferenceCount ; | |||
knora-base:valueHasOrder ?order ; | |||
knora-base:isDeleted false ; | |||
knora-base:valueHasUUID "@{stringFormatter.base64EncodeUuid(UUID.randomUUID)}" ; | |||
knora-base:valueHasUUID "@{stringFormatter.base64EncodeUuid(newLinkValueUUID)}" ; |
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.
When the target of a link is changed, then the UUID is changed to? Is this because it has to be considered a new value (not a different version of the same value)?
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.
That's right. This was a design decision that Lukas and I made a long time ago. We thought that if you change the rdf:object
of a reification, it wouldn't make sense to consider it a new version of the same reification, because it no longer reifies the same triple. So when you change a link's target, the old LinkValue
is deleted, and a new one is created.
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 figure when you just change the comment, the uuid stays the same, right?
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.
Yes, if you just change the comment or any other metadata.
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 a lot for this PR! This should make the client's life easier.
Thanks for asking for this and doing the review! |
This PR makes API v2 return the UUID of a value when it is created or updated.
Resolves #1595.