Project

General

Profile

« Previous | Next » 

Revision 36982

Added by Eri Katsari over 9 years ago

testing collected from using source field from result.metadata

View differences:

modules/dnet-openaire-stats/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/statsExport/utils/FundingParser.java
7 7
public class FundingParser {
8 8
    private String NULL_STRING = "null";
9 9

  
10
    private String ENCLOSED = "#";
11
    private String DELIM = "!";
12
  private Logger log = Logger.getLogger(this.getClass());
10
    private String ENCLOSED ="#";
11
    private String DELIM ="!";
13 12

  
13
    private Logger log = Logger.getLogger(this.getClass());
14

  
14 15
    String getFundingLevel(String funding_level, int level) {
15 16

  
16 17

  
......
30 31
        funding_level = split[1];
31 32

  
32 33
        funding_level = funding_level.substring(0, funding_level.indexOf("</name>"));
33
         log.debug("Funding lvl out" + funding_level);
34
         log.info("Funding lvl out" + funding_level);
34 35

  
35 36
        return ENCLOSED + funding_level + ENCLOSED + DELIM;
36 37
    }
37 38

  
38 39

  
39 40
    public String getFundingInfo(String buff) {
40
log.debug("Funding lvl input" + buff);
41
   log.info("Funding lvl input" + buff);
41 42
        
42
return getFunder(buff) + getFundingLevel(buff, 0)
43
         return getFunder(buff) + getFundingLevel(buff, 0)
43 44
                + (getFundingLevel(buff, 1) + getFundingLevel(buff, 2) + getFundingLevel(buff, 3));
44 45

  
45 46
    }
46 47

  
47 48
    public String getFunder(String buff) {
48 49

  
50
        return  ENCLOSED  + "STARTS HERE" +buff +"ENDS HERE" + ENCLOSED + DELIM;
51

  
49 52
        if (buff.isEmpty()) {
50 53
            return ENCLOSED  + NULL_STRING  + ENCLOSED + DELIM;
51 54

  
......
54 57
        if (!buff.contains("<funder>")) {
55 58
            return ENCLOSED  + NULL_STRING  + ENCLOSED + DELIM;
56 59
        }
60

  
61

  
57 62
        String[] split = buff.split("<funder>");
58 63
        String funder = split[1];
59 64

  
......
62 67
        funder = split[1];
63 68

  
64 69
        funder = funder.substring(0, funder.indexOf("</name>"));
65
        log.debug("Funder" + funder);
70
        log.info("Funder" + funder);
66 71

  
67 72
        return ENCLOSED + funder + ENCLOSED + DELIM;
68 73
    }
modules/dnet-openaire-stats/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/statsExport/utils/Serializer.java
586 586
        if (!fundList.isEmpty()) // `funding_lvl0`,
587 587
        {
588 588
            //TODO funder + 3 funding levels
589
            buff += fundingParser.getFundingInfo(fundList.get(0).getValue());
589

  
590
            buff += this.fundingParser.getFundingInfo(fundList.get(0).getValue());
591

  
590 592
        }
591 593

  
592 594

  
modules/dnet-openaire-stats/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/statsExport/StatsMapper.java
17 17
import org.apache.hadoop.hbase.mapreduce.TableMapper;
18 18
import org.apache.hadoop.hbase.util.Bytes;
19 19
import org.apache.hadoop.io.Text;
20
import org.apache.hadoop.mapreduce.Mapper.Context;
20 21
import org.apache.log4j.Logger;
21
import org.apache.hadoop.mapreduce.Mapper.Context;
22 22

  
23 23
import java.io.ByteArrayInputStream;
24 24
import java.io.IOException;

Also available in: Unified diff