Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.cleanup

public Class ArXivDoiCleanup

extends Object
implements CleanupJob
Class Inheritance
All Implemented Interfaces
org.jabref.logic.cleanup.CleanupJob
Imports
java.util.ArrayList, .List, .Locale, .Optional, org.jabref.logic.formatter.bibtexfields.ClearFormatter, org.jabref.model.FieldChange, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.Field, .StandardField, org.jabref.model.entry.identifier.ArXivIdentifier, .DOI

Consolidates the arXiv identifier of an entry onto the DOI field.

arXiv articles are automatically assigned a stable DOI with the prefix 10.48550/arXiv., followed by the arXiv ID. Replacing an article with a new version does not generate a new DOI; the metadata of the existing DOI is updated at DataCite instead. The DOI is therefore the canonical, version-stable identifier and is preferred over the (redundant) eprint field.

See the arXiv DOI documentation.

Rules:

  1. eprint holds an arXiv ID and there is no valid DOI (absent or unparseable) -> create the DOI from the eprint.
  2. the DOI field holds an arXiv DOI matching the eprint -> drop the redundant eprint fields.
  3. otherwise (e.g. a real publisher DOI next to an arXiv eprint, or no arXiv data) -> keep both.

This job is self-contained and independent of cleanup job ordering. The consolidation reads the already-normalized eprint and doi fields. When no consolidation is possible from the fields as they are, the arXiv identifier might still live in a field such as url/journal/note, from where EprintCleanup would move it into the eprint field. In that case this job applies EprintCleanup itself, but only after probing (on a copy) that doing so actually enables a consolidation - an entry without arXiv data is left untouched, regardless of whether EprintCleanup runs separately or at all.

Field Summary

Modifier and TypeField and Description
private static final String
ARXIV_DOI_PREFIX

arXiv DOIs use the prefix "10.48550/arXiv." (the DOI registrant assigned to arXiv).

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Optional<String>
arXivIdFromDoi(DOI doi)

Extracts the normalized arXiv ID from an arXiv DOI (the part after the "10.48550/arXiv." prefix).

public List<FieldChange>
cleanup(BibEntry entry)

Implements org.jabref.logic.cleanup.CleanupJob.cleanup.

Cleans up the given entry and returns the list of changes made.

private List<FieldChange>
consolidate(BibEntry entry)

Consolidates the arXiv identifier onto the DOI field using the already-populated eprint and doi fields.

private static boolean
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ARXIV_DOI_PREFIXback to summary
private static final String ARXIV_DOI_PREFIX

arXiv DOIs use the prefix "10.48550/arXiv." (the DOI registrant assigned to arXiv).

Constructor Detail

ArXivDoiCleanupback to summary
public ArXivDoiCleanup()

Method Detail

arXivIdFromDoiback to summary
private static Optional<String> arXivIdFromDoi(DOI doi)

Extracts the normalized arXiv ID from an arXiv DOI (the part after the "10.48550/arXiv." prefix).

cleanupback to summary
public List<FieldChange> cleanup(BibEntry entry)

Implements org.jabref.logic.cleanup.CleanupJob.cleanup.

Doc from org.jabref.logic.cleanup.CleanupJob.cleanup.

Cleans up the given entry and returns the list of changes made.

Annotations
@Override
consolidateback to summary
private List<FieldChange> consolidate(BibEntry entry)

Consolidates the arXiv identifier onto the DOI field using the already-populated eprint and doi fields. Returns the changes made, or an empty list when no rule applies.

isArXivDoiback to summary
private static boolean isArXivDoi(DOI doi)
removeFieldValueback to summary
private void removeFieldValue(BibEntry entry, Field field, List<FieldChange> changes)