forked from D-Net/dnet-hadoop
[cleaning] cleaning instance.pid and instance.alternateidentifier using the same procedure used to clean result.pid
This commit is contained in:
parent
2e8fd2c531
commit
67afd06cd1
|
@ -224,24 +224,20 @@ public class GraphCleaningFunctions extends CleaningFunctions {
|
||||||
if (Objects.nonNull(r.getInstance())) {
|
if (Objects.nonNull(r.getInstance())) {
|
||||||
|
|
||||||
for (Instance i : r.getInstance()) {
|
for (Instance i : r.getInstance()) {
|
||||||
|
if (Objects.nonNull(i.getPid())) {
|
||||||
|
i.setPid(processPidCleaning(i.getPid()));
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(i.getAlternateIdentifier())) {
|
||||||
|
i.setAlternateIdentifier(processPidCleaning(i.getAlternateIdentifier()));
|
||||||
|
}
|
||||||
Optional
|
Optional
|
||||||
.ofNullable(i.getPid())
|
.ofNullable(i.getPid())
|
||||||
.ifPresent(pid -> {
|
.ifPresent(pid -> {
|
||||||
final Set<StructuredProperty> pids = pid
|
final Set<StructuredProperty> pids = Sets.newHashSet(pid);
|
||||||
.stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.filter(p -> StringUtils.isNotBlank(p.getValue()))
|
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
|
||||||
|
|
||||||
Optional
|
Optional
|
||||||
.ofNullable(i.getAlternateIdentifier())
|
.ofNullable(i.getAlternateIdentifier())
|
||||||
.ifPresent(altId -> {
|
.ifPresent(altId -> {
|
||||||
final Set<StructuredProperty> altIds = altId
|
final Set<StructuredProperty> altIds = Sets.newHashSet(altId);
|
||||||
.stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.filter(p -> StringUtils.isNotBlank(p.getValue()))
|
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
|
||||||
|
|
||||||
i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids)));
|
i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue