forked from antonis.lempesis/dnet-hadoop
added mapping for projects
This commit is contained in:
parent
5f339a2c24
commit
0d88f9a6a4
|
@ -61,207 +61,233 @@ public class Project extends OafEntity implements Serializable {
|
|||
return websiteurl;
|
||||
}
|
||||
|
||||
public void setWebsiteurl(Field<String> websiteurl) {
|
||||
public Project setWebsiteurl(Field<String> websiteurl) {
|
||||
this.websiteurl = websiteurl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Field<String> code) {
|
||||
public Project setCode(Field<String> code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getAcronym() {
|
||||
return acronym;
|
||||
}
|
||||
|
||||
public void setAcronym(Field<String> acronym) {
|
||||
public Project setAcronym(Field<String> acronym) {
|
||||
this.acronym = acronym;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(Field<String> title) {
|
||||
public Project setTitle(Field<String> title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getStartdate() {
|
||||
return startdate;
|
||||
}
|
||||
|
||||
public void setStartdate(Field<String> startdate) {
|
||||
public Project setStartdate(Field<String> startdate) {
|
||||
this.startdate = startdate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getEnddate() {
|
||||
return enddate;
|
||||
}
|
||||
|
||||
public void setEnddate(Field<String> enddate) {
|
||||
public Project setEnddate(Field<String> enddate) {
|
||||
this.enddate = enddate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getCallidentifier() {
|
||||
return callidentifier;
|
||||
}
|
||||
|
||||
public void setCallidentifier(Field<String> callidentifier) {
|
||||
public Project setCallidentifier(Field<String> callidentifier) {
|
||||
this.callidentifier = callidentifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
public void setKeywords(Field<String> keywords) {
|
||||
public Project setKeywords(Field<String> keywords) {
|
||||
this.keywords = keywords;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Field<String> duration) {
|
||||
public Project setDuration(Field<String> duration) {
|
||||
this.duration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getEcsc39() {
|
||||
return ecsc39;
|
||||
}
|
||||
|
||||
public void setEcsc39(Field<String> ecsc39) {
|
||||
public Project setEcsc39(Field<String> ecsc39) {
|
||||
this.ecsc39 = ecsc39;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getOamandatepublications() {
|
||||
return oamandatepublications;
|
||||
}
|
||||
|
||||
public void setOamandatepublications(Field<String> oamandatepublications) {
|
||||
public Project setOamandatepublications(Field<String> oamandatepublications) {
|
||||
this.oamandatepublications = oamandatepublications;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getEcarticle29_3() {
|
||||
return ecarticle29_3;
|
||||
}
|
||||
|
||||
public void setEcarticle29_3(Field<String> ecarticle29_3) {
|
||||
public Project setEcarticle29_3(Field<String> ecarticle29_3) {
|
||||
this.ecarticle29_3 = ecarticle29_3;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StructuredProperty> getSubjects() {
|
||||
return subjects;
|
||||
}
|
||||
|
||||
public void setSubjects(List<StructuredProperty> subjects) {
|
||||
public Project setSubjects(List<StructuredProperty> subjects) {
|
||||
this.subjects = subjects;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Field<String>> getFundingtree() {
|
||||
return fundingtree;
|
||||
}
|
||||
|
||||
public void setFundingtree(List<Field<String>> fundingtree) {
|
||||
public Project setFundingtree(List<Field<String>> fundingtree) {
|
||||
this.fundingtree = fundingtree;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Qualifier getContracttype() {
|
||||
return contracttype;
|
||||
}
|
||||
|
||||
public void setContracttype(Qualifier contracttype) {
|
||||
public Project setContracttype(Qualifier contracttype) {
|
||||
this.contracttype = contracttype;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getOptional1() {
|
||||
return optional1;
|
||||
}
|
||||
|
||||
public void setOptional1(Field<String> optional1) {
|
||||
public Project setOptional1(Field<String> optional1) {
|
||||
this.optional1 = optional1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getOptional2() {
|
||||
return optional2;
|
||||
}
|
||||
|
||||
public void setOptional2(Field<String> optional2) {
|
||||
public Project setOptional2(Field<String> optional2) {
|
||||
this.optional2 = optional2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getJsonextrainfo() {
|
||||
return jsonextrainfo;
|
||||
}
|
||||
|
||||
public void setJsonextrainfo(Field<String> jsonextrainfo) {
|
||||
public Project setJsonextrainfo(Field<String> jsonextrainfo) {
|
||||
this.jsonextrainfo = jsonextrainfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getContactfullname() {
|
||||
return contactfullname;
|
||||
}
|
||||
|
||||
public void setContactfullname(Field<String> contactfullname) {
|
||||
public Project setContactfullname(Field<String> contactfullname) {
|
||||
this.contactfullname = contactfullname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getContactfax() {
|
||||
return contactfax;
|
||||
}
|
||||
|
||||
public void setContactfax(Field<String> contactfax) {
|
||||
public Project setContactfax(Field<String> contactfax) {
|
||||
this.contactfax = contactfax;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getContactphone() {
|
||||
return contactphone;
|
||||
}
|
||||
|
||||
public void setContactphone(Field<String> contactphone) {
|
||||
public Project setContactphone(Field<String> contactphone) {
|
||||
this.contactphone = contactphone;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getContactemail() {
|
||||
return contactemail;
|
||||
}
|
||||
|
||||
public void setContactemail(Field<String> contactemail) {
|
||||
public Project setContactemail(Field<String> contactemail) {
|
||||
this.contactemail = contactemail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(Field<String> summary) {
|
||||
public Project setSummary(Field<String> summary) {
|
||||
this.summary = summary;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Field<String> getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public void setCurrency(Field<String> currency) {
|
||||
public Project setCurrency(Field<String> currency) {
|
||||
this.currency = currency;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Float getTotalcost() {
|
||||
return totalcost;
|
||||
}
|
||||
|
||||
public void setTotalcost(Float totalcost) {
|
||||
public Project setTotalcost(Float totalcost) {
|
||||
this.totalcost = totalcost;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Float getFundedamount() {
|
||||
return fundedamount;
|
||||
}
|
||||
|
||||
public void setFundedamount(Float fundedamount) {
|
||||
public Project setFundedamount(Float fundedamount) {
|
||||
this.fundedamount = fundedamount;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package eu.dnetlib.dhp.graph;
|
|||
|
||||
import eu.dnetlib.data.proto.KindProtos;
|
||||
import eu.dnetlib.data.proto.OafProtos;
|
||||
import eu.dnetlib.data.proto.ProjectProtos;
|
||||
import eu.dnetlib.dhp.schema.oaf.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
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.*;
|
||||
|
||||
public class ProtoConverter implements Serializable {
|
||||
|
||||
|
@ -88,11 +88,48 @@ public class ProtoConverter implements Serializable {
|
|||
}
|
||||
|
||||
private static Project convertProject(OafProtos.Oaf oaf) {
|
||||
return new Project();
|
||||
final ProjectProtos.Project.Metadata m = oaf.getEntity().getProject().getMetadata();
|
||||
final Project project = new Project();
|
||||
project.setDataInfo(mapDataInfo(oaf.getDataInfo()));
|
||||
project.setLastupdatetimestamp(oaf.getLastupdatetimestamp());
|
||||
return project
|
||||
.setAcronym(mapStringField(m.getAcronym()))
|
||||
.setCallidentifier(mapStringField(m.getCallidentifier()))
|
||||
.setCode(mapStringField(m.getCode()))
|
||||
.setContactemail(mapStringField(m.getContactemail()))
|
||||
.setContactfax(mapStringField(m.getContactfax()))
|
||||
.setContactfullname(mapStringField(m.getContactfullname()))
|
||||
.setContactphone(mapStringField(m.getContactphone()))
|
||||
.setContracttype(mapQualifier(m.getContracttype()))
|
||||
.setCurrency(mapStringField(m.getCurrency()))
|
||||
.setDuration(mapStringField(m.getDuration()))
|
||||
.setEcarticle29_3(mapStringField(m.getEcarticle293()))
|
||||
.setEcsc39(mapStringField(m.getEcsc39()))
|
||||
.setOamandatepublications(mapStringField(m.getOamandatepublications()))
|
||||
.setStartdate(mapStringField(m.getStartdate()))
|
||||
.setEnddate(mapStringField(m.getEnddate()))
|
||||
.setFundedamount(m.getFundedamount())
|
||||
.setTotalcost(m.getTotalcost())
|
||||
.setKeywords(mapStringField(m.getKeywords()))
|
||||
.setSubjects(m.getSubjectsCount() > 0 ?
|
||||
m.getSubjectsList().stream()
|
||||
.map(sp -> mapStructuredProperty(sp))
|
||||
.collect(Collectors.toList()) : null)
|
||||
.setTitle(mapStringField(m.getTitle()))
|
||||
.setWebsiteurl(mapStringField(m.getWebsiteurl()))
|
||||
.setFundingtree(m.getFundingtreeCount() > 0 ?
|
||||
m.getFundingtreeList().stream()
|
||||
.map(f -> mapStringField(f))
|
||||
.collect(Collectors.toList()) : null)
|
||||
.setJsonextrainfo(mapStringField(m.getJsonextrainfo()))
|
||||
.setSummary(mapStringField(m.getSummary()))
|
||||
.setOptional1(mapStringField(m.getOptional1()))
|
||||
.setOptional2(mapStringField(m.getOptional2()));
|
||||
}
|
||||
|
||||
private static Result convertResult(OafProtos.Oaf oaf) {
|
||||
switch (oaf.getEntity().getResult().getMetadata().getResulttype().getClassid()) {
|
||||
|
||||
case "dataset":
|
||||
return createDataset(oaf);
|
||||
case "publication":
|
||||
|
|
Loading…
Reference in New Issue