Revision 52823
Added by Claudio Atzori over 5 years ago
ExportResultIdentifiersMapper.java | ||
---|---|---|
4 | 4 |
import java.util.ArrayList; |
5 | 5 |
import java.util.Collections; |
6 | 6 |
import java.util.List; |
7 |
import java.util.Map; |
|
7 | 8 |
import java.util.stream.Collectors; |
8 | 9 |
|
9 | 10 |
import com.google.common.collect.Iterables; |
10 | 11 |
import com.google.common.collect.Lists; |
11 | 12 |
import eu.dnetlib.data.mapreduce.util.DedupUtils; |
12 | 13 |
import eu.dnetlib.data.mapreduce.util.OafDecoder; |
14 |
import eu.dnetlib.data.proto.FieldTypeProtos.StructuredProperty; |
|
13 | 15 |
import eu.dnetlib.data.proto.OafProtos.OafEntity; |
14 | 16 |
import org.apache.commons.logging.Log; |
15 | 17 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
60 | 62 |
|
61 | 63 |
id.setDeleted(d.getOaf().getDataInfo().getDeletedbyinference()); |
62 | 64 |
id.setId(d.getEntityId()); |
63 |
id.setPids(d.getOaf().getEntity().getPidList().stream().map(p -> p.getValue()).collect(Collectors.toList())); |
|
65 |
id.setPids(d.getOaf().getEntity().getPidList().stream() |
|
66 |
.collect(Collectors.groupingBy( |
|
67 |
p -> p.getQualifier().getClassid() |
|
68 |
)).entrySet().stream() |
|
69 |
.collect(Collectors.toMap( |
|
70 |
Map.Entry::getKey, |
|
71 |
e -> e.getValue().stream() |
|
72 |
.map(StructuredProperty::getValue) |
|
73 |
.collect(Collectors.toList())))); |
|
64 | 74 |
|
75 |
|
|
65 | 76 |
final List<OafEntity> childrenList = d.getEntity().getChildrenList(); |
66 | 77 |
if (childrenList != null && !childrenList.isEmpty()) { |
67 | 78 |
final ArrayList<String> mergedIds = Lists.newArrayList(Iterables.transform(childrenList, oafEntity -> oafEntity.getId())); |
Also available in: Unified diff
adjusted ids export procedure