Revision 57783
Added by Claudio Atzori over 4 years ago
modules/dnet-mapreduce-jobs/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/propagation/communitythroughorganization/PropagationCommunityThroughOrganizationFileReducer.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
} |
58 | 58 |
|
59 |
if(communities.size() > 0){ |
|
59 |
if(communities.size() > 0) {
|
|
60 | 60 |
final ResultProtos.Result.Metadata.Builder metadata = ResultProtos.Result.Metadata.newBuilder(); |
61 |
communities.stream().forEach(community-> |
|
62 |
{metadata.addContext(Utils.getContext(community, ORGANIZATION_COMMUNITY_TRUST, CLASS_ORGANIZATION_ID, DATA_INFO_TYPE,CLASS_ORGANIZATION_NAME)); |
|
63 |
context.getCounter(COUNTER_PROPAGATION, "added result to community " + community).increment(resultIds.size());}); |
|
61 |
communities.stream().forEach(community-> { |
|
62 |
metadata.addContext(Utils.getContext(community, ORGANIZATION_COMMUNITY_TRUST, CLASS_ORGANIZATION_ID, DATA_INFO_TYPE,CLASS_ORGANIZATION_NAME)); |
|
63 |
context.getCounter(COUNTER_PROPAGATION, "added result to community " + community).increment(resultIds.size()); |
|
64 |
}); |
|
64 | 65 |
|
65 |
for(String result: resultIds){ |
|
66 |
for(String result: resultIds) {
|
|
66 | 67 |
keyOut.set(result); |
67 | 68 |
outValue.set(JsonFormat.printToString(Utils.getUpdate(metadata, result)).getBytes()); |
68 | 69 |
context.write(keyOut, outValue); |
69 | 70 |
context.getCounter(COUNTER_PROPAGATION, "added community to result").increment(communities.size()); |
70 | 71 |
} |
71 |
|
|
72 |
|
|
73 |
|
|
74 | 72 |
} |
73 |
} |
|
75 | 74 |
|
76 |
|
|
77 |
|
|
78 |
} |
|
79 | 75 |
} |
modules/dnet-mapreduce-jobs/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/propagation/communitythroughorganization/PropagationCommunityThroughOrganizationReducer.java | ||
---|---|---|
27 | 27 |
protected void setup(final Context context) throws IOException, InterruptedException { |
28 | 28 |
super.setup(context); |
29 | 29 |
keyOut = new ImmutableBytesWritable(); |
30 |
|
|
31 | 30 |
} |
32 | 31 |
|
33 | 32 |
|
... | ... | |
48 | 47 |
break; |
49 | 48 |
} |
50 | 49 |
|
51 |
|
|
52 | 50 |
} |
53 | 51 |
|
54 | 52 |
if (communities.size() > 0) { |
Also available in: Unified diff
code formatting