forked from D-Net/dnet-hadoop
Merge branch 'master' of code-repo.d4science.org:D-Net/dnet-hadoop
This commit is contained in:
commit
9d04111391
|
@ -8,9 +8,6 @@ public abstract class Oaf implements Serializable {
|
||||||
|
|
||||||
private Long lastupdatetimestamp;
|
private Long lastupdatetimestamp;
|
||||||
|
|
||||||
|
|
||||||
// protected abstract <T extends Oaf> T fromJson(final String json);
|
|
||||||
|
|
||||||
public DataInfo getDataInfo() {
|
public DataInfo getDataInfo() {
|
||||||
return dataInfo;
|
return dataInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import eu.dnetlib.dhp.schema.oaf.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static eu.dnetlib.dhp.graph.ProtoUtils.mapDataInfo;
|
||||||
import static eu.dnetlib.dhp.graph.ProtoUtils.mapKV;
|
import static eu.dnetlib.dhp.graph.ProtoUtils.mapKV;
|
||||||
|
|
||||||
public class ProtoConverter implements Serializable {
|
public class ProtoConverter implements Serializable {
|
||||||
|
@ -26,17 +27,20 @@ public class ProtoConverter implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Relation convertRelation(OafProtos.Oaf oaf) {
|
private static Relation convertRelation(OafProtos.Oaf oaf) {
|
||||||
final Relation rel = new Relation();
|
|
||||||
final OafProtos.OafRel r = oaf.getRel();
|
final OafProtos.OafRel r = oaf.getRel();
|
||||||
|
final Relation rel = new Relation();
|
||||||
|
rel.setDataInfo(mapDataInfo(oaf.getDataInfo()));
|
||||||
|
rel.setLastupdatetimestamp(oaf.getLastupdatetimestamp());
|
||||||
return rel
|
return rel
|
||||||
.setSource(r.getSource())
|
.setSource(r.getSource())
|
||||||
.setTarget(r.getTarget())
|
.setTarget(r.getTarget())
|
||||||
.setRelType(r.getRelType().toString())
|
.setRelType(r.getRelType().toString())
|
||||||
.setSubRelType(r.getSubRelType().toString())
|
.setSubRelType(r.getSubRelType().toString())
|
||||||
.setRelClass(r.getRelClass())
|
.setRelClass(r.getRelClass())
|
||||||
.setCollectedFrom(r.getCollectedfromList().stream()
|
.setCollectedFrom(r.getCollectedfromCount() > 0 ?
|
||||||
.map(kv -> mapKV(kv))
|
r.getCollectedfromList().stream()
|
||||||
.collect(Collectors.toList()));
|
.map(kv -> mapKV(kv))
|
||||||
|
.collect(Collectors.toList()) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OafEntity convertEntity(OafProtos.Oaf oaf) {
|
private static OafEntity convertEntity(OafProtos.Oaf oaf) {
|
||||||
|
|
|
@ -3,12 +3,7 @@ package eu.dnetlib.dhp.graph;
|
||||||
import com.googlecode.protobuf.format.JsonFormat;
|
import com.googlecode.protobuf.format.JsonFormat;
|
||||||
import eu.dnetlib.data.proto.FieldTypeProtos;
|
import eu.dnetlib.data.proto.FieldTypeProtos;
|
||||||
import eu.dnetlib.data.proto.OafProtos;
|
import eu.dnetlib.data.proto.OafProtos;
|
||||||
import eu.dnetlib.dhp.schema.oaf.DataInfo;
|
import eu.dnetlib.dhp.schema.oaf.*;
|
||||||
import eu.dnetlib.dhp.schema.oaf.KeyValue;
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.Qualifier;
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ProtoUtils {
|
public class ProtoUtils {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue