Index: modules/dnet-mapreduce-jobs/branches/beta/src/main/java/eu/dnetlib/data/mapreduce/hbase/dedup/DedupBuildRootsReducer.java
===================================================================
--- modules/dnet-mapreduce-jobs/branches/beta/src/main/java/eu/dnetlib/data/mapreduce/hbase/dedup/DedupBuildRootsReducer.java	(revision 50269)
+++ modules/dnet-mapreduce-jobs/branches/beta/src/main/java/eu/dnetlib/data/mapreduce/hbase/dedup/DedupBuildRootsReducer.java	(revision 50270)
@@ -12,7 +12,6 @@
 import eu.dnetlib.data.mapreduce.util.OafHbaseUtils;
 import eu.dnetlib.data.mapreduce.util.OafRelDecoder;
 import eu.dnetlib.data.proto.OafProtos.Oaf;
-import eu.dnetlib.data.proto.TypeProtos.Type;
 import eu.dnetlib.data.transform.OafEntityMerger;
 import eu.dnetlib.pace.config.DedupConfig;
 import org.apache.commons.lang.StringUtils;
@@ -63,7 +62,7 @@
 				entities.add(oaf);
 				break;
 			case relation:
-				handleRels(context, rowkey, oaf, true);
+				handleRels(context, rowkey, oaf);
 				break;
 			default:
 				break;
@@ -80,9 +79,6 @@
 
 		emit(context, rowkey, dedupConf.getWf().getEntityType(), DedupUtils.BODY_S, builder.build().toByteArray(), "root");
 
-		// add person rels TODO: remove this hack
-		// context.getCounter("hack", "personResult out").increment(personMap.size());
-
 	}
 
 	private Iterable<Oaf> toOaf(final Iterable<ImmutableBytesWritable> values) {
@@ -89,24 +85,20 @@
 		return Iterables.transform(values, OafHbaseUtils.oafDecoder());
 	}
 
-	private void handleRels(final Context context, final byte[] rowkey, final Oaf oaf, final boolean hack) throws IOException, InterruptedException {
+	private void handleRels(final Context context, final byte[] rowkey, final Oaf oaf) throws IOException, InterruptedException {
 
-		if (hack && checkHack(new String(rowkey), oaf)) {
-			context.getCounter("hack", "personResult in").increment(1);
-		} else {
+		// emit relation from the root to the related entities
+		OafDecoder decoder = rootToEntity(rowkey, oaf);
+		emit(context, rowkey, decoder.getCFQ(), decoder.relTargetId(), decoder.toByteArray(), "[root -> entity]");
 
-			// emit relation from the root to the related entities
-			OafDecoder decoder = rootToEntity(rowkey, oaf);
-			emit(context, rowkey, decoder.getCFQ(), decoder.relTargetId(), decoder.toByteArray(), "[root -> entity]");
+		// emit relation from the related entities to the root
+		decoder = entityToRoot(rowkey, oaf);
+		byte[] revKey = Bytes.toBytes(decoder.relSourceId());
+		emit(context, revKey, decoder.getCFQ(), new String(rowkey), decoder.toByteArray(), "[entity -> root]");
 
-			// emit relation from the related entities to the root
-			decoder = entityToRoot(rowkey, oaf);
-			final byte[] revKey = Bytes.toBytes(decoder.relSourceId());
-			emit(context, revKey, decoder.getCFQ(), new String(rowkey), decoder.toByteArray(), "[entity -> root]");
-		}
 		// mark relation from the related entities to the duplicate as deleted
-		OafDecoder decoder = markDeleted(oaf, true);
-		byte[] revKey = Bytes.toBytes(decoder.relSourceId());
+		decoder = markDeleted(oaf, true);
+		revKey = Bytes.toBytes(decoder.relSourceId());
 		emit(context, revKey, decoder.getCFQ(), decoder.relTargetId(), decoder.toByteArray(), "mark deleted [dup -> entity]");
 
 		// mark relation from the related entities to the duplicate as deleted
@@ -125,30 +117,6 @@
 
 	// /////////////////
 
-	public boolean checkHack(final String root, final Oaf oaf) {
-
-		boolean res;
-		if (dedupConf.getWf().getEntityType().equals(Type.result.toString()) && !md5matches(root, oaf.getRel().getSource())) {
-
-			res = true;
-		} else {
-			res = false;
-		}
-
-		// if (root.equals("50|dedup_wf_001::92f6197ea6f16ae554755aced832fb6f")) {
-		// System.out.println("##################");
-		// System.out.println("root  : " + root);
-		// System.out.println("source: " + oaf.getRel().getSource());
-		// System.out.println("ckeck:  " + res);
-		// }
-
-		return res;
-	}
-
-	private boolean md5matches(final String id1, final String id2) {
-		return id1.replaceAll("^.*\\:\\:", "").equals(id2.replaceAll("^.*\\:\\:", ""));
-	}
-
 	private OafDecoder rootToEntity(final byte[] rootRowkey, final Oaf rel) {
 		return patchRelations(rootRowkey, rel, OafPatch.rootToEntity);
 	}
