Project

General

Profile

« Previous | Next » 

Revision 52935

fixed mapping from scholix to openaire model

View differences:

ScholexplorerMapper.java
33 33
    protected void setup(Context context) throws IOException, InterruptedException {
34 34
        factory = new ActionFactory();
35 35
        parser = new JsonParser();
36

  
36 37
        conf.put("issn", new ScholExplorerConfiguration(null, false));
37 38
        conf.put("pmid", new ScholExplorerConfiguration("pmid", true,"https://www.ncbi.nlm.nih.gov/pubmed/%s"));
38 39
        conf.put("doi", new ScholExplorerConfiguration("doi", true,"http://dx.doi.org/%s"));
39 40
        conf.put("pbmid", new ScholExplorerConfiguration("pmid", true,"https://www.ncbi.nlm.nih.gov/pubmed/%s"));
40
        conf.put("openaire ", new ScholExplorerConfiguration(null, false));
41
        conf.put("openaire", new ScholExplorerConfiguration(null, false));
41 42
        conf.put("pmcid", new ScholExplorerConfiguration("pmc", true,"https://europepmc.org/articles/%s"));
42 43
        conf.put("pubmedid", new ScholExplorerConfiguration("pmid", true,"https://www.ncbi.nlm.nih.gov/pubmed/%s"));
43 44
        conf.put("icpsr", new ScholExplorerConfiguration(null, false));
44 45
        conf.put("dnet", new ScholExplorerConfiguration(null, false));
45
        conf.put("url ", new ScholExplorerConfiguration(null, true,"%s"));
46
        conf.put("openaire", new ScholExplorerConfiguration(null, false));
46
        conf.put("url", new ScholExplorerConfiguration(null, true,"%s"));
47

  
47 48
        setName = context.getConfiguration().get("setName");
48 49
        agent= new Agent(context.getConfiguration().get("agentId"), context.getConfiguration().get("agentName"), Agent.AGENT_TYPE.service);
49 50
        nsPrefix = context.getConfiguration().get("ns_prefix");
......
60 61

  
61 62
        final String inputJson = value.toString();
62 63
        final JsonObject rootElement = parser.parse(inputJson).getAsJsonObject();
63
        final List<AtomicAction> actions = ScholixToActions.generateActionsFromScholix(rootElement, conf, setName,agent, factory, nsPrefix, dsName, dsId, dateOfCollection);
64
        for(final AtomicAction action : actions) {
65
            keyout.set(action.getRowKey());
66
            valueOut.set(action.toJSON());
67
            context.write(keyout, valueOut);
64
        try {
65
            final List<AtomicAction> actions =
66
                    ScholixToActions.generateActionsFromScholix(rootElement, conf, setName, agent, factory, nsPrefix, dsName, dsId, dateOfCollection);
67
            for (final AtomicAction action : actions) {
68
                keyout.set(action.getRowKey());
69
                valueOut.set(action.toJSON());
70
                context.write(keyout, valueOut);
71
            }
72
        } catch (Throwable e) {
73
            System.err.println(inputJson);
74
            throw e;
68 75
        }
69 76
    }
70 77

  

Also available in: Unified diff