From b5b7dc210401c1a9de68aad3c7ff9212cf355bb6 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Fri, 26 Mar 2021 12:30:00 +0100 Subject: [PATCH] [Cleaning] drop alternate identifiers with empty values --- .../java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java index afbe0cff6..6c7d3e915 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java @@ -152,7 +152,12 @@ public class CleaningFunctions { Optional .ofNullable(i.getPid()) .ifPresent(pid -> { - final Set pids = Sets.newHashSet(pid); + final Set pids = Sets + .newHashSet( + pid + .stream() + .filter(p -> StringUtils.isBlank(p.getValue())) + .collect(Collectors.toList())); final Set altIds = Sets.newHashSet(i.getAlternateIdentifier()); i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids))); });