Skip to content

Add cleanup operation for journal abbreviation #11791

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

Open
tobiasdiez opened this issue Sep 19, 2024 · 24 comments · May be fixed by #12835
Open

Add cleanup operation for journal abbreviation #11791

tobiasdiez opened this issue Sep 19, 2024 · 24 comments · May be fixed by #12835
Assignees
Labels
📍 Assigned Assigned by assign-issue-action (or manually assigned) component: cleanup-ops component: journal abbreviations good second issue Issues that involve a tour of two or three interweaved components in JabRef 📌 Pinned

Comments

@tobiasdiez
Copy link
Member

Is your suggestion for improvement related to a problem? Please describe.
Users usually have a convention to always use abbreviated or unabbreviated journal titles. JabRef should help them enforce this convention using a cleanup operation.

Describe the solution you'd like
Add option to abbreviate/expand the journal title in the Cleanup operation dialog.

@tina9452
Copy link

hi, I’m interested in this. Could you please assign this to me? Thank you so much~

@koppor
Copy link
Member

koppor commented Oct 19, 2024

Refinement of this issue:

  1. Remove the actions of the Quality menu:

Image

  1. Add the actions to the "Cleanup entries" dialog:

Image

Add a new heading "Journal-realted" with a button group

  • Abbreviate (default)
  • Abbreviate (dotless)
  • Abbreviate (shortest unique)
  • Unabbreviate
  • No changes

Have No changes as default.

Store the setting in the preferences so that after re-opening of the dialog, the same settings are stored.

One needs to move org.jabref.gui.journals.UndoableAbbreviator#abbreviate to separate clean up jobs. Implement interface org.jabref.logic.cleanup.CleanupJob. Four jobs need to be introduced.

@koppor
Copy link
Member

koppor commented Oct 19, 2024

The refactoring of org.jabref.gui.journals.UndoableAbbreviator#abbreviate has to be done first (in a separate PR), because this refactoring is also needed at #11305.

@koppor
Copy link
Member

koppor commented Oct 19, 2024

/assign @tina9452

Copy link
Contributor

👋 Hey @tina9452, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 30 days (by 18 November 2024). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

@github-actions github-actions bot added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Oct 19, 2024
@github-actions github-actions bot removed the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Feb 24, 2025
@koppor koppor added the good second issue Issues that involve a tour of two or three interweaved components in JabRef label Feb 25, 2025
@AndraRice
Copy link

Hello, I am interested in looking into this issue. Can I please be assigned to it?

@GDeane
Copy link

GDeane commented Mar 3, 2025

I would like to work on this issue as part of a university project.

@GDeane
Copy link

GDeane commented Mar 3, 2025

/assign-me

1 similar comment
@VShawFluenta
Copy link

/assign-me

@VShawFluenta
Copy link

I am part of the same group as @GDeane and we are trying to working on the same university assignment but it seems like the assign-me command isn't working. Would anyone be able to assign us please?

@GDeane
Copy link

GDeane commented Mar 4, 2025

/assign-me

@koppor
Copy link
Member

koppor commented Mar 4, 2025

@GDeane Note that this is a good second issue requiring some knowledge about JabRef.

@koppor koppor added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Mar 4, 2025
@github-actions github-actions bot removed the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Mar 19, 2025
Copy link
Contributor

📋 Assignment Update

Hi @GDeane, due to inactivity, you have been unassigned from this issue.

Next steps

If you still want to work on this:

  • Ask a maintainer to assign you again
  • If you're making progress, a maintainer can add the pin label to prevent future automatic unassignment

@GDeane
Copy link

GDeane commented Mar 19, 2025

Still working on it. I am currently in progress understanding the AbbreviateAction.java class and what it depends on, then I plan to understand the flow of 2-3 other CleanupJobs so I can attempt implementation of a AbbreviateJournalCleanup class.

Once I have that, I'll attempt to link the AbbreviateJournalCleanup class to the gui in the same way the other cleanups are linked, and test it to make sure all the same behaviour from AbbreviateAction.java still works.

@GDeane
Copy link

GDeane commented Mar 19, 2025

@koppor Could the pin label be re-added to this issue.

Also, I acknowledge that this is a good second issue that I would not normally choose for an introduction to JabRef, and I am indeed finding it quite challenging. For the University project, we were informed good first issues were too simple to choose.

@koppor
Copy link
Member

koppor commented Mar 19, 2025

Still working on it. I am currently in progress understanding the AbbreviateAction.java class and what it depends on, then I plan to understand the flow of 2-3 other CleanupJobs so I can attempt implementation of a AbbreviateJournalCleanup class.

Please look at the clean up dialog. Think of where it should be placed.

IMHO it is a cleanup what can be added as default in the field cleanups below.

I think, it will be twenty lines of code maybe at two places to do.

Please try to do it in one batch and not here ten minutes there ten minites. If you sit together as team, this can be done within 3 to 10 hours!

@GDeane
Copy link

GDeane commented Mar 19, 2025

Still working on it. I am currently in progress understanding the AbbreviateAction.java class and what it depends on, then I plan to understand the flow of 2-3 other CleanupJobs so I can attempt implementation of a AbbreviateJournalCleanup class.

Please look at the clean up dialog. Think of where it should be placed.

IMHO it is a cleanup what can be added as default in the field cleanups below.

I think, it will be twenty lines of code maybe at two places to do.

Please try to do it in one batch and not here ten minutes there ten minites. If you sit together as team, this can be done within 3 to 10 hours!

I'm a bit confused what you mean by adding it as a default to the "field cleanups below".

Do you mean the Journal Cleanup should be added to the field formatters (e.g. Field name: Journal/Booktitle, Formatter name: Abbreviate Journal Name)?

Image

The alternative (from the above comment) would be to add a new heading "Journal-realted" with a button group

  • Abbreviate (default)
  • Abbreviate (dotless)
  • Abbreviate (shortest unique)
  • Unabbreviate
  • No changes

and Have No changes as default.

@koppor
Copy link
Member

koppor commented Mar 19, 2025

Do you mean the Journal Cleanup should be added to the field formatters (e.g. Field name: Journal/Booktitle, Formatter name: Abbreviate Journal Name)?

Yes - add the top four there.

The thing of the other check boxes is that they involve more than one field (or internally need more data such as relativizing pahts or rename files)

In my view: this field formatter gets in the string and calls the abbreviation function and returns.

@koppor
Copy link
Member

koppor commented Mar 19, 2025

and Have No changes as default.

No changes is the field not existinant.

You can add a default for journal and journaltitle with Unabbreviate.

IMHO the dialog stores its state across JabRef sessions. Thus, only users using JabRef from scratch will see this change.

You can also increase the size of the dialog a bit. You could also introduce three tabs into that dialog: "Miscellaneous", "File-related", and "Field formatters"

@GDeane
Copy link

GDeane commented Mar 20, 2025

In my view: this field formatter gets in the string and calls the abbreviation function and returns.

A problem I'm running into is that constructing an undoableAbbreviator takes as parameters:

  • a journalAbbreviationRepository
  • an abbreviationType
  • a useFJournalField

Creating a DefaultAbbreviationFormatter that calls org.jabref.gui.journals.UndoableAbbreviator#abbreviate would require that formatter to instantiate an instance of undoableAbbreviator, which would require those parameters (with the possible exception of abbreviationType), but I can't figure out a way to get those parameters to a DefaultAbbreviationFormatter in the first place. In the original flow from clicking the abbreviate journal entries button, these parameters are passed all the way from MainMenu.java.

None of the other implementations of the Formatter class that I can find appear to pass any parameters in their constructor, which is the only way I can think of doing this. This might be the answer, but it seems like it might require me to pass the journalAbbreviationRepository and useFJournalField parameters all the way from MainMenu.java through several functions that otherwise have no need of them. I'm wondering if there's a better way.

I've tried moving the logic of org.jabref.gui.journals.UndoableAbbreviator#abbreviate to a the new DefaultAbbreviationFormatter, but that still has the problem where it would need access to journalAbbreviationRepository and useFJournalField.

Any advice on how to proceed?

@koppor
Copy link
Member

koppor commented Mar 21, 2025

I am reading on GitHub without IDE opened. I don't have links to the classes at hand. I need to guess. journalAbbreviationRepository should have an instance somewhere which can be passed through, ´abbreviationType: I don't know what this is; maybe dependend on the action what one wants? Then, use all values and create respective cleanup actins; useFJournalField`: this should be from the preferences and also passed through.

I scheduled for next week to dive into this more.

@GDeane
Copy link

GDeane commented Mar 22, 2025

I managed to figure out a way to do it since this.

Based on the way org.jabref.logic.formatter.Formatters is statically set up, there didn't seem like a way to get journalAbbreviationRepository field into a Formatter class without doing dependency injection at the logic level (something I believe the architecture forbids).

Another way I thought of trying to get a journalAbbreviationRepository field accessible to a Formatter class was by adding it in an additional parameter to the org.jabref.logic.cleanup.CleanupJob#cleanup method. However, doing this seems like an extremely messy operation that would require changing tons of otherwise unrelated code. I decided that solving this issue is probably not worth it if it messed up the code that much.

What I did find is that there is precedent for passing parameters to other, non-formatter type CleanupJobs in org.jabref.logic.cleanup.CleanupWorker#toJob, so I decided to proceed that way.

So far it's going pretty well, the downside is that the journal abbreviation behavior will not be part of the field formatters, but it will be a lot more friendly to making code clean.

@JunmingDuan
Copy link

This may help in my situation. E.g., for an article in the Journal of Scientific Computing, I would like to keep the full name of the journal in the reference, but use the citation key based on JSC rather than JoSC. It can be convenient because sometimes I need to switch between the full and short journal names, while I would like to keep the citation key unchanged.

@koppor
Copy link
Member

koppor commented Apr 18, 2025

@JunmingDuan What you describe is another use case: The citation key generator should use the abbreviations. - Did you try [journal:abbr]? (see https://docs.jabref.org/setup/citationkeypatterns#modifiers) - Or do you really want to use the abbreviation lists? -- If the answer to the latter is, then we need to introduce the modifier jabbr, which uses the journal abbreviation list to abbreviate the string. --> Needs to be filed as separate issue. Feel free to open one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📍 Assigned Assigned by assign-issue-action (or manually assigned) component: cleanup-ops component: journal abbreviations good second issue Issues that involve a tour of two or three interweaved components in JabRef 📌 Pinned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants