-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add a new field for citation count #13531
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
base: main
Are you sure you want to change the base?
Conversation
jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/CitationCountEditorViewModel.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/CitationCountEditorViewModel.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/importer/fetcher/citation/CitationFetcher.java
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Show resolved
Hide resolved
...g/jabref/logic/importer/fetcher/citation/semanticscholar/SemanticScholarCitationFetcher.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/model/entry/field/FieldProperty.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/model/entry/field/StandardField.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/model/entry/field/StandardField.java
Outdated
Show resolved
Hide resolved
<table:table-cell> | ||
<text:p>Citation count</text:p> | ||
</table:table-cell> |
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.
Not sure why this file is updated.
Do you realy handle OpenOffice? This was not part of the issue!!
Maybe, just revert all changes in this file
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.
mmm i had to fix this because by adding the new field, now this test expected it. Not sure if it was because i added to FieldProperty and by remove we should be fine but if it persist the error we need to consider this change
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.
Hey, tried to revert this change but the test that read this file again failed. Not sure if its because it reads all the Fields. I also even delete the entry in FieldProperty and no luck.
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.
@subhramit Can you have a look; maybe, you know better than me 😅
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.
will take a look soon
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 wasn't able to look through the code yet, but @SalvadorRomo try to search where this filename is being used in the code. That will lead you to the logic that expects this field. If de-coupling is possible, then do it, otherwise this seems alright.
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditorViewModel.java
Outdated
Show resolved
Hide resolved
jablib/src/test/java/org/jabref/logic/citation/SearchCitationsRelationsServiceTest.java
Outdated
Show resolved
Hide resolved
...g/jabref/logic/importer/fetcher/citation/semanticscholar/SemanticScholarCitationFetcher.java
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,84 @@ | |||
package org.jabref.gui.fieldeditors; | |||
|
|||
import javax.swing.undo.UndoManager; |
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.
Using Swing components in a JavaFX application violates the architectural decision to use only JavaFX. The UndoManager should be replaced with a JavaFX-specific implementation.
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.
JabRef uses this - which is OK.
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Outdated
Show resolved
Hide resolved
...g/jabref/logic/importer/fetcher/citation/semanticscholar/SemanticScholarCitationFetcher.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/model/entry/field/FieldProperty.java
Outdated
Show resolved
Hide resolved
@@ -138,6 +138,7 @@ public enum StandardField implements Field { | |||
OWNER("owner"), | |||
TIMESTAMP("timestamp", FieldProperty.DATE), | |||
CREATIONDATE("creationdate", FieldProperty.DATE), | |||
CITATIONCOUNT("Citation count"), |
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.
Move at the end - the two fields before and the one after is related to date - this one not.
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.
Made this change, but seems to impact the open office tests, seems the order of this contstants impact how the output will be in files, so don't konw what you think about it
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.
Please show the excerpt here.
I think, you ened to adapt jablib/src/test/resources/org/jabref/logic/exporter/OldOpenOfficeCalcExportFormatContentSingleEntry.xml
accordingly. Which is OK - you add a thing there (and we have the discussion on that there. Maybe, this is really required)
(And please let us resolve the conversations so that we save one click while reviewing) - otherwise, I need to open all resolved conversations)
jablib/src/test/java/org/jabref/logic/citation/SearchCitationsRelationsServiceTest.java
Outdated
Show resolved
Hide resolved
jablib/src/test/java/org/jabref/logic/citation/SearchCitationsRelationsServiceTest.java
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/citation/SearchCitationsRelationsService.java
Show resolved
Hide resolved
} | ||
URL referencesUrl; | ||
try { | ||
referencesUrl = URLUtil.create(getUrlForCitationCount(entry)); |
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.
Variable name 'referencesUrl' is misleading as it's used for citation count URL, not references. This reduces code readability and maintainability.
...g/jabref/logic/importer/fetcher/citation/semanticscholar/SemanticScholarCitationFetcher.java
Show resolved
Hide resolved
@trag-bot didn't find any issues in the code! ✅✨ |
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.
Close to finish 😅
We keep commenting to share our development knowledge with you with the hope that you learn something - otherwise, we would "just" finish the PR for our selves.
.onRunning(() -> fetchCitationCountInProgress.setValue(true)) | ||
.onFinished(() -> fetchCitationCountInProgress.setValue(false)) | ||
.onFailure(e -> | ||
dialogService.showErrorDialogAndWait(Localization.lang("Error Occurred"))) |
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.
This is not JabRef's style. The text does not contain any information what the user should do.
- Rename string to
Error occurred
(also in JabRef_en.properties`) dialogService.notify(...)
- LOGGER.error("Error while fetching citation count", e)
With 3, there is a log entry, and users can see it in the log viewer accessible in the help menu.
} | ||
|
||
public void getCitationCount() { | ||
Optional<String> fieldAux = entry.getField(field); |
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.
aux
is very strange. Maybe name it fieldContent
<graphic> | ||
<StackPane> | ||
<JabRefIconView glyph="LOOKUP_IDENTIFIER" | ||
visible="${controller.viewModel.fetchCitationCountInProgress == false}"/> |
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.
Use !...
instead of == false
* Get the paper details that includes citation count field for a given {@link BibEntry}. | ||
* | ||
* @param entry entry to search citation count field | ||
* @return returns a {@link PaperDetails}, that includes citation count field (may be empty) |
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.
Ajdust JavaDoc to actual return value (Integer is not PaperDetails)
@@ -138,6 +138,7 @@ public enum StandardField implements Field { | |||
OWNER("owner"), | |||
TIMESTAMP("timestamp", FieldProperty.DATE), | |||
CREATIONDATE("creationdate", FieldProperty.DATE), | |||
CITATIONCOUNT("Citation count"), |
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.
Please show the excerpt here.
I think, you ened to adapt jablib/src/test/resources/org/jabref/logic/exporter/OldOpenOfficeCalcExportFormatContentSingleEntry.xml
accordingly. Which is OK - you add a thing there (and we have the discussion on that there. Maybe, this is really required)
(And please let us resolve the conversations so that we save one click while reviewing) - otherwise, I need to open all resolved conversations)
Closes #13477
This PR add a new filed in the General Count to fetch the citationCount for a given Entry, with the ability to look it up.
Steps to test
1- Add a new paper

2- Go to the General Tab and
3 - Place your cursor in the new Citation Field
4- next to the field, there is button available to start the search
5- if the value is blank or the TTL for the actual Doi has expiered, the field must be filled with the expected value
6- if the there is an existing value or the TTL is not yet reached, it won't perform fetching and will keep the same value
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)