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

fix!: add upgrade plugin that fixes invalid date serialisations #2081

Merged

Conversation

BalduinLandolt
Copy link
Collaborator

@BalduinLandolt BalduinLandolt commented Jun 21, 2022

Resolves DEV-1033

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe: Data cleanup by means of an upgrade script

What is the current behavior?

Issue Number: DEV-1033

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Major version bump is required to run the upgrade plugin.

Other information

@BalduinLandolt BalduinLandolt self-assigned this Jun 21, 2022
@BalduinLandolt BalduinLandolt marked this pull request as ready for review June 23, 2022 08:31
Copy link

@irinaschubert irinaschubert left a comment

Choose a reason for hiding this comment

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

There are specific dates for values (valueCreationDate etc.). Did you check if they were affected as well? And/or if they are updated as well?

@@ -90,7 +90,7 @@ WHERE {

@maybeLastModificationDate match {
case Some(lastModificationDate) => {
?resource knora-base:lastModificationDate "@lastModificationDate"^^xsd:dateTime .
?resource knora-base:lastModificationDate ?lastModificationDate .

Choose a reason for hiding this comment

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

Is the last modification date still typed in the triplestore with this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, I'm just using whatever is in the triplestore already rather than the value passed to he template, when deleting the old last modification date. (The idea is to make this independent of the serialization in the triplestore)

Choose a reason for hiding this comment

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

Ah, I misread it. It's only inside the DELETE and WHERE clause, the INSERT still has the typed version! Ignore my comment then.

Copy link

@irinaschubert irinaschubert left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@mpro7 mpro7 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, but check the comments for some cosmetic things to fix. Also it will not change much in term of versioning, but this is rather fix than feat.

knora-ontologies/knora-base.ttl Show resolved Hide resolved
Comment on lines +23 to +24
val statementsToRemove: collection.mutable.Set[Statement] = collection.mutable.Set.empty
val statementsToAdd: collection.mutable.Set[Statement] = collection.mutable.Set.empty
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks familiarly inelegant 🤣

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm glad you dislike it too! xD

Makefile Outdated
Comment on lines 281 to 286
.PHONY: init-db-test-from-ls-test-server-trig-file
init-db-test-from-ls-test-server-trig-file: init-db-test-empty ## init local database with data from a local ls-test-server dump
@echo $@
@curl -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "admin:test" "http://localhost:3030/knora-test"
@curl -X POST -H "Content-Type: application/trig" --data-binary "@${CURRENT_DIR}/db_ls_test_server_dump.trig" -u "admin:test" "http://localhost:3030/knora-test"

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO we could have above init-db-test-from-ls-test-server make command split into 2 steps anyway

  • dump the data first
  • load it from that file

So basically command introduced by you stays and the other one could be reduced. Reason for that is the huge amount of data and the issue with that file if the download dies before it ends.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was my initial thought. (Additionally, once downloaded, you don't need the password anymore, which is nice.)

But I didn't want to mess with the other make target, so I thought I'd add a separate one. Do you think it makes a difference?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can leave it like that for now, I might fo it later on. I had some problems with dumping the data and then you need to remember to remove the file otherwise another error appears. This could be overall improved but not the scope of this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

makes sense, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you quickly add what Marcin suggested? It follows the pattern we are using in other cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@BalduinLandolt BalduinLandolt changed the title feat!: add upgrade plugin that fixes old, invalid date serialisations fix!: add upgrade plugin that fixes old, invalid date serialisations Jun 23, 2022
@BalduinLandolt BalduinLandolt changed the title fix!: add upgrade plugin that fixes old, invalid date serialisations fix!: add upgrade plugin that fixes invalid date serialisations Jun 23, 2022
@sonarcloud
Copy link

sonarcloud bot commented Jun 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Makefile Show resolved Hide resolved
@BalduinLandolt BalduinLandolt merged commit 3a0902e into main Jun 27, 2022
@BalduinLandolt BalduinLandolt deleted the wip/DEV-1033-fix-incorrectly-serialized-date-values branch June 27, 2022 09:48
@daschbot daschbot mentioned this pull request Jun 27, 2022
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.

None yet

4 participants