Project

General

Profile

« Previous | Next » 

Revision 40813

Added by Eri Katsari over 8 years ago

fixed error in json file

View differences:

LodImportReducer.java
22 22
    private DataSource ds;
23 23
    private String fileName = "";
24 24
    private Configuration hadoopConf;
25

  
25
    public static enum REC_COUNTER {
26
        PROJECTS,
27
        RESULTS,
28
        TOTAL,
29
        DATASOURCE,
30
        ORGANIZATION
31
    };
26 32
    @Override
27 33
    protected void setup(Context context) throws IOException, InterruptedException {
28 34
        this.hadoopConf = context.getConfiguration();
......
30 36

  
31 37
        try {
32 38
            ds = DB.getDatasource(hadoopConf.get("lod.conLine"), hadoopConf.get("lod.username"), hadoopConf.get("lod.password"), hadoopConf.get("lod.minCpart"), hadoopConf.get("lod.maxCpart"), hadoopConf.get("lod.part"));
39

  
33 40
        } catch (Exception e) {
34
            log.error("", e);
41
            log.error(e.toString(), e);
35 42

  
36 43
        }
37 44

  
......
42 49
        JSONObject entitiesMappings = new JSONObject(hadoopConf.get("lod.jsonEntities"));
43 50
        JSONObject relationsMappings = new JSONObject(hadoopConf.get("lod.jsonRels"));
44 51

  
52
        if(entitiesMappings==null||relationsMappings ==null){throw  new InterruptedException("Could not read mappings!");}
45 53

  
46 54
        Iterator<Text> it = values.iterator();
47 55

  
48 56
        while (it.hasNext()) {
57
            context.getCounter(REC_COUNTER.TOTAL).increment(1);
49 58
            String[] split = it.next().toString().split(hadoopConf.get("lod.delim"));
50

  
51 59
            List<String> row = new ArrayList<String>();
52 60
            for (int i = 0; i < split.length; i++) {
53 61
                row.add(split[i]);
62
                System.out.println("Row part is:" + split[i]);
63
                log.info("Row part is:" + split[i]);
54 64
            }
55 65

  
66
    if(row==null||row.isEmpty()){throw  new InterruptedException("Row is empty!");}
67

  
56 68
            if (fileName.startsWith("entities")) RDFizer.RDFizeEntityRow(row, ds, entitiesMappings, hadoopConf);
57 69
            else RDFizer.RDFizeRelationRow(row, ds, relationsMappings, hadoopConf);
58 70

  

Also available in: Unified diff