Skip to content
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

chore(standoff): Use Base64-encoded UUIDs in standoff tags #1301

Merged
merged 3 commits into from
Apr 18, 2019

Conversation

benjamingeer
Copy link

@benjamingeer benjamingeer commented Apr 11, 2019

This PR stores the UUIDs of standoff tags in Base64 encoding to make them shorter. This should make triplestore query results somewhat shorter. The change is backwards-compatible; existing UUIDs will still work.

  • Change StandoffTagV2 to store its UUID as a java.util.UUID object instead of a string.
  • Change SPARQL update templates to use KnoraIdUtil to Base64-encode standoff UUIDs.
  • Change StandoffTagUtilV2 to decode Base64-encoded UUIDs.

@tobiasschweizer
Copy link
Contributor

@benjamingeer I will do the review on Monday, ok?

@benjamingeer
Copy link
Author

I will do the review on Monday, ok?

No problem, thanks!

@tobiasschweizer
Copy link
Contributor

On Monday, I will have fresh energy and be extra annoying ;-)

@benjamingeer
Copy link
Author

Ich freue mich auf deine Erbsenzählerei. :)

@@ -774,7 +778,7 @@ object StandoffTagUtilV2 {
case Some(endIndex: String) => Some(endIndex.toInt)
case None => None
},
uuid = standoffNodes(OntologyConstants.KnoraBase.StandoffTagHasUUID),
uuid = knoraIdUtil.decodeUuid(standoffNodes(OntologyConstants.KnoraBase.StandoffTagHasUUID)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works both with the old string format and the new shorter UUIDs because KnoraIdUtil.decodeUuid handles both cases:

https://github.com/dhlab-basel/Knora/blob/64db4278af5eb41175a2694b4436f66ef0385f65/webapi/src/main/scala/org/knora/webapi/util/KnoraIdUtil.scala#L160-L166

Is this correct?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that’s right.

Copy link
Contributor

@tobiasschweizer tobiasschweizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@benjamingeer
Copy link
Author

Thanks for the review!

@benjamingeer benjamingeer merged commit 20736f7 into develop Apr 18, 2019
@benjamingeer benjamingeer deleted the wip/shorten-standoff-uuids branch April 18, 2019 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants