Project

General

Profile

« Previous | Next » 

Revision 58129

added counters for exported content (entities and relations)

View differences:

ExportInformationSpaceMapper2DHP.java
10 10
import eu.dnetlib.data.proto.OafProtos;
11 11
import eu.dnetlib.data.proto.TypeProtos;
12 12
import eu.dnetlib.dhp.schema.oaf.Oaf;
13
import eu.dnetlib.dhp.schema.oaf.OafEntity;
13 14
import eu.dnetlib.dhp.schema.oaf.Relation;
14 15
import org.apache.commons.lang.StringUtils;
15 16
import org.apache.hadoop.hbase.client.Result;
......
106 107
			keyOut.set(result.getClass().getName());
107 108
			valueOut.set(objectMapper.writeValueAsString(result));
108 109

  
109
			final String namedOutput = result.getClass().getSimpleName().toLowerCase();
110
			final String type = result.getClass().getSimpleName();
111
			final String namedOutput = type.toLowerCase();
110 112
			multipleOutputs.write(namedOutput, keyOut, valueOut, namedOutput + "/" + namedOutput);
111 113

  
112
			context.getCounter("export", result.getClass().getName()).increment(1);
114
			boolean deleted = result.getDataInfo().getDeletedbyinference();
115
		
116
			if (result instanceof Relation) {
117
				Relation r = (Relation) result;
118
				String reltype = r.getRelType() + "_" + r.getSubRelType() + "_" + r.getRelClass();
119
				context.getCounter("export", String.format("%s deleted:%s", reltype, deleted)).increment(1);
120
			} else if (result instanceof OafEntity) {
121

  
122
				context.getCounter("export", String.format("%s deleted:%s", type, deleted)).increment(1);
123
			}
113 124
		}
125

  
114 126
	}
115 127

  
116 128
}

Also available in: Unified diff