-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New study.yml format #13844
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
New study.yml format #13844
Conversation
…ns from the current study.yml version to the new one
…n and parsing of study.yml if needed
…r to avoid deadlock
…igrator to JSpecify annotations
…nstead of StudyYamlParser
…ith the rest of the codebase
… from getCatalogSpecific form StudyQuery
| @@ -8,7 +8,7 @@ | |||
| import org.jabref.logic.importer.ImportFormatPreferences; | |||
| import org.jabref.logic.importer.ImporterPreferences; | |||
| import org.jabref.model.study.Study; | |||
| import org.jabref.model.study.StudyDatabase; | |||
| import org.jabref.model.study.StudyCatalog; | |||
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 import statement for StudyCatalog is correct, but the patch does not address the need to use JavaFX ObservableLists for better practice in managing lists in JavaFX applications.
| @@ -92,14 +92,14 @@ void studyConstructorFillsDatabasesCorrectly(@TempDir Path tempDir) { | |||
| } | |||
|
|
|||
| private ManageStudyDefinitionViewModel getManageStudyDefinitionViewModel(Path tempDir) { | |||
| List<StudyDatabase> databases = List.of( | |||
| new StudyDatabase("ACM Portal", true)); | |||
| List<StudyCatalog> catalogs = List.of( | |||
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 code uses List.of() which is correct, but it does not utilize JavaFX ObservableLists, which is considered best practice for managing lists in JavaFX applications.
| StudyYamlParser studyYAMLParser = new StudyYamlParser(); | ||
| studyYAMLParser.writeStudyYamlFile(newStudy, studyRepositoryRoot.resolve(StudyRepository.STUDY_DEFINITION_FILE_NAME)); | ||
| StudyYamlService studyYamlService = new StudyYamlService(); | ||
| studyYamlService.writeStudyYamlFile(newStudy, studyRepositoryRoot.resolve(StudyRepository.STUDY_DEFINITION_FILE_NAME)); |
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 method writeStudyYamlFile should ensure it does not return null. If it does, it should use java.util.Optional to handle potential null values.
jablib/src/main/java/org/jabref/logic/crawler/StudyYamlV1Migrator.java
Outdated
Show resolved
Hide resolved
|
|
||
| if (CURRENT_VERSION.equals(version)) { | ||
| // Already current version, read the file normally | ||
| try (InputStream fileInputStream = Files.newInputStream(studyYamlFile)) { |
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 try block covers the entire method, which is against best practices. It should cover as few statements as possible to minimize the scope of potential exceptions.
jablib/build.gradle.kts
Outdated
| implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") | ||
| // TODO: Somwewhere we get a warning: unknown enum constant Id.CLASS reason: class file for com.fasterxml.jackson.annotation.JsonTypeInfo$Id not found | ||
| // implementation("com.fasterxml.jackson.core:jackson-annotations:2.19.1") | ||
| implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.2") |
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.
Put the version in versions/build.gradle
Siedlerchr
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.
lgtm so far
Version in versions/build.gradle is required.
calixtus
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.
Small issue about lucene open, but to move forward should be merged and done in a followup.
* upstream/main: Revert "Issue676 author last (JabRef#13625)" (JabRef#14123) Issue676 author last (JabRef#13625)
* upstream/main: New study.yml format (JabRef#13844) Separate issue linking workflows, make them run on `edited` (JabRef#14121)
| * Provides common functionality for version detection | ||
| * and handles the migration process | ||
| */ | ||
|
|
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.
Why emtpy line here?
| } | ||
|
|
||
| @Test | ||
| void migrateEmptyStudySuccessfully() throws IOException { |
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.
Wrong approach, there should be two YAML files compared. Not input. YAML content and output: data model.
|
We reverted this PR as not everything from the issue was done. We want to have a new intermediate release - and we cannot include some unfinished work. Sorry @turhantolgaunal that we are currently understaffed for this and you did not get any feedback in time. Maybe, another contributor builds on your work. The last two bullets points of the issue were not done
Moreover, tests were missing reading in the new YAML file structure. Tests should also go from strings to strings - not from strings to data model and vice versa. |
* Reformatted database variable to catalogue * Renamed StudyDatabase.java to StudyCatalog and updated its usage in other classes * Created an abstract StudyYamlMigrator class as a template for study.yml migrations * Created an implementation of the abstract Migrator class for migrations from the current study.yml version to the new one * Created a StudyMetadata class to handle the metadata part of the study.yml file * Created a new class called StudyYamlService for handling the migration and parsing of study.yml if needed * StudyYamlMigrator no longer uses child classes in constructor in order to avoid deadlock * Ran openrewrite and changed the jetbrains annotations in StudyYamlV1Migrator to JSpecify annotations * Changed StudyYamlParserTest.java to use the new StudyYamlParserTest instead of StudyYamlParser * Changed the usage of the word catalogue to catalog to be consistent with the rest of the codebase * Added functions for adding a metadata field to the study.yml * Added unit tests for MigratorV1, removed the study type field as it was not needed * Changed database variable to catalog and an immutable map is returned from getCatalogSpecific form StudyQuery * Reformatted files * Removed studytype parameter in StudyMetadata * yaml mapper variable in StudyYamlMigrator is now a static field * Changed null handling on some variables to use Optional * Changed the use of StringBuilder to StringJoiner in StudyYamlV1Migrator * Added Optionals to various functions * Refactored the tests for StudyYamlV1Migrator to use Optionals correctly * Refactored the tests for StudyYamlV1Migrator to use Optionals correctly * Refactored the tests for StudyYamlV1Migrator to use Optionals correctly * Refactored StudyQuery to not use collections import * Disabled the requirement for handlers for java8 optionals in StudyYamlParser * Reverted the disabling of the requirement for handlers for optionals in StudyYamlParser and removed Optionals in StudyQuery * Changed the usage of Optionals in Study and readded Optionals on StudyQuery * Added new dependency jackson datatype jdk 8 for serializing Optionals * Refactored Study and StudyQuery to use more Optionals, StudyYamlParser should support proper deserialization of Optionals * Added annotations for Json deserialization to avoid conflicts * getCatalogSpecificOptional function is ignored when deserializing Json * updated StudyQuery equals method for compatibility with testing * Update jablib/src/main/java/org/jabref/logic/crawler/StudyYamlV1Migrator.java Co-authored-by: Carl Christian Snethlage <[email protected]> * Reverted the update to instanceof check because of unsafe type conversion * Added nonnull annotations and changed the metadata field to not use Optional * Added nonnull annotations to getVersion function from StudyYamlV1Migrator * Changed the suppress warning annotation to the whole function in StudyYamlV1Migrator * fix version and remove unused stuff * readd --------- Co-authored-by: Carl Christian Snethlage <[email protected]> Co-authored-by: Christoph <[email protected]>
This reverts commit db1e651.

Closes #12642
The study.yml is refactored to a new format to implement SEMVER versioning, variable 'databases' is renamed to 'catalogues' for UI consistency.
In the course of working on this draft pull request the query structure is planned to be enhanced to support multiple query formats including catalog-specific variations.
Steps to test
The study.yml file created when a new slr is started should be in a new format and slr search should function as intended.
New format is:
version: 2.0
authors:
title: title
research-questions:
queries:
description: null
lucene: null
catalogue-specific: null
catalogues:
enabled: true
metadata:
notes: null
created-date: null
last-modified: null
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)