Add EndNote XML Exporter + Rehaul Importer#11157
Conversation
…bref into fix-for-issue-11137
|
In general looks good to me. As a follow up task and PR you can think about converting it to a StreamWriter (StaX). |
Yes, in fact I had a couple of plans for the follow up PRs I'm going to put regarding this.
|
|
@Siedlerchr On resolving the changelog conflict on Github itself, it's saying I "dismissed" your review. I'm sorry, that was accidental. |
|
Please do add the test here well. This makes the migration to stax easier Because you then have already a working test to verfiy the functionality. |
On it. |
|
Export & Import for |
| @@ -1,5 +1,6 @@ | |||
| @article{, | |||
| address = {Cent States Forest Expt Stn, Columbus, OH USA}, | |||
| alt-title = {Ecology}, | |||
There was a problem hiding this comment.
improvement: if alt-title matches journal, then remove alt-title. Maybe, a cleanup at the end.
There was a problem hiding this comment.
Should the same apply if booktitle matches alt-title?
There was a problem hiding this comment.
Yes, I have done that.
| } | ||
| @book{, | ||
| address = {Univ Chicago, Chicago, IL USA}, | ||
| alt-title = {Ecology}, |
There was a problem hiding this comment.
(comment for below)
Here, I see journal set. This is wrong. If the entry is not an article, that field should go into booktitle or another field. Please try to check the table https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#BibTeX and think on a case-by-case basis. As fallback, just use booktitle before loosing the field.
There was a problem hiding this comment.
In the original import test xml, it was present as alt-title.
Somewhere I had read during all this that booktitle in the bib is handled by secondary-title in the Endnote xml format. So I'll modify the bib and the xml, and change the StandardField of secondary-type to BOOKTITLE.
There was a problem hiding this comment.
Nope, have to undo this. It's importing as booktitle even for articles. Will try to do it the way you suggested.
|
Review hint: The diff between two commits can be retrieved by URL hacking: 60f3ae2...0527ec7 |
| } | ||
| case "urls" -> { | ||
| handleUrlList(reader, fields, linkedFiles); | ||
| case "periodical", "alt-periodical" -> { |
There was a problem hiding this comment.
With this, the order periodical and alt-periodical matters. Just leave out alt-periodical - or store it in the field alt-periodical (and keep it if it differs from periodical).
There was a problem hiding this comment.
Checking every sub-field of alt-periodical felt tedious, and also on checking the Endnote dtd I see no alt-periodical. So I decided to leave out.
When I leave out alt-periodical, a journal field comes up in case of a Book. I might be missing something very obvious. Let us take a look at a test case:

It is as if it is ignoring the parent being unrecognized alt-periodical, and going in and setting the full-title into the journal field.
How do I prevent this?
There was a problem hiding this comment.
Ah, found it! It was getting imported in the default case. Fixed it.
| } | ||
| // Cleanup: Remove alt-title if it matches the journal | ||
| String journalOrBooktitle = entry.getField(StandardField.JOURNAL).or(() -> entry.getField(StandardField.BOOKTITLE)).orElse(""); | ||
| if (entry.hasField(new UnknownField("alt-title"))) { |
There was a problem hiding this comment.
exctract new UnknownField("alt-title") to class constant FIELD_ALT_TITLE. You can use intellij refactoring extract field - Ctrl+Shift+F.
Closes #11137
I am attempting to write an EndNote XML Exporter for JabRef.
I have successfully been able to implement the exporter, but there are a few catches, which will hopefully be addressed in follow-up issues and PRs:
Journal/Booktitle values beginning with "IEEE" are not captured:Original Library:
On export and import:
The author/editor of the third entry changes from "Madrigal" to "Marigal and o S." (refer to the same pair of screenshots).@koppor @Siedlerchr @HoussemNasri @ThiloteE @calixtus
The code is in a very raw stage right now, if you have time to go through it and suggest enhancements, please do.Importer changes:

The importer had to be tweaked a little to include fields such as
tertiary-titlecorresponding to the Book title/Journal, otherwise the column would remain empty:Similarly, many other fields that were not retrieved by the importer as visible in BibTeX source were added to create a one-to-one mapping between the source entry and the one produced by a round trip export-import. The function
convertRefNameToTypewas also modified to add some Entrytypes that were not recognized before.Update: Major changes have taken place, please follow the discussion for details.
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)