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

Changed database to catalog in org.jabref.gui.slr and org.jabref.logic.crawler #9989

Merged
merged 7 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- In case the library contains empty entries, they are not written to disk. [#8645](https://github.com/JabRef/jabref/issues/8645)
- The formatter `remove_unicode_ligatures` is now called `replace_unicode_ligatures`. [#9890](https://github.com/JabRef/jabref/pull/9890)
- We improved the error message when no terminal was found [#9607](https://github.com/JabRef/jabref/issues/9607)
- We changed database to catalog in `org.jabref.gui.slr` and `org.jabref.logic.crawler` [#9951](https://github.com/JabRef/jabref/pull/9951)
Copy link
Member

Choose a reason for hiding this comment

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

Changelog messages should be for the end user. We don't have a end-user documentation for the SLR functionality yet Nevertheless one could write following:

Suggested change
- We changed database to catalog in `org.jabref.gui.slr` and `org.jabref.logic.crawler` [#9951](https://github.com/JabRef/jabref/pull/9951)
- In the context of the "systematic literature functionality", we changed the name "database" to "catalog" to use a separate term for online catalogs in comparison to SQL databases. [#9951](https://github.com/JabRef/jabref/pull/9951)


### Fixed

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/slr/ManageStudyDefinition.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@
<Label text="%Select Databases:"/>
<HBox alignment="CENTER_LEFT">
<TableView
fx:id="databaseTable"
fx:id="catalogTable"
HBox.hgrow="ALWAYS"
editable="true">
<columns>
<TableColumn
fx:id="databaseEnabledColumn"
fx:id="catalogEnabledColumn"
text="%Enabled"
maxWidth="80.0"
prefWidth="80.0"
minWidth="80.0"
reorderable="false"
resizable="false"/>
<TableColumn
fx:id="databaseColumn"
fx:id="catalogColumn"
text="%Database"/>
</columns>
<columnResizePolicy>
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/org/jabref/gui/slr/ManageStudyDefinitionView.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public class ManageStudyDefinitionView extends BaseDialog<SlrStudyAndDirectory>
@FXML private TableColumn<String, String> queriesColumn;
@FXML private TableColumn<String, String> queriesActionColumn;

@FXML private TableView<StudyDatabaseItem> databaseTable;
@FXML private TableColumn<StudyDatabaseItem, Boolean> databaseEnabledColumn;
@FXML private TableColumn<StudyDatabaseItem, String> databaseColumn;
@FXML private TableView<StudyCatalogItem> catalogTable;
@FXML private TableColumn<StudyCatalogItem, Boolean> catalogEnabledColumn;
@FXML private TableColumn<StudyCatalogItem, String> catalogColumn;

@Inject private DialogService dialogService;
@Inject private PreferencesService prefs;
Expand Down Expand Up @@ -132,7 +132,7 @@ private void setupSaveSurveyButton(boolean isEdit) {

saveSurveyButton.disableProperty().bind(Bindings.or(Bindings.or(Bindings.or(Bindings.or(
Bindings.isEmpty(viewModel.getQueries()),
Bindings.isEmpty(viewModel.getDatabases())),
Bindings.isEmpty(viewModel.getCatalogs())),
Bindings.isEmpty(viewModel.getAuthors())),
viewModel.getTitle().isEmpty()),
viewModel.getDirectory().isEmpty()));
Expand Down Expand Up @@ -166,14 +166,14 @@ private void initialize() {
selectStudyDirectory.setDisable(true);
}

// Listen whether any databases are removed from selection -> Add back to the database selector
// Listen whether any catalogs are removed from selection -> Add back to the catalog selector
studyTitle.textProperty().bindBidirectional(viewModel.titleProperty());
studyDirectory.textProperty().bindBidirectional(viewModel.getDirectory());

initAuthorTab();
initQuestionsTab();
initQueriesTab();
initDatabasesTab();
initCatalogsTab();
}

private void initAuthorTab() {
Expand Down Expand Up @@ -202,27 +202,27 @@ private void initQueriesTab() {
.toString()));
}

private void initDatabasesTab() {
new ViewModelTableRowFactory<StudyDatabaseItem>()
private void initCatalogsTab() {
new ViewModelTableRowFactory<StudyCatalogItem>()
.withOnMouseClickedEvent((entry, event) -> {
if (event.getButton() == MouseButton.PRIMARY) {
entry.setEnabled(!entry.isEnabled());
}
})
.install(databaseTable);
.install(catalogTable);

databaseColumn.setReorderable(false);
databaseColumn.setCellFactory(TextFieldTableCell.forTableColumn());
catalogColumn.setReorderable(false);
catalogColumn.setCellFactory(TextFieldTableCell.forTableColumn());

databaseEnabledColumn.setResizable(false);
databaseEnabledColumn.setReorderable(false);
databaseEnabledColumn.setCellFactory(CheckBoxTableCell.forTableColumn(databaseEnabledColumn));
databaseEnabledColumn.setCellValueFactory(param -> param.getValue().enabledProperty());
catalogEnabledColumn.setResizable(false);
catalogEnabledColumn.setReorderable(false);
catalogEnabledColumn.setCellFactory(CheckBoxTableCell.forTableColumn(catalogEnabledColumn));
catalogEnabledColumn.setCellValueFactory(param -> param.getValue().enabledProperty());

databaseColumn.setEditable(false);
databaseColumn.setCellValueFactory(param -> param.getValue().nameProperty());
catalogColumn.setEditable(false);
catalogColumn.setCellValueFactory(param -> param.getValue().nameProperty());

databaseTable.setItems(viewModel.getDatabases());
catalogTable.setItems(viewModel.getCatalogs());
}

private void setupCommonPropertiesForTables(Node addControl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ManageStudyDefinitionViewModel {
private final ObservableList<String> authors = FXCollections.observableArrayList();
private final ObservableList<String> researchQuestions = FXCollections.observableArrayList();
private final ObservableList<String> queries = FXCollections.observableArrayList();
private final ObservableList<StudyDatabaseItem> databases = FXCollections.observableArrayList();
private final ObservableList<StudyCatalogItem> databases = FXCollections.observableArrayList();

// Hold the complement of databases for the selector
private final SimpleStringProperty directory = new SimpleStringProperty();
Expand All @@ -74,7 +74,7 @@ public ManageStudyDefinitionViewModel(ImportFormatPreferences importFormatPrefer
.filter(name -> !name.equals(CompositeSearchBasedFetcher.FETCHER_NAME))
.map(name -> {
boolean enabled = DEFAULT_SELECTION.contains(name);
return new StudyDatabaseItem(name, enabled);
return new StudyCatalogItem(name, enabled);
})
.toList());
this.dialogService = Objects.requireNonNull(dialogService);
Expand Down Expand Up @@ -105,7 +105,7 @@ public ManageStudyDefinitionViewModel(Study study,
.filter(name -> !name.equals(CompositeSearchBasedFetcher.FETCHER_NAME))
.map(name -> {
boolean enabled = studyDatabases.contains(new StudyDatabase(name, true));
return new StudyDatabaseItem(name, enabled);
return new StudyCatalogItem(name, enabled);
})
.toList());

Expand Down Expand Up @@ -133,7 +133,7 @@ public ObservableList<String> getQueries() {
return queries;
}

public ObservableList<StudyDatabaseItem> getDatabases() {
public ObservableList<StudyCatalogItem> getCatalogs() {
return databases;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
/**
* View representation of {@link StudyDatabase}
*/
public class StudyDatabaseItem {
public class StudyCatalogItem {
private final StringProperty name;
private final BooleanProperty enabled;

public StudyDatabaseItem(String name, boolean enabled) {
public StudyCatalogItem(String name, boolean enabled) {
this.name = new SimpleStringProperty(Objects.requireNonNull(name));
this.enabled = new SimpleBooleanProperty(enabled);
}
Expand Down Expand Up @@ -47,7 +47,7 @@ public BooleanProperty enabledProperty() {

@Override
public String toString() {
return "StudyDatabaseItem{" +
return "StudyCatalogItem{" +
"name=" + name.get() +
", enabled=" + enabled.get() +
'}';
Expand All @@ -61,7 +61,7 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
StudyDatabaseItem that = (StudyDatabaseItem) o;
StudyCatalogItem that = (StudyCatalogItem) o;
return Objects.equals(getName(), that.getName()) && Objects.equals(isEnabled(), that.isEnabled());
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/logic/crawler/Crawler.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public Crawler(Path studyRepositoryRoot,
preferencesService,
fileUpdateMonitor,
bibEntryTypesManager);
StudyDatabaseToFetcherConverter studyDatabaseToFetcherConverter = new StudyDatabaseToFetcherConverter(
StudyCatalogToFetcherConverter studyCatalogToFetcherConverter = new StudyCatalogToFetcherConverter(
studyRepository.getActiveLibraryEntries(),
preferencesService.getImportFormatPreferences(),
preferencesService.getImporterPreferences());
this.studyFetcher = new StudyFetcher(
studyDatabaseToFetcherConverter.getActiveFetchers(),
studyCatalogToFetcherConverter.getActiveFetchers(),
studyRepository.getSearchQueryStrings());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
/**
* Converts library entries from the given study into their corresponding fetchers.
*/
class StudyDatabaseToFetcherConverter {
class StudyCatalogToFetcherConverter {
private final List<StudyDatabase> libraryEntries;
private final ImportFormatPreferences importFormatPreferences;
private final ImporterPreferences importerPreferences;

public StudyDatabaseToFetcherConverter(List<StudyDatabase> libraryEntries,
ImportFormatPreferences importFormatPreferences,
ImporterPreferences importerPreferences) {
public StudyCatalogToFetcherConverter(List<StudyDatabase> libraryEntries,
ImportFormatPreferences importFormatPreferences,
ImporterPreferences importerPreferences) {
this.libraryEntries = libraryEntries;
this.importFormatPreferences = importFormatPreferences;
this.importerPreferences = importerPreferences;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/crawler/StudyFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private QueryResult getQueryResult(String searchQuery) {
}

/**
* Queries all Databases on the given searchQuery.
* Queries all Catalogs on the given searchQuery.
Copy link
Member

Choose a reason for hiding this comment

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

Please also fix casing when you are on it.

Suggested change
* Queries all Catalogs on the given searchQuery.
* Queries all catalogs on the given searchQuery.

*
* @param searchQuery The query the search is performed for.
* @return Mapping of each fetcher by name and all their retrieved publications as a BibDatabase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private void updateWorkAndSearchBranch() throws IOException, GitAPIException {
*/
private void setUpRepositoryStructureForQueriesAndFetchers() throws IOException {
// Cannot use stream here since IOException has to be thrown
StudyDatabaseToFetcherConverter converter = new StudyDatabaseToFetcherConverter(
StudyCatalogToFetcherConverter converter = new StudyCatalogToFetcherConverter(
this.getActiveLibraryEntries(),
preferencesService.getImportFormatPreferences(),
preferencesService.getImporterPreferences());
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/model/study/StudyDatabase.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.jabref.model.study;

import org.jabref.gui.slr.StudyCatalogItem;

/**
* data model for the view {@link org.jabref.gui.slr.StudyDatabaseItem}
* data model for the view {@link StudyCatalogItem}
Copy link
Member

Choose a reason for hiding this comment

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

If possible, do not add imports just for JavaDoc. -- Use the fully qualified name (FQN) for StudyCatalogItem in JavaDoc.

*/
public class StudyDatabase {
private String name;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ springerNatureAPIKey=${springerNatureAPIKey}
astrophysicsDataSystemAPIKey=${astrophysicsDataSystemAPIKey}
ieeeAPIKey=${ieeeAPIKey}
biodiversityHeritageApiKey=${biodiversityHeritageApiKey}
Catalogs=Create property
Copy link
Member

Choose a reason for hiding this comment

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

There was something going wrong here. This line needs to be removed, doesn't it?

Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ void setUp() {
public void emptyStudyConstructorFillsDatabasesCorrectly() {
ManageStudyDefinitionViewModel manageStudyDefinitionViewModel = new ManageStudyDefinitionViewModel(importFormatPreferences, importerPreferences, dialogService);
assertEquals(List.of(
new StudyDatabaseItem("ACM Portal", true),
new StudyDatabaseItem("ArXiv", false),
new StudyDatabaseItem("Bibliotheksverbund Bayern (Experimental)", false),
new StudyDatabaseItem("Biodiversity Heritage", false),
new StudyDatabaseItem("Collection of Computer Science Bibliographies", false),
new StudyDatabaseItem("Crossref", false),
new StudyDatabaseItem("DBLP", true),
new StudyDatabaseItem("DOAB", false),
new StudyDatabaseItem("DOAJ", false),
new StudyDatabaseItem("GVK", false),
new StudyDatabaseItem("IEEEXplore", true),
new StudyDatabaseItem("INSPIRE", false),
new StudyDatabaseItem("MathSciNet", false),
new StudyDatabaseItem("Medline/PubMed", false),
new StudyDatabaseItem("ResearchGate", false),
new StudyDatabaseItem("SAO/NASA ADS", false),
new StudyDatabaseItem("SemanticScholar", false),
new StudyDatabaseItem("Springer", true),
new StudyDatabaseItem("zbMATH", false)
), manageStudyDefinitionViewModel.getDatabases());
new StudyCatalogItem("ACM Portal", true),
new StudyCatalogItem("ArXiv", false),
new StudyCatalogItem("Bibliotheksverbund Bayern (Experimental)", false),
new StudyCatalogItem("Biodiversity Heritage", false),
new StudyCatalogItem("Collection of Computer Science Bibliographies", false),
new StudyCatalogItem("Crossref", false),
new StudyCatalogItem("DBLP", true),
new StudyCatalogItem("DOAB", false),
new StudyCatalogItem("DOAJ", false),
new StudyCatalogItem("GVK", false),
new StudyCatalogItem("IEEEXplore", true),
new StudyCatalogItem("INSPIRE", false),
new StudyCatalogItem("MathSciNet", false),
new StudyCatalogItem("Medline/PubMed", false),
new StudyCatalogItem("ResearchGate", false),
new StudyCatalogItem("SAO/NASA ADS", false),
new StudyCatalogItem("SemanticScholar", false),
new StudyCatalogItem("Springer", true),
new StudyCatalogItem("zbMATH", false)
), manageStudyDefinitionViewModel.getCatalogs());
}

@Test
Expand All @@ -74,25 +74,25 @@ public void studyConstructorFillsDatabasesCorrectly(@TempDir Path tempDir) {
importerPreferences,
dialogService);
assertEquals(List.of(
new StudyDatabaseItem("ACM Portal", true),
new StudyDatabaseItem("ArXiv", false),
new StudyDatabaseItem("Bibliotheksverbund Bayern (Experimental)", false),
new StudyDatabaseItem("Biodiversity Heritage", false),
new StudyDatabaseItem("Collection of Computer Science Bibliographies", false),
new StudyDatabaseItem("Crossref", false),
new StudyDatabaseItem("DBLP", false),
new StudyDatabaseItem("DOAB", false),
new StudyDatabaseItem("DOAJ", false),
new StudyDatabaseItem("GVK", false),
new StudyDatabaseItem("IEEEXplore", false),
new StudyDatabaseItem("INSPIRE", false),
new StudyDatabaseItem("MathSciNet", false),
new StudyDatabaseItem("Medline/PubMed", false),
new StudyDatabaseItem("ResearchGate", false),
new StudyDatabaseItem("SAO/NASA ADS", false),
new StudyDatabaseItem("SemanticScholar", false),
new StudyDatabaseItem("Springer", false),
new StudyDatabaseItem("zbMATH", false)
), manageStudyDefinitionViewModel.getDatabases());
new StudyCatalogItem("ACM Portal", true),
new StudyCatalogItem("ArXiv", false),
new StudyCatalogItem("Bibliotheksverbund Bayern (Experimental)", false),
new StudyCatalogItem("Biodiversity Heritage", false),
new StudyCatalogItem("Collection of Computer Science Bibliographies", false),
new StudyCatalogItem("Crossref", false),
new StudyCatalogItem("DBLP", false),
new StudyCatalogItem("DOAB", false),
new StudyCatalogItem("DOAJ", false),
new StudyCatalogItem("GVK", false),
new StudyCatalogItem("IEEEXplore", false),
new StudyCatalogItem("INSPIRE", false),
new StudyCatalogItem("MathSciNet", false),
new StudyCatalogItem("Medline/PubMed", false),
new StudyCatalogItem("ResearchGate", false),
new StudyCatalogItem("SAO/NASA ADS", false),
new StudyCatalogItem("SemanticScholar", false),
new StudyCatalogItem("Springer", false),
new StudyCatalogItem("zbMATH", false)
), manageStudyDefinitionViewModel.getCatalogs());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

class StudyDatabaseToFetcherConverterTest {
class StudyCatalogToFetcherConverterTest {
SaveConfiguration saveConfiguration;
PreferencesService preferencesService;
BibEntryTypesManager entryTypesManager;
Expand Down Expand Up @@ -59,7 +59,7 @@ public void getActiveFetcherInstances() throws Exception {
preferencesService,
new DummyFileUpdateMonitor(),
entryTypesManager);
StudyDatabaseToFetcherConverter converter = new StudyDatabaseToFetcherConverter(
StudyCatalogToFetcherConverter converter = new StudyCatalogToFetcherConverter(
studyRepository.getActiveLibraryEntries(),
mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS),
mock(ImporterPreferences.class));
Expand Down