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

Citation Relations should be aware of existing papers #10414

Closed
koppor opened this issue Sep 25, 2023 · 16 comments · Fixed by #11186
Closed

Citation Relations should be aware of existing papers #10414

koppor opened this issue Sep 25, 2023 · 16 comments · Fixed by #11186
Assignees
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty.

Comments

@koppor
Copy link
Member

koppor commented Sep 25, 2023

Open jabref-authors.bib.

Click on paper 1.

This references paper 2 at position 3. The paper at 3 should be marked in light green (to indicate that it already exists). Additionally, at button 4, the duplicate check should be called (which then warns about possible duplicates).

image

In the example, I added the paper resulting in paper marked at 5.

@github-project-automation github-project-automation bot moved this to Normal priority in Features & Enhancements Sep 25, 2023
@koppor koppor moved this to Free to take in Good First Issues Sep 25, 2023
@koppor koppor added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Sep 25, 2023
@vimalJD
Copy link

vimalJD commented Sep 25, 2023

Is this project is ongoing? Let me know further (DOCS) to contribute on it as "good first issue".

@ThiloteE
Copy link
Member

Yes, this project (JabRef) is still ongoing and this issue is free to take. I will assign you.

@ThiloteE ThiloteE moved this from Free to take to Reserved in Good First Issues Sep 25, 2023
@ThiloteE ThiloteE added the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Sep 25, 2023
@github-actions
Copy link
Contributor

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

@ThiloteE
Copy link
Member

@vimalJD are you still on it or have you given up on this?

@supernoob00
Copy link

I would like to work on this. Is it still unresolved?

Also, I was trying to figure out where the code is that determines the appearance for the entries table. For example, let's say I wanted to change the color of the selected entry to green for whatever reason, where would I go to change that?

Screenshot from 2024-02-22 17-56-37

@calixtus
Copy link
Member

You will have to add a styleclass to the entry that matches. This can be done by configuring the ViewModelTableCellFactory or ViewModelListCellFactory. The css can be added to base.css

@calixtus
Copy link
Member

In the citations relations tab this would be somewhere here:

new ViewModelListCellFactory<CitationRelationItem>()

@supernoob00
Copy link

supernoob00 commented Feb 24, 2024

So, after digging through the code for a while pressing the button (marked as 4 in @koppor 's image in the original post) calls the importEntries method of the ImportHandler class. However, the logic that we want (that checks for duplicates) is in the importEntries method of the ImportEntriesViewModel class. I am wondering what the best way to approach this is. Creating a new instance of the ImportEntriesViewModel just to access that method does not seem like a good choice. Should I try to move some of that logic to the ImportHandler class, maybe with a new method?

@AbdAlRahmanGad
Copy link
Contributor

AbdAlRahmanGad commented Feb 26, 2024

@supernoob00 Hi, are you still working on the issue?

@ThiloteE ThiloteE assigned supernoob00 and unassigned vimalJD Feb 26, 2024
@ThiloteE
Copy link
Member

Assigned @supernoob00 because of first come, first serve.
@AbdAlRahmanGad Please have a look at other issues that are not yet reserved or assigned. You can see that in the top right corner of GitHub.
image

But yes, if an issue has not been worked on for more than 4 weeks or some months and the assigned person is not responding then you may ask to work on it. Our policy is to usually only assign one student per issue or one group of students from the same course to avoid trouble with grading down the road.

@koppor
Copy link
Member Author

koppor commented Feb 29, 2024

@supernoob00 Difficult question. Doesn't the dialog know the bibdatabasecontext and thus the entries? There is a duplicate checker. And that also is in use in the import dialog. And can say if an entry exists. We recently worked on that at #10914... But you are at a different place in the code. No import, but citation relations. But maybe you get inspirations. Maybe @HoussemNasri can also give hints?

@HoussemNasri
Copy link
Member

HoussemNasri commented Mar 2, 2024

Hi @supernoob00, thanks for digging into this,

Creating a new instance of the ImportEntriesViewModel just to access that method does not seem like a good choice.

I totally agree that using view models wouldn't be a great idea here. Usually, each UI component has its own view model, but it's possible to use the same one for components that have the same state. Take Android apps, for example. They can run on all sorts of devices, from phones to TVs to watches. You might tweak the design of the UI pages to fit different screen sizes, but you can still keep the state consistent. In our case, we would be sharing the view model to not share the state but to share a single method which is not ideal.

Should I try to move some of that logic to the ImportHandler class, maybe with a new method?

Have you looked into ImportHandler#importEntriesWithDuplicateCheck? It is the same method called when you paste an entry into JabRef.

@ror3d
Copy link
Contributor

ror3d commented Mar 13, 2024

From what I see in the code, there might already be something to try to handle this better, in CitationRelationsTab.java:styleFetchedListView there's this block that looks like might be trying to show that an entry is already in the library:

 if (entry.isLocal()) {
    Button jumpTo = IconTheme.JabRefIcons.LINK.asButton();
    jumpTo.setTooltip(new Tooltip(Localization.lang("Jump to entry in library")));
    jumpTo.getStyleClass().add("addEntryButton");
    jumpTo.setOnMouseClicked(event -> {
        libraryTab.showAndEdit(entry.entry());
        libraryTab.clearAndSelect(entry.entry());
        citingTask.cancel();
        citedByTask.cancel();
    });
    hContainer.getChildren().addAll(entryNode, separator, jumpTo);
}

The problem is, currently in CitationRelationsTab.java:onSearchForRelationsSucceed there's this block:

 private void onSearchForRelationsSucceed(BibEntry entry, CheckListView<CitationRelationItem> listView,
                                             Button abortButton, Button refreshButton,
                                             CitationFetcher.SearchType searchType, Button importButton,
                                             ProgressIndicator progress, List<BibEntry> fetchedList,
                                             ObservableList<CitationRelationItem> observableList) {
        hideNodes(abortButton, progress);

        observableList.setAll(fetchedList.stream().map(entr -> new CitationRelationItem(entr, false))
                                         .collect(Collectors.toList()));

where the new CitationRelationItem is initialized to isLocal = false and I don't think there's code to change it to true if the entry is duplicate.

@HoussemNasri
Copy link
Member

Hi @supernoob00, are you still working on this?

@AbdAlRahmanGad
Copy link
Contributor

@HoussemNasri can I work on this?

@HoussemNasri
Copy link
Member

Sure!

@koppor koppor removed the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Apr 11, 2024
@github-project-automation github-project-automation bot moved this from Normal priority to Done in Features & Enhancements Apr 12, 2024
@github-project-automation github-project-automation bot moved this from Reserved to Done in Good First Issues Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants