Revision 57188
Added by Claudio Atzori over 4 years ago
SoftwareEnrichmentReducer.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
@Override |
28 | 28 |
protected String counterGroup() { |
29 |
return "Broker Enrichment projects";
|
|
29 |
return "Broker Enrichment Software";
|
|
30 | 30 |
} |
31 | 31 |
|
32 | 32 |
@Override |
... | ... | |
70 | 70 |
.collect(Collectors.toList()); |
71 | 71 |
|
72 | 72 |
if (valid.isEmpty()) { |
73 |
context.getCounter(counterGroup(), "Events Skipped - Missing project").increment(1);
|
|
73 |
context.getCounter(counterGroup(), "Events Skipped - Missing software").increment(1);
|
|
74 | 74 |
return; |
75 | 75 |
} |
76 | 76 |
|
... | ... | |
116 | 116 |
|
117 | 117 |
} |
118 | 118 |
|
119 |
private Oaf addSoftware(final Oaf current, final Map<String, Oaf> software) { |
|
119 |
private Oaf addSoftware(final Oaf current, final Map<String, Oaf> softwareMap) {
|
|
120 | 120 |
|
121 | 121 |
final Oaf.Builder oafBuilder = Oaf.newBuilder(current); |
122 | 122 |
final List<Oaf> cachedRels = Lists.newArrayList(); |
123 | 123 |
|
124 | 124 |
for (final Oaf.Builder cachedOafRel : oafBuilder.getEntityBuilder().getCachedOafRelBuilderList()) { |
125 |
final String projectId = cachedOafRel.getRel().getTarget();
|
|
125 |
final String softwareId = cachedOafRel.getRel().getTarget();
|
|
126 | 126 |
|
127 |
if (software.containsKey(projectId)) {
|
|
128 |
final Oaf project = software.get(projectId);
|
|
127 |
if (softwareMap.containsKey(softwareId)) {
|
|
128 |
final Oaf software = softwareMap.get(softwareId);
|
|
129 | 129 |
|
130 |
cachedOafRel.getRelBuilder().setCachedOafTarget(project);
|
|
130 |
cachedOafRel.getRelBuilder().setCachedOafTarget(software);
|
|
131 | 131 |
cachedRels.add(cachedOafRel.build()); |
132 | 132 |
} |
133 | 133 |
} |
Also available in: Unified diff
removed project reference from src/test/resources/eu/dnetlib/data/transform/odf.xml, the test didn't include any check against it