Revision 52916
Added by Sandro La Bruzzo over 5 years ago
modules/dnet-mapreduce-jobs/branches/beta/src/test/java/eu/dnetlib/data/mapreduce/actions/ScholexplorerActionMapperTest.java | ||
---|---|---|
82 | 82 |
List<AtomicAction> actions = ScholixToActions.generateActionsFromScholix(root, configurationMap, setName, agent, new ActionFactory(), nsPrefix, dsName, dsId, DateUtils.now_ISO8601()); |
83 | 83 |
actions.forEach(it-> System.out.println(String.format("%s cf:%s qualifier:%s", it.getTargetRowKey(), it.getTargetColumnFamily(), it.getTargetColumn()))); |
84 | 84 |
|
85 |
System.out.println(actions.get(0).toJSON()); |
|
86 |
|
|
85 | 87 |
} |
86 | 88 |
|
87 | 89 |
@Test |
modules/dnet-mapreduce-jobs/branches/beta/src/main/java/eu/dnetlib/data/mapreduce/hbase/dataimport/ScholexplorerMapper.java | ||
---|---|---|
25 | 25 |
private String dsName; |
26 | 26 |
private String dsId; |
27 | 27 |
private String dateOfCollection; |
28 |
private Text keyout; |
|
29 |
private Text valueOut; |
|
28 | 30 |
private Map<String, ScholExplorerConfiguration> configurationMap= new HashMap<>(); |
29 | 31 |
|
30 | 32 |
@Override |
... | ... | |
48 | 50 |
dsName = context.getConfiguration().get("dsName"); |
49 | 51 |
dsId = context.getConfiguration().get("dsId"); |
50 | 52 |
dateOfCollection = context.getConfiguration().get("dateOfCollection", DateUtils.now_ISO8601()); |
53 |
keyout = new Text(""); |
|
54 |
valueOut = new Text(""); |
|
51 | 55 |
|
52 | 56 |
|
53 | 57 |
} |
... | ... | |
58 | 62 |
final String inputJson =value.toString(); |
59 | 63 |
final JsonObject rootElement = parser.parse(inputJson).getAsJsonObject(); |
60 | 64 |
final List<AtomicAction> actions = ScholixToActions.generateActionsFromScholix(rootElement, configurationMap, setName,agent, factory, nsPrefix, dsName, dsId, dateOfCollection); |
61 |
|
|
62 |
|
|
63 |
// factory.createAtomicAction(); |
|
64 |
|
|
65 |
for(final AtomicAction action : actions) { |
|
66 |
keyout.set(action.getRowKey()); |
|
67 |
valueOut.set(action.toJSON()); |
|
68 |
context.write(keyout, valueOut); |
|
69 |
} |
|
65 | 70 |
} |
66 | 71 |
|
67 | 72 |
|
Also available in: Unified diff
implemented mapper writing