Fix for issue 5804: Rewrite ACM fetcher#7733
Conversation
update jabref
update jabref
2. Added Modified ACMPortalFetcherTest and ACMPortalParserTest.
|
|
||
| private StandardEntryType typeStrToEnum(String typeStr) { | ||
| StandardEntryType type; | ||
| typeStr = typeStr.toLowerCase(Locale.ENGLISH).replace("_", ""); |
There was a problem hiding this comment.
I think you can simplify this whole EntryType stuff, if you want too look up an enum key by the string value:
StandardEntryType.valueOf(...)
Or alternatively, use the guava equivalent https://guava.dev/releases/19.0/api/docs/index.html?com/google/common/base/Enums.html
There was a problem hiding this comment.
The problem here is that the entry of StandardEntryType uses big camelcase nomenclature, I can't directly use StandardEntryType.valueOf(...), or I need to find a good way from JabRef to deal with big camelcase format and all-caps dashed separation format conversion.
And some types of naming do not match exactly. For example, the API returns PAPER_CONFERENCE corresponding to the CONFERENCE of StandardEntryType.
There was a problem hiding this comment.
Ah I understand, however, you can directly operate on the Enum, there is the possibility to use an EnumSet and you have an Optional to check for the type.
This approach is simpler and you don't need to create a new Map with the keys and values
Optional<StandardEntryType> foundType = EnumSet.allOf(StandardEntryType.class).stream().filter(type-> type.getDisplayName().equals(strType)).findAny(); There was a problem hiding this comment.
Optional<StandardEntryType> foundType = EnumSet.allOf(StandardEntryType.class).stream().filter(type-> type.getDisplayName().equals(strType)).findAny();
This is invalid if the input string is ARTICLE
New version~
private StandardEntryType typeStrToEnum(String typeStr) {
StandardEntryType type;
if ("PAPER_CONFERENCE".equals(typeStr)) {
type = StandardEntryType.Conference;
} else {
String upperUnderscoreTyeStr = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, typeStr);
type = Enums.getIfPresent(StandardEntryType.class, upperUnderscoreTyeStr).or(StandardEntryType.Article);
}
return type;
}
Siedlerchr
left a comment
There was a problem hiding this comment.
Overall this looks already good to me, just some mimor changes/improvements
2. Fix some minor problems. 3. Merged the new content of the branch main.
koppor
left a comment
There was a problem hiding this comment.
Good job!
Thank you for creating tests!
Small comments on the tests itself.
| set.add(new MathSciNet(importFormatPreferences)); | ||
| set.add(new ZbMATH(importFormatPreferences)); | ||
| // see https://github.com/JabRef/jabref/issues/5804 | ||
| // set.add(new ACMPortalFetcher(importFormatPreferences)); |
There was a problem hiding this comment.
May I ask whether you committed that change?
There was a problem hiding this comment.
I have deleted these two lines
// see https://github.com/JabRef/jabref/issues/5804
// set.add(new ACMPortalFetcher(importFormatPreferences));do you mean I still need to delete this line?
// set.add(new GoogleScholar(importFormatPreferences));
But this is another Fetcher
There was a problem hiding this comment.
Sorry, was too late. Everything allright! 🎉
2. Updated the test case 3. Updated JavaDoc
|
@Siedlerchr @koppor Thank you very much for your help and suggestions. |
koppor
left a comment
There was a problem hiding this comment.
Thank you for the quick follow-up.
Some small nitpicks remain 😇
| set.add(new MathSciNet(importFormatPreferences)); | ||
| set.add(new ZbMATH(importFormatPreferences)); | ||
| // see https://github.com/JabRef/jabref/issues/5804 | ||
| // set.add(new ACMPortalFetcher(importFormatPreferences)); |
There was a problem hiding this comment.
May I ask whether you committed that change?
|
Thank you for working on it! This brings JabRef a step forward! |
Fixes #5804
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)From issue #5804, ACM Fetcher needs to be rewritten, because of ACM website changes.
One solution is to get the DOI from the HTML results of the search page, then use the export interface to get the JSON format data, and finally parse them.
Search API: https://dl.acm.org/action/doSearch?AllField=<query_string>
Export API: https://dl.acm.org/action/exportCiteProcCitation?targetFile=custom-bibtex&format=bibTex&dois=<doi>,<doi>,...
What did I do:
Successfully get data from AMC Fetcher:

