do not consider NCID, GBIF as PIDs candidate for the ID creation

This commit is contained in:
Claudio Atzori 2020-11-30 16:52:40 +01:00
parent 2c407e775e
commit 349e7246aa
4 changed files with 15 additions and 27 deletions

View File

@ -91,17 +91,15 @@ public class IdentifierFactory implements Serializable {
if (CleaningFunctions.PID_BLACKLIST.contains(StringUtils.trim(s.getValue().toLowerCase()))) { if (CleaningFunctions.PID_BLACKLIST.contains(StringUtils.trim(s.getValue().toLowerCase()))) {
return false; return false;
} }
try { switch (PidType.tryValueOf(s.getQualifier().getClassid())) {
switch (PidType.valueOf(s.getQualifier().getClassid())) {
case doi: case doi:
final String doi = StringUtils.trim(StringUtils.lowerCase(s.getValue())); final String doi = StringUtils.trim(StringUtils.lowerCase(s.getValue()));
return doi.matches(DOI_REGEX); return doi.matches(DOI_REGEX);
case original:
return false;
default: default:
return true; return true;
} }
} catch (IllegalArgumentException e) {
return false;
}
} }
private static <T extends OafEntity> String idFromPid(T entity, StructuredProperty s, boolean md5) { private static <T extends OafEntity> String idFromPid(T entity, StructuredProperty s, boolean md5) {

View File

@ -10,8 +10,8 @@ public class OrganizationPidComparator implements Comparator<StructuredProperty>
@Override @Override
public int compare(StructuredProperty left, StructuredProperty right) { public int compare(StructuredProperty left, StructuredProperty right) {
PidType lClass = PidType.valueOf(left.getQualifier().getClassid()); PidType lClass = PidType.tryValueOf(left.getQualifier().getClassid());
PidType rClass = PidType.valueOf(right.getQualifier().getClassid()); PidType rClass = PidType.tryValueOf(right.getQualifier().getClassid());
if (lClass.equals(PidType.GRID)) if (lClass.equals(PidType.GRID))
return -1; return -1;

View File

@ -6,7 +6,7 @@ import org.apache.commons.lang3.EnumUtils;
public enum PidType { public enum PidType {
// Result // Result
doi, pmid, pmc, handle, arXiv, NCID, GBIF, nct, pdb, doi, pmid, pmc, handle, arXiv, nct, pdb,
// Organization // Organization
GRID, mag_id, urn, GRID, mag_id, urn,

View File

@ -10,8 +10,8 @@ public class ResultPidComparator implements Comparator<StructuredProperty> {
@Override @Override
public int compare(StructuredProperty left, StructuredProperty right) { public int compare(StructuredProperty left, StructuredProperty right) {
PidType lClass = PidType.valueOf(left.getQualifier().getClassid()); PidType lClass = PidType.tryValueOf(left.getQualifier().getClassid());
PidType rClass = PidType.valueOf(right.getQualifier().getClassid()); PidType rClass = PidType.tryValueOf(right.getQualifier().getClassid());
if (lClass.equals(PidType.doi)) if (lClass.equals(PidType.doi))
return -1; return -1;
@ -38,24 +38,14 @@ public class ResultPidComparator implements Comparator<StructuredProperty> {
if (rClass.equals(PidType.arXiv)) if (rClass.equals(PidType.arXiv))
return 1; return 1;
if (lClass.equals(PidType.NCID))
return -1;
if (rClass.equals(PidType.NCID))
return 1;
if (lClass.equals(PidType.GBIF))
return -1;
if (rClass.equals(PidType.GBIF))
return 1;
if (lClass.equals(PidType.nct)) if (lClass.equals(PidType.nct))
return -1; return -1;
if (rClass.equals(PidType.nct)) if (rClass.equals(PidType.nct))
return 1; return 1;
if (lClass.equals(PidType.urn)) if (lClass.equals(PidType.pdb))
return -1; return -1;
if (rClass.equals(PidType.urn)) if (rClass.equals(PidType.pdb))
return 1; return 1;
return 0; return 0;