Skip to content

Commit

Permalink
Remove OAI2Fetcher (#4140)
Browse files Browse the repository at this point in the history
* Remove OAI2Fetcher

* Remove obsolete language keys
  • Loading branch information
tobiasdiez committed Jul 2, 2018
1 parent ceb3370 commit 8ee3f6d
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 675 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Use {@link SearchBasedEntryFetcher} instead <br>
* Implement this interface to add another activeFetcher (something that grabs records
* from the Web for JabRef). Have a look at the existing implemenations
* OAI2Fetcher, IEEEXploreFetcher, JStorFetcher and
* IEEEXploreFetcher, JStorFetcher and
* CiteSeerEntryFetcher.
*
* Note: You also need to implement the method stopFetching from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class EntryFetchers {
public EntryFetchers(JournalAbbreviationLoader abbreviationLoader) {
entryFetchers.add(new CiteSeerXFetcher());
entryFetchers.add(new IEEEXploreFetcher(abbreviationLoader));
// entryFetchers.add(new OAI2Fetcher()); - new arXiv fetcher in place, see below

WebFetchers.getSearchBasedFetchers(Globals.prefs.getImportFormatPreferences()).stream()
.map(SearchBasedEntryFetcher::new)
Expand Down
267 changes: 0 additions & 267 deletions src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java

This file was deleted.

13 changes: 9 additions & 4 deletions src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.jabref.logic.importer.IdFetcher;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.SearchBasedFetcher;
import org.jabref.logic.importer.util.OAI2Handler;
import org.jabref.logic.util.io.XMLUtil;
import org.jabref.logic.util.strings.StringSimilarity;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -297,7 +296,7 @@ public ArXivEntry(Node item) {

// Title of the article
// The result from the arXiv contains hard line breaks, try to remove them
title = XMLUtil.getNodeContent(item, "title").map(OAI2Handler::correctLineBreaks);
title = XMLUtil.getNodeContent(item, "title").map(ArXivEntry::correctLineBreaks);

// The url leading to the abstract page
urlAbstractPage = XMLUtil.getNodeContent(item, "id");
Expand All @@ -306,8 +305,8 @@ public ArXivEntry(Node item) {
publishedDate = XMLUtil.getNodeContent(item, "published");

// Abstract of the article
abstractText = XMLUtil.getNodeContent(item, "summary").map(OAI2Handler::correctLineBreaks)
.map(String::trim);
abstractText = XMLUtil.getNodeContent(item, "summary").map(ArXivEntry::correctLineBreaks)
.map(String::trim);

// Authors of the article
authorNames = new ArrayList<>();
Expand Down Expand Up @@ -351,6 +350,12 @@ public ArXivEntry(Node item) {
.flatMap(node -> XMLUtil.getAttributeContent(node, "term"));
}

public static String correctLineBreaks(String s) {
String result = s.replaceAll("\\n(?!\\s*\\n)", " ");
result = result.replaceAll("\\s*\\n\\s*", "\n");
return result.replaceAll(" {2,}", " ").replaceAll("(^\\s*|\\s+$)", "");
}

/**
* Returns the url of the linked pdf
*/
Expand Down
Loading

0 comments on commit 8ee3f6d

Please sign in to comment.