forked from D-Net/dnet-hadoop
code formatting
This commit is contained in:
parent
c016cc050a
commit
e43ab07af6
|
@ -52,17 +52,22 @@ public class IdentifierFactory implements Serializable {
|
||||||
.stream()
|
.stream()
|
||||||
.filter(s -> pidFilter(s))
|
.filter(s -> pidFilter(s))
|
||||||
.collect(
|
.collect(
|
||||||
Collectors.groupingBy(p -> p.getQualifier().getClassid(),
|
Collectors
|
||||||
Collectors.mapping(p -> p, Collectors.toList()))
|
.groupingBy(
|
||||||
);
|
p -> p.getQualifier().getClassid(),
|
||||||
|
Collectors.mapping(p -> p, Collectors.toList())));
|
||||||
|
|
||||||
return pids
|
return pids
|
||||||
.values()
|
.values()
|
||||||
.stream()
|
.stream()
|
||||||
.flatMap(s -> s.stream())
|
.flatMap(s -> s.stream())
|
||||||
.min(new PidComparator<>(entity))
|
.min(new PidComparator<>(entity))
|
||||||
.map(min -> Optional.ofNullable(pids.get(min.getQualifier().getClassid()))
|
.map(
|
||||||
.map(p -> p.stream()
|
min -> Optional
|
||||||
|
.ofNullable(pids.get(min.getQualifier().getClassid()))
|
||||||
|
.map(
|
||||||
|
p -> p
|
||||||
|
.stream()
|
||||||
.sorted(new PidValueComparator())
|
.sorted(new PidValueComparator())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(s -> idFromPid(entity, s))
|
.map(s -> idFromPid(entity, s))
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.schema.oaf.utils;
|
package eu.dnetlib.dhp.schema.oaf.utils;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
||||||
|
|
||||||
public class OrganizationPidComparator implements Comparator<StructuredProperty> {
|
public class OrganizationPidComparator implements Comparator<StructuredProperty> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.schema.oaf.utils;
|
package eu.dnetlib.dhp.schema.oaf.utils;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.oa.graph.clean.CleaningFunctions;
|
import eu.dnetlib.dhp.oa.graph.clean.CleaningFunctions;
|
||||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||||
import eu.dnetlib.dhp.schema.oaf.OafEntity;
|
import eu.dnetlib.dhp.schema.oaf.OafEntity;
|
||||||
|
@ -8,9 +11,6 @@ import eu.dnetlib.dhp.schema.oaf.Organization;
|
||||||
import eu.dnetlib.dhp.schema.oaf.Result;
|
import eu.dnetlib.dhp.schema.oaf.Result;
|
||||||
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class PidValueComparator implements Comparator<StructuredProperty> {
|
public class PidValueComparator implements Comparator<StructuredProperty> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,8 +26,11 @@ public class PidValueComparator implements Comparator<StructuredProperty> {
|
||||||
StructuredProperty l = CleaningFunctions.normalizePidValue(left);
|
StructuredProperty l = CleaningFunctions.normalizePidValue(left);
|
||||||
StructuredProperty r = CleaningFunctions.normalizePidValue(right);
|
StructuredProperty r = CleaningFunctions.normalizePidValue(right);
|
||||||
|
|
||||||
return Optional.ofNullable(l.getValue())
|
return Optional
|
||||||
.map(lv -> Optional.ofNullable(r.getValue())
|
.ofNullable(l.getValue())
|
||||||
|
.map(
|
||||||
|
lv -> Optional
|
||||||
|
.ofNullable(r.getValue())
|
||||||
.map(rv -> lv.compareTo(rv))
|
.map(rv -> lv.compareTo(rv))
|
||||||
.orElse(-1))
|
.orElse(-1))
|
||||||
.orElse(1);
|
.orElse(1);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.schema.oaf.utils;
|
package eu.dnetlib.dhp.schema.oaf.utils;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
||||||
|
|
||||||
public class ResultPidComparator implements Comparator<StructuredProperty> {
|
public class ResultPidComparator implements Comparator<StructuredProperty> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue