2020-10-01 10:50:15 +02:00
|
|
|
|
2020-11-24 18:34:03 +01:00
|
|
|
package eu.dnetlib.dhp.schema.oaf;
|
2020-10-01 10:50:15 +02:00
|
|
|
|
2020-11-19 14:34:54 +01:00
|
|
|
import java.util.*;
|
2020-10-01 12:50:40 +02:00
|
|
|
import java.util.function.Function;
|
2020-10-01 10:50:15 +02:00
|
|
|
import java.util.stream.Collectors;
|
2021-04-13 14:32:41 +02:00
|
|
|
import java.util.stream.Stream;
|
2020-10-01 10:50:15 +02:00
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
2020-10-02 09:43:24 +02:00
|
|
|
import com.clearspring.analytics.util.Lists;
|
2021-03-19 09:36:12 +01:00
|
|
|
import com.google.common.collect.Sets;
|
2020-10-02 09:43:24 +02:00
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
2021-03-19 09:36:12 +01:00
|
|
|
import eu.dnetlib.dhp.schema.oaf.utils.PidBlacklistProvider;
|
2020-10-01 10:50:15 +02:00
|
|
|
|
|
|
|
public class CleaningFunctions {
|
|
|
|
|
2021-03-09 11:37:41 +01:00
|
|
|
public static final String DOI_PREFIX_REGEX = "(^10\\.|\\/10.)";
|
2021-03-09 17:11:50 +01:00
|
|
|
public static final String DOI_PREFIX = "10.";
|
|
|
|
|
2020-10-01 12:50:40 +02:00
|
|
|
public static final String ORCID_PREFIX_REGEX = "^http(s?):\\/\\/orcid\\.org\\/";
|
2020-11-27 16:07:24 +01:00
|
|
|
public static final String CLEANING_REGEX = "(?:\\n|\\r|\\t)";
|
2020-11-17 12:27:06 +01:00
|
|
|
|
|
|
|
public static final Set<String> PID_BLACKLIST = new HashSet<>();
|
2021-04-13 14:32:41 +02:00
|
|
|
public static final String INVALID_AUTHOR_REGEX = ".*deactivated.*";
|
|
|
|
public static final String TITLE_FILTER_REGEX = "[.*test.*\\W\\d]";
|
|
|
|
public static final int TITLE_FILTER_RESIDUAL_LENGTH = 10;
|
2020-11-17 12:27:06 +01:00
|
|
|
|
|
|
|
static {
|
|
|
|
PID_BLACKLIST.add("none");
|
|
|
|
PID_BLACKLIST.add("na");
|
|
|
|
}
|
2020-10-01 12:50:40 +02:00
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
public static <T extends Oaf> T fixVocabularyNames(T value) {
|
|
|
|
if (value instanceof Datasource) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Project) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Organization) {
|
|
|
|
Organization o = (Organization) value;
|
|
|
|
if (Objects.nonNull(o.getCountry())) {
|
|
|
|
fixVocabName(o.getCountry(), ModelConstants.DNET_COUNTRY_TYPE);
|
|
|
|
}
|
|
|
|
} else if (value instanceof Relation) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Result) {
|
|
|
|
|
|
|
|
Result r = (Result) value;
|
|
|
|
|
|
|
|
fixVocabName(r.getLanguage(), ModelConstants.DNET_LANGUAGES);
|
|
|
|
fixVocabName(r.getResourcetype(), ModelConstants.DNET_DATA_CITE_RESOURCE);
|
|
|
|
fixVocabName(r.getBestaccessright(), ModelConstants.DNET_ACCESS_MODES);
|
|
|
|
|
|
|
|
if (Objects.nonNull(r.getSubject())) {
|
|
|
|
r.getSubject().forEach(s -> fixVocabName(s.getQualifier(), ModelConstants.DNET_SUBJECT_TYPOLOGIES));
|
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getInstance())) {
|
|
|
|
for (Instance i : r.getInstance()) {
|
|
|
|
fixVocabName(i.getAccessright(), ModelConstants.DNET_ACCESS_MODES);
|
|
|
|
fixVocabName(i.getRefereed(), ModelConstants.DNET_REVIEW_LEVELS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getAuthor())) {
|
2021-04-12 17:31:40 +02:00
|
|
|
r.getAuthor().stream().filter(Objects::nonNull).forEach(a -> {
|
2020-10-01 10:50:15 +02:00
|
|
|
if (Objects.nonNull(a.getPid())) {
|
2021-04-12 17:31:40 +02:00
|
|
|
a.getPid().stream().filter(Objects::nonNull).forEach(p -> {
|
2020-10-01 10:50:15 +02:00
|
|
|
fixVocabName(p.getQualifier(), ModelConstants.DNET_PID_TYPES);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (value instanceof Publication) {
|
|
|
|
|
|
|
|
} else if (value instanceof eu.dnetlib.dhp.schema.oaf.Dataset) {
|
|
|
|
|
|
|
|
} else if (value instanceof OtherResearchProduct) {
|
|
|
|
|
|
|
|
} else if (value instanceof Software) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2021-04-13 14:32:41 +02:00
|
|
|
public static <T extends Oaf> boolean filter(T value) {
|
|
|
|
if (value instanceof Datasource) {
|
|
|
|
// nothing to evaluate here
|
|
|
|
} else if (value instanceof Project) {
|
|
|
|
// nothing to evaluate here
|
|
|
|
} else if (value instanceof Organization) {
|
|
|
|
// nothing to evaluate here
|
|
|
|
} else if (value instanceof Relation) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Result) {
|
|
|
|
|
|
|
|
Result r = (Result) value;
|
|
|
|
|
|
|
|
if (Objects.nonNull(r.getTitle()) && r.getTitle().isEmpty()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value instanceof Publication) {
|
|
|
|
|
|
|
|
} else if (value instanceof eu.dnetlib.dhp.schema.oaf.Dataset) {
|
|
|
|
|
|
|
|
} else if (value instanceof OtherResearchProduct) {
|
|
|
|
|
|
|
|
} else if (value instanceof Software) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-11-24 18:34:03 +01:00
|
|
|
public static <T extends Oaf> T cleanup(T value) {
|
2020-10-01 10:50:15 +02:00
|
|
|
if (value instanceof Datasource) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Project) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Organization) {
|
|
|
|
Organization o = (Organization) value;
|
|
|
|
if (Objects.isNull(o.getCountry()) || StringUtils.isBlank(o.getCountry().getClassid())) {
|
2021-01-12 15:36:38 +01:00
|
|
|
o.setCountry(ModelConstants.UNKNOWN_COUNTRY);
|
2020-10-01 10:50:15 +02:00
|
|
|
}
|
|
|
|
} else if (value instanceof Relation) {
|
|
|
|
// nothing to clean here
|
|
|
|
} else if (value instanceof Result) {
|
|
|
|
|
|
|
|
Result r = (Result) value;
|
|
|
|
if (Objects.nonNull(r.getPublisher()) && StringUtils.isBlank(r.getPublisher().getValue())) {
|
|
|
|
r.setPublisher(null);
|
|
|
|
}
|
|
|
|
if (Objects.isNull(r.getLanguage()) || StringUtils.isBlank(r.getLanguage().getClassid())) {
|
|
|
|
r
|
|
|
|
.setLanguage(
|
|
|
|
qualifier("und", "Undetermined", ModelConstants.DNET_LANGUAGES));
|
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getSubject())) {
|
|
|
|
r
|
|
|
|
.setSubject(
|
|
|
|
r
|
|
|
|
.getSubject()
|
|
|
|
.stream()
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
.filter(sp -> StringUtils.isNotBlank(sp.getValue()))
|
|
|
|
.filter(sp -> Objects.nonNull(sp.getQualifier()))
|
|
|
|
.filter(sp -> StringUtils.isNotBlank(sp.getQualifier().getClassid()))
|
2020-11-27 16:07:24 +01:00
|
|
|
.map(CleaningFunctions::cleanValue)
|
2020-11-24 18:34:03 +01:00
|
|
|
.collect(Collectors.toList()));
|
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getTitle())) {
|
|
|
|
r
|
|
|
|
.setTitle(
|
|
|
|
r
|
|
|
|
.getTitle()
|
|
|
|
.stream()
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
.filter(sp -> StringUtils.isNotBlank(sp.getValue()))
|
2021-04-13 14:32:41 +02:00
|
|
|
.filter(
|
|
|
|
sp -> sp
|
|
|
|
.getValue()
|
|
|
|
.toLowerCase()
|
|
|
|
.replaceAll(TITLE_FILTER_REGEX, "")
|
|
|
|
.length() > TITLE_FILTER_RESIDUAL_LENGTH)
|
2020-11-27 16:07:24 +01:00
|
|
|
.map(CleaningFunctions::cleanValue)
|
2020-11-24 18:34:03 +01:00
|
|
|
.collect(Collectors.toList()));
|
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getDescription())) {
|
|
|
|
r
|
|
|
|
.setDescription(
|
|
|
|
r
|
|
|
|
.getDescription()
|
|
|
|
.stream()
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
.filter(sp -> StringUtils.isNotBlank(sp.getValue()))
|
2020-11-27 16:07:24 +01:00
|
|
|
.map(CleaningFunctions::cleanValue)
|
2020-10-01 10:50:15 +02:00
|
|
|
.collect(Collectors.toList()));
|
|
|
|
}
|
2020-11-03 11:52:10 +01:00
|
|
|
if (Objects.nonNull(r.getPid())) {
|
2021-03-19 09:07:30 +01:00
|
|
|
r.setPid(processPidCleaning(r.getPid()));
|
2020-11-03 11:52:10 +01:00
|
|
|
}
|
2020-10-01 10:50:15 +02:00
|
|
|
if (Objects.isNull(r.getResourcetype()) || StringUtils.isBlank(r.getResourcetype().getClassid())) {
|
|
|
|
r
|
|
|
|
.setResourcetype(
|
2021-01-12 15:36:38 +01:00
|
|
|
qualifier(ModelConstants.UNKNOWN, "Unknown", ModelConstants.DNET_DATA_CITE_RESOURCE));
|
2020-10-01 10:50:15 +02:00
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getInstance())) {
|
2021-03-19 09:07:30 +01:00
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
for (Instance i : r.getInstance()) {
|
2021-03-23 09:28:58 +01:00
|
|
|
Optional
|
|
|
|
.ofNullable(i.getPid())
|
|
|
|
.ifPresent(pid -> {
|
2021-03-29 17:47:11 +02:00
|
|
|
final Set<StructuredProperty> pids = pid
|
|
|
|
.stream()
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
.filter(p -> StringUtils.isNotBlank(p.getValue()))
|
|
|
|
.collect(Collectors.toCollection(HashSet::new));
|
|
|
|
|
|
|
|
Optional
|
|
|
|
.ofNullable(i.getAlternateIdentifier())
|
|
|
|
.ifPresent(altId -> {
|
|
|
|
final Set<StructuredProperty> altIds = altId
|
2021-03-26 12:30:00 +01:00
|
|
|
.stream()
|
2021-03-29 16:01:35 +02:00
|
|
|
.filter(Objects::nonNull)
|
2021-03-29 14:23:18 +02:00
|
|
|
.filter(p -> StringUtils.isNotBlank(p.getValue()))
|
|
|
|
.collect(Collectors.toCollection(HashSet::new));
|
|
|
|
|
2021-03-29 17:47:11 +02:00
|
|
|
i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids)));
|
|
|
|
});
|
2021-03-23 09:28:58 +01:00
|
|
|
});
|
2021-03-19 09:07:30 +01:00
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
if (Objects.isNull(i.getAccessright()) || StringUtils.isBlank(i.getAccessright().getClassid())) {
|
2021-01-12 15:36:38 +01:00
|
|
|
i
|
|
|
|
.setAccessright(
|
2021-03-31 17:07:13 +02:00
|
|
|
accessRight(
|
|
|
|
ModelConstants.UNKNOWN, ModelConstants.NOT_AVAILABLE,
|
|
|
|
ModelConstants.DNET_ACCESS_MODES));
|
2020-10-01 10:50:15 +02:00
|
|
|
}
|
|
|
|
if (Objects.isNull(i.getHostedby()) || StringUtils.isBlank(i.getHostedby().getKey())) {
|
|
|
|
i.setHostedby(ModelConstants.UNKNOWN_REPOSITORY);
|
|
|
|
}
|
|
|
|
if (Objects.isNull(i.getRefereed())) {
|
|
|
|
i.setRefereed(qualifier("0000", "Unknown", ModelConstants.DNET_REVIEW_LEVELS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Objects.isNull(r.getBestaccessright()) || StringUtils.isBlank(r.getBestaccessright().getClassid())) {
|
2020-11-03 12:19:46 +01:00
|
|
|
Qualifier bestaccessrights = OafMapperUtils.createBestAccessRights(r.getInstance());
|
2020-10-01 10:50:15 +02:00
|
|
|
if (Objects.isNull(bestaccessrights)) {
|
|
|
|
r
|
|
|
|
.setBestaccessright(
|
2021-03-31 17:07:13 +02:00
|
|
|
qualifier(
|
|
|
|
ModelConstants.UNKNOWN, ModelConstants.NOT_AVAILABLE,
|
|
|
|
ModelConstants.DNET_ACCESS_MODES));
|
2020-10-01 10:50:15 +02:00
|
|
|
} else {
|
|
|
|
r.setBestaccessright(bestaccessrights);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Objects.nonNull(r.getAuthor())) {
|
2021-04-13 14:32:41 +02:00
|
|
|
final List<Author> authors = Lists.newArrayList();
|
2020-10-02 09:43:24 +02:00
|
|
|
for (Author a : r.getAuthor()) {
|
2020-10-01 12:50:40 +02:00
|
|
|
if (Objects.isNull(a.getPid())) {
|
|
|
|
a.setPid(Lists.newArrayList());
|
|
|
|
} else {
|
2020-10-02 09:43:24 +02:00
|
|
|
a
|
|
|
|
.setPid(
|
|
|
|
a
|
|
|
|
.getPid()
|
|
|
|
.stream()
|
2021-04-12 17:31:40 +02:00
|
|
|
.filter(Objects::nonNull)
|
2020-10-02 09:43:24 +02:00
|
|
|
.filter(p -> Objects.nonNull(p.getQualifier()))
|
|
|
|
.filter(p -> StringUtils.isNotBlank(p.getValue()))
|
|
|
|
.map(p -> {
|
|
|
|
p.setValue(p.getValue().trim().replaceAll(ORCID_PREFIX_REGEX, ""));
|
|
|
|
return p;
|
|
|
|
})
|
2021-01-12 15:36:38 +01:00
|
|
|
.filter(p -> StringUtils.isNotBlank(p.getValue()))
|
2020-10-02 09:43:24 +02:00
|
|
|
.collect(
|
|
|
|
Collectors
|
|
|
|
.toMap(
|
|
|
|
StructuredProperty::getValue, Function.identity(), (p1, p2) -> p1,
|
|
|
|
LinkedHashMap::new))
|
|
|
|
.values()
|
|
|
|
.stream()
|
|
|
|
.collect(Collectors.toList()));
|
2020-10-01 12:50:40 +02:00
|
|
|
}
|
2021-04-13 14:32:41 +02:00
|
|
|
if (StringUtils.isBlank(a.getFullname())) {
|
|
|
|
if (StringUtils.isNotBlank(a.getName()) && StringUtils.isNotBlank(a.getSurname())) {
|
|
|
|
a.setFullname(a.getSurname() + ", " + a.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(a.getFullname()) && isValidAuthorName(a)) {
|
|
|
|
authors.add(a);
|
|
|
|
}
|
2020-10-01 12:50:40 +02:00
|
|
|
}
|
|
|
|
|
2021-04-13 14:32:41 +02:00
|
|
|
boolean nullRank = authors
|
|
|
|
.stream()
|
|
|
|
.anyMatch(a -> Objects.isNull(a.getRank()));
|
|
|
|
if (nullRank) {
|
|
|
|
int i = 1;
|
|
|
|
for (Author author : authors) {
|
|
|
|
author.setRank(i++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
r.setAuthor(authors);
|
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
}
|
|
|
|
if (value instanceof Publication) {
|
|
|
|
|
|
|
|
} else if (value instanceof eu.dnetlib.dhp.schema.oaf.Dataset) {
|
|
|
|
|
|
|
|
} else if (value instanceof OtherResearchProduct) {
|
|
|
|
|
|
|
|
} else if (value instanceof Software) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2021-04-13 14:32:41 +02:00
|
|
|
private static boolean isValidAuthorName(Author a) {
|
|
|
|
return !Stream
|
|
|
|
.of(a.getFullname(), a.getName(), a.getSurname())
|
|
|
|
.filter(s -> s != null && !s.isEmpty())
|
|
|
|
.collect(Collectors.joining(""))
|
|
|
|
.toLowerCase()
|
|
|
|
.matches(INVALID_AUTHOR_REGEX);
|
|
|
|
}
|
|
|
|
|
2021-03-19 09:07:30 +01:00
|
|
|
private static List<StructuredProperty> processPidCleaning(List<StructuredProperty> pids) {
|
2021-03-19 09:36:12 +01:00
|
|
|
return pids
|
|
|
|
.stream()
|
2021-03-19 09:07:30 +01:00
|
|
|
.filter(Objects::nonNull)
|
|
|
|
.filter(sp -> StringUtils.isNotBlank(StringUtils.trim(sp.getValue())))
|
|
|
|
.filter(sp -> !PID_BLACKLIST.contains(sp.getValue().trim().toLowerCase()))
|
|
|
|
.filter(sp -> Objects.nonNull(sp.getQualifier()))
|
|
|
|
.filter(sp -> StringUtils.isNotBlank(sp.getQualifier().getClassid()))
|
|
|
|
.map(CleaningFunctions::normalizePidValue)
|
|
|
|
.filter(CleaningFunctions::pidFilter)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
|
2020-11-27 16:07:24 +01:00
|
|
|
protected static StructuredProperty cleanValue(StructuredProperty s) {
|
|
|
|
s.setValue(s.getValue().replaceAll(CLEANING_REGEX, " "));
|
2020-11-24 18:34:03 +01:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2020-11-27 16:07:24 +01:00
|
|
|
protected static Field<String> cleanValue(Field<String> s) {
|
|
|
|
s.setValue(s.getValue().replaceAll(CLEANING_REGEX, " "));
|
2020-11-24 18:34:03 +01:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
// HELPERS
|
|
|
|
|
|
|
|
private static void fixVocabName(Qualifier q, String vocabularyName) {
|
|
|
|
if (Objects.nonNull(q) && StringUtils.isBlank(q.getSchemeid())) {
|
|
|
|
q.setSchemeid(vocabularyName);
|
|
|
|
q.setSchemename(vocabularyName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-12 15:36:38 +01:00
|
|
|
private static AccessRight accessRight(String classid, String classname, String scheme) {
|
2020-10-01 10:50:15 +02:00
|
|
|
return OafMapperUtils
|
2021-01-12 15:36:38 +01:00
|
|
|
.accessRight(
|
2020-10-01 10:50:15 +02:00
|
|
|
classid, classname, scheme, scheme);
|
|
|
|
}
|
|
|
|
|
2021-01-12 15:36:38 +01:00
|
|
|
private static Qualifier qualifier(String classid, String classname, String scheme) {
|
|
|
|
return OafMapperUtils
|
|
|
|
.qualifier(
|
|
|
|
classid, classname, scheme, scheme);
|
2020-12-09 09:10:33 +01:00
|
|
|
}
|
|
|
|
|
2021-03-09 17:11:50 +01:00
|
|
|
/**
|
|
|
|
* Utility method that filter PID values on a per-type basis.
|
2021-03-19 09:07:30 +01:00
|
|
|
* @param s the PID whose value will be checked.
|
|
|
|
* @return false if the pid matches the filter criteria, true otherwise.
|
2021-03-09 17:11:50 +01:00
|
|
|
*/
|
2021-03-19 09:07:30 +01:00
|
|
|
public static boolean pidFilter(StructuredProperty s) {
|
|
|
|
final String pidValue = s.getValue();
|
|
|
|
if (Objects.isNull(s.getQualifier()) ||
|
2021-03-19 09:36:12 +01:00
|
|
|
StringUtils.isBlank(pidValue) ||
|
|
|
|
StringUtils.isBlank(pidValue.replaceAll("(?:\\n|\\r|\\t|\\s)", ""))) {
|
2021-03-09 17:11:50 +01:00
|
|
|
return false;
|
|
|
|
}
|
2021-03-19 09:07:30 +01:00
|
|
|
if (CleaningFunctions.PID_BLACKLIST.contains(pidValue)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (PidBlacklistProvider.getBlacklist(s.getQualifier().getClassid()).contains(pidValue)) {
|
|
|
|
return false;
|
2021-03-09 17:11:50 +01:00
|
|
|
}
|
2021-03-19 09:07:30 +01:00
|
|
|
return true;
|
2021-03-09 17:11:50 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 12:19:46 +01:00
|
|
|
/**
|
|
|
|
* Utility method that normalises PID values on a per-type basis.
|
|
|
|
* @param pid the PID whose value will be normalised.
|
|
|
|
* @return the PID containing the normalised value.
|
|
|
|
*/
|
|
|
|
public static StructuredProperty normalizePidValue(StructuredProperty pid) {
|
|
|
|
String value = Optional
|
|
|
|
.ofNullable(pid.getValue())
|
|
|
|
.map(String::trim)
|
|
|
|
.orElseThrow(() -> new IllegalArgumentException("PID value cannot be empty"));
|
|
|
|
switch (pid.getQualifier().getClassid()) {
|
|
|
|
|
|
|
|
// TODO add cleaning for more PID types as needed
|
|
|
|
case "doi":
|
2021-03-09 17:11:50 +01:00
|
|
|
pid.setValue(value.toLowerCase().replaceFirst(DOI_PREFIX_REGEX, DOI_PREFIX));
|
2020-11-03 12:19:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return pid;
|
|
|
|
}
|
|
|
|
|
2020-10-01 10:50:15 +02:00
|
|
|
}
|