remove a bit of syntactic sugar on the object inheritance :(

This commit is contained in:
Sandro La Bruzzo 2019-10-25 18:10:30 +02:00
parent c74335ebc7
commit 9ee4e5a196
30 changed files with 572 additions and 784 deletions

View File

@ -21,53 +21,47 @@ public class Author implements Serializable {
return fullname;
}
public Author setFullname(String fullname) {
public void setFullname(String fullname) {
this.fullname = fullname;
return this;
}
public String getName() {
return name;
}
public Author setName(String name) {
public void setName(String name) {
this.name = name;
return this;
}
public String getSurname() {
return surname;
}
public Author setSurname(String surname) {
public void setSurname(String surname) {
this.surname = surname;
return this;
}
public Integer getRank() {
return rank;
}
public Author setRank(Integer rank) {
public void setRank(Integer rank) {
this.rank = rank;
return this;
}
public List<KeyValue> getPid() {
return pid;
}
public Author setPid(List<KeyValue> pid) {
public void setPid(List<KeyValue> pid) {
this.pid = pid;
return this;
}
public List<Field<String>> getAffiliation() {
return affiliation;
}
public Author setAffiliation(List<Field<String>> affiliation) {
public void setAffiliation(List<Field<String>> affiliation) {
this.affiliation = affiliation;
return this;
}
}

View File

@ -12,17 +12,15 @@ public class Context implements Serializable {
return id;
}
public Context setId(String id) {
public void setId(String id) {
this.id = id;
return this;
}
public List<DataInfo> getDataInfo() {
return dataInfo;
}
public Context setDataInfo(List<DataInfo> dataInfo) {
public void setDataInfo(List<DataInfo> dataInfo) {
this.dataInfo = dataInfo;
return this;
}
}

View File

@ -17,53 +17,47 @@ public class DataInfo implements Serializable {
return invisible;
}
public DataInfo setInvisible(Boolean invisible) {
public void setInvisible(Boolean invisible) {
this.invisible = invisible;
return this;
}
public Boolean getInferred() {
return inferred;
}
public DataInfo setInferred(Boolean inferred) {
public void setInferred(Boolean inferred) {
this.inferred = inferred;
return this;
}
public Boolean getDeletedbyinference() {
return deletedbyinference;
}
public DataInfo setDeletedbyinference(Boolean deletedbyinference) {
public void setDeletedbyinference(Boolean deletedbyinference) {
this.deletedbyinference = deletedbyinference;
return this;
}
public String getTrust() {
return trust;
}
public DataInfo setTrust(String trust) {
public void setTrust(String trust) {
this.trust = trust;
return this;
}
public String getInferenceprovenance() {
return inferenceprovenance;
}
public DataInfo setInferenceprovenance(String inferenceprovenance) {
public void setInferenceprovenance(String inferenceprovenance) {
this.inferenceprovenance = inferenceprovenance;
return this;
}
public Qualifier getProvenanceaction() {
return provenanceaction;
}
public DataInfo setProvenanceaction(Qualifier provenanceaction) {
public void setProvenanceaction(Qualifier provenanceaction) {
this.provenanceaction = provenanceaction;
return this;
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class Dataset extends Result<Dataset> implements Serializable {
public class Dataset extends Result implements Serializable {
private Field<String> storagedate;
@ -23,67 +23,55 @@ public class Dataset extends Result<Dataset> implements Serializable {
return storagedate;
}
public Dataset setStoragedate(Field<String> storagedate) {
public void setStoragedate(Field<String> storagedate) {
this.storagedate = storagedate;
return this;
}
public Field<String> getDevice() {
return device;
}
public Dataset setDevice(Field<String> device) {
public void setDevice(Field<String> device) {
this.device = device;
return this;
}
public Field<String> getSize() {
return size;
}
public Dataset setSize(Field<String> size) {
public void setSize(Field<String> size) {
this.size = size;
return this;
}
public Field<String> getVersion() {
return version;
}
public Dataset setVersion(Field<String> version) {
public void setVersion(Field<String> version) {
this.version = version;
return this;
}
public Field<String> getLastmetadataupdate() {
return lastmetadataupdate;
}
public Dataset setLastmetadataupdate(Field<String> lastmetadataupdate) {
public void setLastmetadataupdate(Field<String> lastmetadataupdate) {
this.lastmetadataupdate = lastmetadataupdate;
return this;
}
public Field<String> getMetadataversionnumber() {
return metadataversionnumber;
}
public Dataset setMetadataversionnumber(Field<String> metadataversionnumber) {
public void setMetadataversionnumber(Field<String> metadataversionnumber) {
this.metadataversionnumber = metadataversionnumber;
return this;
}
public List<GeoLocation> getGeolocation() {
return geolocation;
}
public Dataset setGeolocation(List<GeoLocation> geolocation) {
public void setGeolocation(List<GeoLocation> geolocation) {
this.geolocation = geolocation;
return this;
}
@Override
protected Dataset self() {
return this;
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class Datasource extends OafEntity<Datasource> implements Serializable {
public class Datasource extends OafEntity implements Serializable {
private Qualifier datasourcetype;
@ -86,319 +86,279 @@ public class Datasource extends OafEntity<Datasource> implements Serializable {
return datasourcetype;
}
public Datasource setDatasourcetype(Qualifier datasourcetype) {
public void setDatasourcetype(Qualifier datasourcetype) {
this.datasourcetype = datasourcetype;
return this;
}
public Qualifier getOpenairecompatibility() {
return openairecompatibility;
}
public Datasource setOpenairecompatibility(Qualifier openairecompatibility) {
public void setOpenairecompatibility(Qualifier openairecompatibility) {
this.openairecompatibility = openairecompatibility;
return this;
}
public Field<String> getOfficialname() {
return officialname;
}
public Datasource setOfficialname(Field<String> officialname) {
public void setOfficialname(Field<String> officialname) {
this.officialname = officialname;
return this;
}
public Field<String> getEnglishname() {
return englishname;
}
public Datasource setEnglishname(Field<String> englishname) {
public void setEnglishname(Field<String> englishname) {
this.englishname = englishname;
return this;
}
public Field<String> getWebsiteurl() {
return websiteurl;
}
public Datasource setWebsiteurl(Field<String> websiteurl) {
public void setWebsiteurl(Field<String> websiteurl) {
this.websiteurl = websiteurl;
return this;
}
public Field<String> getLogourl() {
return logourl;
}
public Datasource setLogourl(Field<String> logourl) {
public void setLogourl(Field<String> logourl) {
this.logourl = logourl;
return this;
}
public Field<String> getContactemail() {
return contactemail;
}
public Datasource setContactemail(Field<String> contactemail) {
public void setContactemail(Field<String> contactemail) {
this.contactemail = contactemail;
return this;
}
public Field<String> getNamespaceprefix() {
return namespaceprefix;
}
public Datasource setNamespaceprefix(Field<String> namespaceprefix) {
public void setNamespaceprefix(Field<String> namespaceprefix) {
this.namespaceprefix = namespaceprefix;
return this;
}
public Field<String> getLatitude() {
return latitude;
}
public Datasource setLatitude(Field<String> latitude) {
public void setLatitude(Field<String> latitude) {
this.latitude = latitude;
return this;
}
public Field<String> getLongitude() {
return longitude;
}
public Datasource setLongitude(Field<String> longitude) {
public void setLongitude(Field<String> longitude) {
this.longitude = longitude;
return this;
}
public Field<String> getDateofvalidation() {
return dateofvalidation;
}
public Datasource setDateofvalidation(Field<String> dateofvalidation) {
public void setDateofvalidation(Field<String> dateofvalidation) {
this.dateofvalidation = dateofvalidation;
return this;
}
public Field<String> getDescription() {
return description;
}
public Datasource setDescription(Field<String> description) {
public void setDescription(Field<String> description) {
this.description = description;
return this;
}
public List<StructuredProperty> getSubjects() {
return subjects;
}
public Datasource setSubjects(List<StructuredProperty> subjects) {
public void setSubjects(List<StructuredProperty> subjects) {
this.subjects = subjects;
return this;
}
public Field<String> getOdnumberofitems() {
return odnumberofitems;
}
public Datasource setOdnumberofitems(Field<String> odnumberofitems) {
public void setOdnumberofitems(Field<String> odnumberofitems) {
this.odnumberofitems = odnumberofitems;
return this;
}
public Field<String> getOdnumberofitemsdate() {
return odnumberofitemsdate;
}
public Datasource setOdnumberofitemsdate(Field<String> odnumberofitemsdate) {
public void setOdnumberofitemsdate(Field<String> odnumberofitemsdate) {
this.odnumberofitemsdate = odnumberofitemsdate;
return this;
}
public Field<String> getOdpolicies() {
return odpolicies;
}
public Datasource setOdpolicies(Field<String> odpolicies) {
public void setOdpolicies(Field<String> odpolicies) {
this.odpolicies = odpolicies;
return this;
}
public List<Field<String>> getOdlanguages() {
return odlanguages;
}
public Datasource setOdlanguages(List<Field<String>> odlanguages) {
public void setOdlanguages(List<Field<String>> odlanguages) {
this.odlanguages = odlanguages;
return this;
}
public List<Field<String>> getOdcontenttypes() {
return odcontenttypes;
}
public Datasource setOdcontenttypes(List<Field<String>> odcontenttypes) {
public void setOdcontenttypes(List<Field<String>> odcontenttypes) {
this.odcontenttypes = odcontenttypes;
return this;
}
public List<Field<String>> getAccessinfopackage() {
return accessinfopackage;
}
public Datasource setAccessinfopackage(List<Field<String>> accessinfopackage) {
public void setAccessinfopackage(List<Field<String>> accessinfopackage) {
this.accessinfopackage = accessinfopackage;
return this;
}
public Field<String> getReleasestartdate() {
return releasestartdate;
}
public Datasource setReleasestartdate(Field<String> releasestartdate) {
public void setReleasestartdate(Field<String> releasestartdate) {
this.releasestartdate = releasestartdate;
return this;
}
public Field<String> getReleaseenddate() {
return releaseenddate;
}
public Datasource setReleaseenddate(Field<String> releaseenddate) {
public void setReleaseenddate(Field<String> releaseenddate) {
this.releaseenddate = releaseenddate;
return this;
}
public Field<String> getMissionstatementurl() {
return missionstatementurl;
}
public Datasource setMissionstatementurl(Field<String> missionstatementurl) {
public void setMissionstatementurl(Field<String> missionstatementurl) {
this.missionstatementurl = missionstatementurl;
return this;
}
public Field<Boolean> getDataprovider() {
return dataprovider;
}
public Datasource setDataprovider(Field<Boolean> dataprovider) {
public void setDataprovider(Field<Boolean> dataprovider) {
this.dataprovider = dataprovider;
return this;
}
public Field<Boolean> getServiceprovider() {
return serviceprovider;
}
public Datasource setServiceprovider(Field<Boolean> serviceprovider) {
public void setServiceprovider(Field<Boolean> serviceprovider) {
this.serviceprovider = serviceprovider;
return this;
}
public Field<String> getDatabaseaccesstype() {
return databaseaccesstype;
}
public Datasource setDatabaseaccesstype(Field<String> databaseaccesstype) {
public void setDatabaseaccesstype(Field<String> databaseaccesstype) {
this.databaseaccesstype = databaseaccesstype;
return this;
}
public Field<String> getDatauploadtype() {
return datauploadtype;
}
public Datasource setDatauploadtype(Field<String> datauploadtype) {
public void setDatauploadtype(Field<String> datauploadtype) {
this.datauploadtype = datauploadtype;
return this;
}
public Field<String> getDatabaseaccessrestriction() {
return databaseaccessrestriction;
}
public Datasource setDatabaseaccessrestriction(Field<String> databaseaccessrestriction) {
public void setDatabaseaccessrestriction(Field<String> databaseaccessrestriction) {
this.databaseaccessrestriction = databaseaccessrestriction;
return this;
}
public Field<String> getDatauploadrestriction() {
return datauploadrestriction;
}
public Datasource setDatauploadrestriction(Field<String> datauploadrestriction) {
public void setDatauploadrestriction(Field<String> datauploadrestriction) {
this.datauploadrestriction = datauploadrestriction;
return this;
}
public Field<Boolean> getVersioning() {
return versioning;
}
public Datasource setVersioning(Field<Boolean> versioning) {
public void setVersioning(Field<Boolean> versioning) {
this.versioning = versioning;
return this;
}
public Field<String> getCitationguidelineurl() {
return citationguidelineurl;
}
public Datasource setCitationguidelineurl(Field<String> citationguidelineurl) {
public void setCitationguidelineurl(Field<String> citationguidelineurl) {
this.citationguidelineurl = citationguidelineurl;
return this;
}
public Field<String> getQualitymanagementkind() {
return qualitymanagementkind;
}
public Datasource setQualitymanagementkind(Field<String> qualitymanagementkind) {
public void setQualitymanagementkind(Field<String> qualitymanagementkind) {
this.qualitymanagementkind = qualitymanagementkind;
return this;
}
public Field<String> getPidsystems() {
return pidsystems;
}
public Datasource setPidsystems(Field<String> pidsystems) {
public void setPidsystems(Field<String> pidsystems) {
this.pidsystems = pidsystems;
return this;
}
public Field<String> getCertificates() {
return certificates;
}
public Datasource setCertificates(Field<String> certificates) {
public void setCertificates(Field<String> certificates) {
this.certificates = certificates;
return this;
}
public List<KeyValue> getPolicies() {
return policies;
}
public Datasource setPolicies(List<KeyValue> policies) {
public void setPolicies(List<KeyValue> policies) {
this.policies = policies;
return this;
}
public Journal getJournal() {
return journal;
}
public Datasource setJournal(Journal journal) {
public void setJournal(Journal journal) {
this.journal = journal;
return this;
}
@Override
protected Datasource self() {
return this;
}
}

View File

@ -31,71 +31,63 @@ public class ExternalReference implements Serializable {
return sitename;
}
public ExternalReference setSitename(String sitename) {
public void setSitename(String sitename) {
this.sitename = sitename;
return this;
}
public String getLabel() {
return label;
}
public ExternalReference setLabel(String label) {
public void setLabel(String label) {
this.label = label;
return this;
}
public String getUrl() {
return url;
}
public ExternalReference setUrl(String url) {
public void setUrl(String url) {
this.url = url;
return this;
}
public String getDescription() {
return description;
}
public ExternalReference setDescription(String description) {
public void setDescription(String description) {
this.description = description;
return this;
}
public Qualifier getQualifier() {
return qualifier;
}
public ExternalReference setQualifier(Qualifier qualifier) {
public void setQualifier(Qualifier qualifier) {
this.qualifier = qualifier;
return this;
}
public String getRefidentifier() {
return refidentifier;
}
public ExternalReference setRefidentifier(String refidentifier) {
public void setRefidentifier(String refidentifier) {
this.refidentifier = refidentifier;
return this;
}
public String getQuery() {
return query;
}
public ExternalReference setQuery(String query) {
public void setQuery(String query) {
this.query = query;
return this;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public ExternalReference setDataInfo(DataInfo dataInfo) {
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return this;
}
}

View File

@ -18,44 +18,39 @@ public class ExtraInfo implements Serializable {
return name;
}
public ExtraInfo setName(String name) {
public void setName(String name) {
this.name = name;
return this;
}
public String getTypology() {
return typology;
}
public ExtraInfo setTypology(String typology) {
public void setTypology(String typology) {
this.typology = typology;
return this;
}
public String getProvenance() {
return provenance;
}
public ExtraInfo setProvenance(String provenance) {
public void setProvenance(String provenance) {
this.provenance = provenance;
return this;
}
public String getTrust() {
return trust;
}
public ExtraInfo setTrust(String trust) {
public void setTrust(String trust) {
this.trust = trust;
return this;
}
public String getValue() {
return value;
}
public ExtraInfo setValue(String value) {
public void setValue(String value) {
this.value = value;
return this;
}
}

View File

@ -12,17 +12,15 @@ public class Field<T> implements Serializable {
return value;
}
public Field<T> setValue(T value) {
public void setValue(T value) {
this.value = value;
return this;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public Field<T> setDataInfo(DataInfo dataInfo) {
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return this;
}
}

View File

@ -14,26 +14,23 @@ public class GeoLocation implements Serializable {
return point;
}
public GeoLocation setPoint(String point) {
public void setPoint(String point) {
this.point = point;
return this;
}
public String getBox() {
return box;
}
public GeoLocation setBox(String box) {
public void setBox(String box) {
this.box = box;
return this;
}
public String getPlace() {
return place;
}
public GeoLocation setPlace(String place) {
public void setPlace(String place) {
this.place = place;
return this;
}
}

View File

@ -25,71 +25,63 @@ public class Instance implements Serializable {
return license;
}
public Instance setLicense(Field<String> license) {
public void setLicense(Field<String> license) {
this.license = license;
return this;
}
public Qualifier getAccessright() {
return accessright;
}
public Instance setAccessright(Qualifier accessright) {
public void setAccessright(Qualifier accessright) {
this.accessright = accessright;
return this;
}
public Qualifier getInstancetype() {
return instancetype;
}
public Instance setInstancetype(Qualifier instancetype) {
public void setInstancetype(Qualifier instancetype) {
this.instancetype = instancetype;
return this;
}
public KeyValue getHostedby() {
return hostedby;
}
public Instance setHostedby(KeyValue hostedby) {
public void setHostedby(KeyValue hostedby) {
this.hostedby = hostedby;
return this;
}
public String getUrl() {
return url;
}
public Instance setUrl(String url) {
public void setUrl(String url) {
this.url = url;
return this;
}
public String getDistributionlocation() {
return distributionlocation;
}
public Instance setDistributionlocation(String distributionlocation) {
public void setDistributionlocation(String distributionlocation) {
this.distributionlocation = distributionlocation;
return this;
}
public KeyValue getCollectedfrom() {
return collectedfrom;
}
public Instance setCollectedfrom(KeyValue collectedfrom) {
public void setCollectedfrom(KeyValue collectedfrom) {
this.collectedfrom = collectedfrom;
return this;
}
public Field<String> getDateofacceptance() {
return dateofacceptance;
}
public Instance setDateofacceptance(Field<String> dateofacceptance) {
public void setDateofacceptance(Field<String> dateofacceptance) {
this.dateofacceptance = dateofacceptance;
return this;
}
}

View File

@ -32,107 +32,95 @@ public class Journal implements Serializable {
return name;
}
public Journal setName(String name) {
public void setName(String name) {
this.name = name;
return this;
}
public String getIssnPrinted() {
return issnPrinted;
}
public Journal setIssnPrinted(String issnPrinted) {
public void setIssnPrinted(String issnPrinted) {
this.issnPrinted = issnPrinted;
return this;
}
public String getIssnOnline() {
return issnOnline;
}
public Journal setIssnOnline(String issnOnline) {
public void setIssnOnline(String issnOnline) {
this.issnOnline = issnOnline;
return this;
}
public String getIssnLinking() {
return issnLinking;
}
public Journal setIssnLinking(String issnLinking) {
public void setIssnLinking(String issnLinking) {
this.issnLinking = issnLinking;
return this;
}
public String getEp() {
return ep;
}
public Journal setEp(String ep) {
public void setEp(String ep) {
this.ep = ep;
return this;
}
public String getIss() {
return iss;
}
public Journal setIss(String iss) {
public void setIss(String iss) {
this.iss = iss;
return this;
}
public String getSp() {
return sp;
}
public Journal setSp(String sp) {
public void setSp(String sp) {
this.sp = sp;
return this;
}
public String getVol() {
return vol;
}
public Journal setVol(String vol) {
public void setVol(String vol) {
this.vol = vol;
return this;
}
public String getEdition() {
return edition;
}
public Journal setEdition(String edition) {
public void setEdition(String edition) {
this.edition = edition;
return this;
}
public String getConferenceplace() {
return conferenceplace;
}
public Journal setConferenceplace(String conferenceplace) {
public void setConferenceplace(String conferenceplace) {
this.conferenceplace = conferenceplace;
return this;
}
public String getConferencedate() {
return conferencedate;
}
public Journal setConferencedate(String conferencedate) {
public void setConferencedate(String conferencedate) {
this.conferencedate = conferencedate;
return this;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public Journal setDataInfo(DataInfo dataInfo) {
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return this;
}
}

View File

@ -14,26 +14,23 @@ public class KeyValue implements Serializable {
return key;
}
public KeyValue setKey(String key) {
public void setKey(String key) {
this.key = key;
return this;
}
public String getValue() {
return value;
}
public KeyValue setValue(String value) {
public void setValue(String value) {
this.value = value;
return this;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public KeyValue setDataInfo(DataInfo dataInfo) {
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return this;
}
}

View File

@ -10,8 +10,7 @@ public class OAIProvenance implements Serializable {
return originDescription;
}
public OAIProvenance setOriginDescription(OriginDescription originDescription) {
public void setOriginDescription(OriginDescription originDescription) {
this.originDescription = originDescription;
return this;
}
}

View File

@ -2,29 +2,25 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
public abstract class Oaf<T extends Oaf<T>> implements Serializable {
public abstract class Oaf implements Serializable {
private DataInfo dataInfo;
private Long lastupdatetimestamp;
protected abstract T self();
public DataInfo getDataInfo() {
return dataInfo;
}
public T setDataInfo(DataInfo dataInfo) {
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return self();
}
public Long getLastupdatetimestamp() {
return lastupdatetimestamp;
}
public T setLastupdatetimestamp(Long lastupdatetimestamp) {
public void setLastupdatetimestamp(Long lastupdatetimestamp) {
this.lastupdatetimestamp = lastupdatetimestamp;
return self();
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public abstract class OafEntity<T extends OafEntity<T>> extends Oaf<T> implements Serializable {
public abstract class OafEntity extends Oaf implements Serializable {
private String id;
@ -25,71 +25,63 @@ public abstract class OafEntity<T extends OafEntity<T>> extends Oaf<T> implement
return id;
}
public T setId(String id) {
public void setId(String id) {
this.id = id;
return self();
}
public List<String> getOriginalId() {
return originalId;
}
public T setOriginalId(List<String> originalId) {
public void setOriginalId(List<String> originalId) {
this.originalId = originalId;
return self();
}
public List<KeyValue> getCollectedfrom() {
return collectedfrom;
}
public T setCollectedfrom(List<KeyValue> collectedfrom) {
public void setCollectedfrom(List<KeyValue> collectedfrom) {
this.collectedfrom = collectedfrom;
return self();
}
public List<StructuredProperty> getPid() {
return pid;
}
public T setPid(List<StructuredProperty> pid) {
public void setPid(List<StructuredProperty> pid) {
this.pid = pid;
return self();
}
public String getDateofcollection() {
return dateofcollection;
}
public T setDateofcollection(String dateofcollection) {
public void setDateofcollection(String dateofcollection) {
this.dateofcollection = dateofcollection;
return self();
}
public String getDateoftransformation() {
return dateoftransformation;
}
public T setDateoftransformation(String dateoftransformation) {
public void setDateoftransformation(String dateoftransformation) {
this.dateoftransformation = dateoftransformation;
return self();
}
public List<ExtraInfo> getExtraInfo() {
return extraInfo;
}
public T setExtraInfo(List<ExtraInfo> extraInfo) {
public void setExtraInfo(List<ExtraInfo> extraInfo) {
this.extraInfo = extraInfo;
return self();
}
public OAIProvenance getOaiprovenance() {
return oaiprovenance;
}
public T setOaiprovenance(OAIProvenance oaiprovenance) {
public void setOaiprovenance(OAIProvenance oaiprovenance) {
this.oaiprovenance = oaiprovenance;
return self();
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class Organization extends OafEntity<Organization> implements Serializable {
public class Organization extends OafEntity implements Serializable {
private Field<String> legalshortname;
@ -41,148 +41,127 @@ public class Organization extends OafEntity<Organization> implements Serializabl
return legalshortname;
}
public Organization setLegalshortname(Field<String> legalshortname) {
public void setLegalshortname(Field<String> legalshortname) {
this.legalshortname = legalshortname;
return this;
}
public Field<String> getLegalname() {
return legalname;
}
public Organization setLegalname(Field<String> legalname) {
public void setLegalname(Field<String> legalname) {
this.legalname = legalname;
return this;
}
public List<Field<String>> getAlternativeNames() {
return alternativeNames;
}
public Organization setAlternativeNames(List<Field<String>> alternativeNames) {
public void setAlternativeNames(List<Field<String>> alternativeNames) {
this.alternativeNames = alternativeNames;
return this;
}
public Field<String> getWebsiteurl() {
return websiteurl;
}
public Organization setWebsiteurl(Field<String> websiteurl) {
public void setWebsiteurl(Field<String> websiteurl) {
this.websiteurl = websiteurl;
return this;
}
public Field<String> getLogourl() {
return logourl;
}
public Organization setLogourl(Field<String> logourl) {
public void setLogourl(Field<String> logourl) {
this.logourl = logourl;
return this;
}
public Field<String> getEclegalbody() {
return eclegalbody;
}
public Organization setEclegalbody(Field<String> eclegalbody) {
public void setEclegalbody(Field<String> eclegalbody) {
this.eclegalbody = eclegalbody;
return this;
}
public Field<String> getEclegalperson() {
return eclegalperson;
}
public Organization setEclegalperson(Field<String> eclegalperson) {
public void setEclegalperson(Field<String> eclegalperson) {
this.eclegalperson = eclegalperson;
return this;
}
public Field<String> getEcnonprofit() {
return ecnonprofit;
}
public Organization setEcnonprofit(Field<String> ecnonprofit) {
public void setEcnonprofit(Field<String> ecnonprofit) {
this.ecnonprofit = ecnonprofit;
return this;
}
public Field<String> getEcresearchorganization() {
return ecresearchorganization;
}
public Organization setEcresearchorganization(Field<String> ecresearchorganization) {
public void setEcresearchorganization(Field<String> ecresearchorganization) {
this.ecresearchorganization = ecresearchorganization;
return this;
}
public Field<String> getEchighereducation() {
return echighereducation;
}
public Organization setEchighereducation(Field<String> echighereducation) {
public void setEchighereducation(Field<String> echighereducation) {
this.echighereducation = echighereducation;
return this;
}
public Field<String> getEcinternationalorganizationeurinterests() {
return ecinternationalorganizationeurinterests;
}
public Organization setEcinternationalorganizationeurinterests(Field<String> ecinternationalorganizationeurinterests) {
public void setEcinternationalorganizationeurinterests(Field<String> ecinternationalorganizationeurinterests) {
this.ecinternationalorganizationeurinterests = ecinternationalorganizationeurinterests;
return this;
}
public Field<String> getEcinternationalorganization() {
return ecinternationalorganization;
}
public Organization setEcinternationalorganization(Field<String> ecinternationalorganization) {
public void setEcinternationalorganization(Field<String> ecinternationalorganization) {
this.ecinternationalorganization = ecinternationalorganization;
return this;
}
public Field<String> getEcenterprise() {
return ecenterprise;
}
public Organization setEcenterprise(Field<String> ecenterprise) {
public void setEcenterprise(Field<String> ecenterprise) {
this.ecenterprise = ecenterprise;
return this;
}
public Field<String> getEcsmevalidated() {
return ecsmevalidated;
}
public Organization setEcsmevalidated(Field<String> ecsmevalidated) {
public void setEcsmevalidated(Field<String> ecsmevalidated) {
this.ecsmevalidated = ecsmevalidated;
return this;
}
public Field<String> getEcnutscode() {
return ecnutscode;
}
public Organization setEcnutscode(Field<String> ecnutscode) {
public void setEcnutscode(Field<String> ecnutscode) {
this.ecnutscode = ecnutscode;
return this;
}
public Qualifier getCountry() {
return country;
}
public Organization setCountry(Qualifier country) {
public void setCountry(Qualifier country) {
this.country = country;
return this;
}
@Override
protected Organization self() {
return this;
}
}

View File

@ -20,54 +20,47 @@ public class OriginDescription implements Serializable {
return harvestDate;
}
public OriginDescription setHarvestDate(String harvestDate) {
public void setHarvestDate(String harvestDate) {
this.harvestDate = harvestDate;
return this;
}
public Boolean getAltered() {
return altered;
}
public OriginDescription setAltered(Boolean altered) {
public void setAltered(Boolean altered) {
this.altered = altered;
return this;
}
public String getBaseURL() {
return baseURL;
}
public OriginDescription setBaseURL(String baseURL) {
public void setBaseURL(String baseURL) {
this.baseURL = baseURL;
return this;
}
public String getIdentifier() {
return identifier;
}
public OriginDescription setIdentifier(String identifier) {
public void setIdentifier(String identifier) {
this.identifier = identifier;
return this;
}
public String getDatestamp() {
return datestamp;
}
public OriginDescription setDatestamp(String datestamp) {
public void setDatestamp(String datestamp) {
this.datestamp = datestamp;
return this;
}
public String getMetadataNamespace() {
return metadataNamespace;
}
public OriginDescription setMetadataNamespace(String metadataNamespace) {
public void setMetadataNamespace(String metadataNamespace) {
this.metadataNamespace = metadataNamespace;
return this;
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class OtherResearchProducts extends Result<OtherResearchProducts> implements Serializable {
public class OtherResearchProducts extends Result implements Serializable {
private List<Field<String>> contactperson;
@ -15,31 +15,23 @@ public class OtherResearchProducts extends Result<OtherResearchProducts> impleme
return contactperson;
}
public OtherResearchProducts setContactperson(List<Field<String>> contactperson) {
public void setContactperson(List<Field<String>> contactperson) {
this.contactperson = contactperson;
return this;
}
public List<Field<String>> getContactgroup() {
return contactgroup;
}
public OtherResearchProducts setContactgroup(List<Field<String>> contactgroup) {
public void setContactgroup(List<Field<String>> contactgroup) {
this.contactgroup = contactgroup;
return this;
}
public List<Field<String>> getTool() {
return tool;
}
public OtherResearchProducts setTool(List<Field<String>> tool) {
public void setTool(List<Field<String>> tool) {
this.tool = tool;
return this;
}
@Override
protected OtherResearchProducts self() {
return this;
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class Project extends OafEntity<Project> implements Serializable {
public class Project extends OafEntity implements Serializable {
private Field<String> websiteurl;
@ -61,238 +61,207 @@ public class Project extends OafEntity<Project> implements Serializable {
return websiteurl;
}
public Project setWebsiteurl(Field<String> websiteurl) {
public void setWebsiteurl(Field<String> websiteurl) {
this.websiteurl = websiteurl;
return this;
}
public Field<String> getCode() {
return code;
}
public Project setCode(Field<String> code) {
public void setCode(Field<String> code) {
this.code = code;
return this;
}
public Field<String> getAcronym() {
return acronym;
}
public Project setAcronym(Field<String> acronym) {
public void setAcronym(Field<String> acronym) {
this.acronym = acronym;
return this;
}
public Field<String> getTitle() {
return title;
}
public Project setTitle(Field<String> title) {
public void setTitle(Field<String> title) {
this.title = title;
return this;
}
public Field<String> getStartdate() {
return startdate;
}
public Project setStartdate(Field<String> startdate) {
public void setStartdate(Field<String> startdate) {
this.startdate = startdate;
return this;
}
public Field<String> getEnddate() {
return enddate;
}
public Project setEnddate(Field<String> enddate) {
public void setEnddate(Field<String> enddate) {
this.enddate = enddate;
return this;
}
public Field<String> getCallidentifier() {
return callidentifier;
}
public Project setCallidentifier(Field<String> callidentifier) {
public void setCallidentifier(Field<String> callidentifier) {
this.callidentifier = callidentifier;
return this;
}
public Field<String> getKeywords() {
return keywords;
}
public Project setKeywords(Field<String> keywords) {
public void setKeywords(Field<String> keywords) {
this.keywords = keywords;
return this;
}
public Field<String> getDuration() {
return duration;
}
public Project setDuration(Field<String> duration) {
public void setDuration(Field<String> duration) {
this.duration = duration;
return this;
}
public Field<String> getEcsc39() {
return ecsc39;
}
public Project setEcsc39(Field<String> ecsc39) {
public void setEcsc39(Field<String> ecsc39) {
this.ecsc39 = ecsc39;
return this;
}
public Field<String> getOamandatepublications() {
return oamandatepublications;
}
public Project setOamandatepublications(Field<String> oamandatepublications) {
public void setOamandatepublications(Field<String> oamandatepublications) {
this.oamandatepublications = oamandatepublications;
return this;
}
public Field<String> getEcarticle29_3() {
return ecarticle29_3;
}
public Project setEcarticle29_3(Field<String> ecarticle29_3) {
public void setEcarticle29_3(Field<String> ecarticle29_3) {
this.ecarticle29_3 = ecarticle29_3;
return this;
}
public List<StructuredProperty> getSubjects() {
return subjects;
}
public Project setSubjects(List<StructuredProperty> subjects) {
public void setSubjects(List<StructuredProperty> subjects) {
this.subjects = subjects;
return this;
}
public List<Field<String>> getFundingtree() {
return fundingtree;
}
public Project setFundingtree(List<Field<String>> fundingtree) {
public void setFundingtree(List<Field<String>> fundingtree) {
this.fundingtree = fundingtree;
return this;
}
public Qualifier getContracttype() {
return contracttype;
}
public Project setContracttype(Qualifier contracttype) {
public void setContracttype(Qualifier contracttype) {
this.contracttype = contracttype;
return this;
}
public Field<String> getOptional1() {
return optional1;
}
public Project setOptional1(Field<String> optional1) {
public void setOptional1(Field<String> optional1) {
this.optional1 = optional1;
return this;
}
public Field<String> getOptional2() {
return optional2;
}
public Project setOptional2(Field<String> optional2) {
public void setOptional2(Field<String> optional2) {
this.optional2 = optional2;
return this;
}
public Field<String> getJsonextrainfo() {
return jsonextrainfo;
}
public Project setJsonextrainfo(Field<String> jsonextrainfo) {
public void setJsonextrainfo(Field<String> jsonextrainfo) {
this.jsonextrainfo = jsonextrainfo;
return this;
}
public Field<String> getContactfullname() {
return contactfullname;
}
public Project setContactfullname(Field<String> contactfullname) {
public void setContactfullname(Field<String> contactfullname) {
this.contactfullname = contactfullname;
return this;
}
public Field<String> getContactfax() {
return contactfax;
}
public Project setContactfax(Field<String> contactfax) {
public void setContactfax(Field<String> contactfax) {
this.contactfax = contactfax;
return this;
}
public Field<String> getContactphone() {
return contactphone;
}
public Project setContactphone(Field<String> contactphone) {
public void setContactphone(Field<String> contactphone) {
this.contactphone = contactphone;
return this;
}
public Field<String> getContactemail() {
return contactemail;
}
public Project setContactemail(Field<String> contactemail) {
public void setContactemail(Field<String> contactemail) {
this.contactemail = contactemail;
return this;
}
public Field<String> getSummary() {
return summary;
}
public Project setSummary(Field<String> summary) {
public void setSummary(Field<String> summary) {
this.summary = summary;
return this;
}
public Field<String> getCurrency() {
return currency;
}
public Project setCurrency(Field<String> currency) {
public void setCurrency(Field<String> currency) {
this.currency = currency;
return this;
}
public Float getTotalcost() {
return totalcost;
}
public Project setTotalcost(Float totalcost) {
public void setTotalcost(Float totalcost) {
this.totalcost = totalcost;
return this;
}
public Float getFundedamount() {
return fundedamount;
}
public Project setFundedamount(Float fundedamount) {
public void setFundedamount(Float fundedamount) {
this.fundedamount = fundedamount;
return this;
}
@Override
protected Project self() {
return this;
}
}

View File

@ -2,7 +2,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
public class Publication extends Result<Publication> implements Serializable {
public class Publication extends Result implements Serializable {
// publication specific
private Journal journal;
@ -11,13 +11,7 @@ public class Publication extends Result<Publication> implements Serializable {
return journal;
}
public Publication setJournal(Journal journal) {
public void setJournal(Journal journal) {
this.journal = journal;
return this;
}
@Override
protected Publication self() {
return this;
}
}

View File

@ -13,36 +13,31 @@ public class Qualifier implements Serializable {
return classid;
}
public Qualifier setClassid(String classid) {
public void setClassid(String classid) {
this.classid = classid;
return this;
}
public String getClassname() {
return classname;
}
public Qualifier setClassname(String classname) {
public void setClassname(String classname) {
this.classname = classname;
return this;
}
public String getSchemeid() {
return schemeid;
}
public Qualifier setSchemeid(String schemeid) {
public void setSchemeid(String schemeid) {
this.schemeid = schemeid;
return this;
}
public String getSchemename() {
return schemename;
}
public Qualifier setSchemename(String schemename) {
public void setSchemename(String schemename) {
this.schemename = schemename;
return this;
}
}

View File

@ -2,7 +2,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.util.List;
public class Relation extends Oaf<Relation> {
public class Relation extends Oaf {
private String relType;
@ -20,58 +20,47 @@ public class Relation extends Oaf<Relation> {
return relType;
}
public Relation setRelType(String relType) {
public void setRelType(String relType) {
this.relType = relType;
return self();
}
public String getSubRelType() {
return subRelType;
}
public Relation setSubRelType(String subRelType) {
public void setSubRelType(String subRelType) {
this.subRelType = subRelType;
return self();
}
public String getRelClass() {
return relClass;
}
public Relation setRelClass(String relClass) {
public void setRelClass(String relClass) {
this.relClass = relClass;
return self();
}
public String getSource() {
return source;
}
public Relation setSource(String source) {
public void setSource(String source) {
this.source = source;
return self();
}
public String getTarget() {
return target;
}
public Relation setTarget(String target) {
public void setTarget(String target) {
this.target = target;
return self();
}
public List<KeyValue> getCollectedFrom() {
return collectedFrom;
}
public Relation setCollectedFrom(List<KeyValue> collectedFrom) {
public void setCollectedFrom(List<KeyValue> collectedFrom) {
this.collectedFrom = collectedFrom;
return self();
}
@Override
protected Relation self() {
return this;
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public abstract class Result<T extends Result<T>> extends OafEntity<T> implements Serializable {
public abstract class Result extends OafEntity implements Serializable {
private List<Author> author;
@ -53,188 +53,167 @@ public abstract class Result<T extends Result<T>> extends OafEntity<T> implement
return author;
}
public T setAuthor(List<Author> author) {
public void setAuthor(List<Author> author) {
this.author = author;
return self();
}
public Qualifier getResulttype() {
return resulttype;
}
public T setResulttype(Qualifier resulttype) {
public void setResulttype(Qualifier resulttype) {
this.resulttype = resulttype;
return self();
}
public Qualifier getLanguage() {
return language;
}
public T setLanguage(Qualifier language) {
public void setLanguage(Qualifier language) {
this.language = language;
return self();
}
public List<Qualifier> getCountry() {
return country;
}
public T setCountry(List<Qualifier> country) {
public void setCountry(List<Qualifier> country) {
this.country = country;
return self();
}
public List<StructuredProperty> getSubject() {
return subject;
}
public T setSubject(List<StructuredProperty> subject) {
public void setSubject(List<StructuredProperty> subject) {
this.subject = subject;
return self();
}
public List<StructuredProperty> getTitle() {
return title;
}
public T setTitle(List<StructuredProperty> title) {
public void setTitle(List<StructuredProperty> title) {
this.title = title;
return self();
}
public List<StructuredProperty> getRelevantdate() {
return relevantdate;
}
public T setRelevantdate(List<StructuredProperty> relevantdate) {
public void setRelevantdate(List<StructuredProperty> relevantdate) {
this.relevantdate = relevantdate;
return self();
}
public List<Field<String>> getDescription() {
return description;
}
public T setDescription(List<Field<String>> description) {
public void setDescription(List<Field<String>> description) {
this.description = description;
return self();
}
public Field<String> getDateofacceptance() {
return dateofacceptance;
}
public T setDateofacceptance(Field<String> dateofacceptance) {
public void setDateofacceptance(Field<String> dateofacceptance) {
this.dateofacceptance = dateofacceptance;
return self();
}
public Field<String> getPublisher() {
return publisher;
}
public T setPublisher(Field<String> publisher) {
public void setPublisher(Field<String> publisher) {
this.publisher = publisher;
return self();
}
public Field<String> getEmbargoenddate() {
return embargoenddate;
}
public T setEmbargoenddate(Field<String> embargoenddate) {
public void setEmbargoenddate(Field<String> embargoenddate) {
this.embargoenddate = embargoenddate;
return self();
}
public List<Field<String>> getSource() {
return source;
}
public T setSource(List<Field<String>> source) {
public void setSource(List<Field<String>> source) {
this.source = source;
return self();
}
public List<Field<String>> getFulltext() {
return fulltext;
}
public T setFulltext(List<Field<String>> fulltext) {
public void setFulltext(List<Field<String>> fulltext) {
this.fulltext = fulltext;
return self();
}
public List<Field<String>> getFormat() {
return format;
}
public T setFormat(List<Field<String>> format) {
public void setFormat(List<Field<String>> format) {
this.format = format;
return self();
}
public List<Field<String>> getContributor() {
return contributor;
}
public T setContributor(List<Field<String>> contributor) {
public void setContributor(List<Field<String>> contributor) {
this.contributor = contributor;
return self();
}
public Qualifier getResourcetype() {
return resourcetype;
}
public T setResourcetype(Qualifier resourcetype) {
public void setResourcetype(Qualifier resourcetype) {
this.resourcetype = resourcetype;
return self();
}
public List<Field<String>> getCoverage() {
return coverage;
}
public T setCoverage(List<Field<String>> coverage) {
public void setCoverage(List<Field<String>> coverage) {
this.coverage = coverage;
return self();
}
public Field<String> getRefereed() {
return refereed;
}
public T setRefereed(Field<String> refereed) {
public void setRefereed(Field<String> refereed) {
this.refereed = refereed;
return self();
}
public List<Context> getContext() {
return context;
}
public T setContext(List<Context> context) {
public void setContext(List<Context> context) {
this.context = context;
return self();
}
public List<ExternalReference> getExternalReference() {
return externalReference;
}
public T setExternalReference(List<ExternalReference> externalReference) {
public void setExternalReference(List<ExternalReference> externalReference) {
this.externalReference = externalReference;
return self();
}
public List<Instance> getInstance() {
return instance;
}
public T setInstance(List<Instance> instance) {
public void setInstance(List<Instance> instance) {
this.instance = instance;
return self();
}
}

View File

@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class Software extends Result<Software> implements Serializable {
public class Software extends Result implements Serializable {
private List<Field<String>> documentationUrl;
@ -17,40 +17,31 @@ public class Software extends Result<Software> implements Serializable {
return documentationUrl;
}
public Software setDocumentationUrl(List<Field<String>> documentationUrl) {
public void setDocumentationUrl(List<Field<String>> documentationUrl) {
this.documentationUrl = documentationUrl;
return this;
}
public List<StructuredProperty> getLicense() {
return license;
}
public Software setLicense(List<StructuredProperty> license) {
public void setLicense(List<StructuredProperty> license) {
this.license = license;
return this;
}
public Field<String> getCodeRepositoryUrl() {
return codeRepositoryUrl;
}
public Software setCodeRepositoryUrl(Field<String> codeRepositoryUrl) {
public void setCodeRepositoryUrl(Field<String> codeRepositoryUrl) {
this.codeRepositoryUrl = codeRepositoryUrl;
return this;
}
public Qualifier getProgrammingLanguage() {
return programmingLanguage;
}
public Software setProgrammingLanguage(Qualifier programmingLanguage) {
public void setProgrammingLanguage(Qualifier programmingLanguage) {
this.programmingLanguage = programmingLanguage;
return this;
}
@Override
protected Software self() {
return this;
}
}

View File

@ -14,26 +14,23 @@ public class StructuredProperty implements Serializable {
return value;
}
public StructuredProperty setValue(String value) {
public void setValue(String value) {
this.value = value;
return this;
}
public Qualifier getQualifier() {
return qualifier;
}
public StructuredProperty setQualifier(Qualifier qualifier) {
public void setQualifier(Qualifier qualifier) {
this.qualifier = qualifier;
return this;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public StructuredProperty setDataInfo(DataInfo dataInfo) {
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return this;
}
}

View File

@ -20,7 +20,7 @@ public class ProtoConverter implements Serializable {
return convertRelation(oaf);
}
} catch (Throwable e) {
throw new RuntimeException(e);
throw new RuntimeException("error on getting " + s, e);
}
}
@ -29,16 +29,16 @@ public class ProtoConverter implements Serializable {
final Relation rel = new Relation();
rel.setDataInfo(mapDataInfo(oaf.getDataInfo()));
rel.setLastupdatetimestamp(oaf.getLastupdatetimestamp());
return rel
.setSource(r.getSource())
.setTarget(r.getTarget())
.setRelType(r.getRelType().toString())
.setSubRelType(r.getSubRelType().toString())
.setRelClass(r.getRelClass())
.setCollectedFrom(r.getCollectedfromCount() > 0 ?
r.getCollectedfromList().stream()
.map(kv -> mapKV(kv))
.collect(Collectors.toList()) : null);
rel.setSource(r.getSource());
rel.setTarget(r.getTarget());
rel.setRelType(r.getRelType().toString());
rel.setSubRelType(r.getSubRelType().toString());
rel.setRelClass(r.getRelClass());
rel.setCollectedFrom(r.getCollectedfromCount() > 0 ?
r.getCollectedfromList().stream()
.map(kv -> mapKV(kv))
.collect(Collectors.toList()) : null);
return rel;
}
private static OafEntity convertEntity(OafProtos.Oaf oaf) {
@ -60,119 +60,125 @@ public class ProtoConverter implements Serializable {
private static Organization convertOrganization(OafProtos.Oaf oaf) {
final OrganizationProtos.Organization.Metadata m = oaf.getEntity().getOrganization().getMetadata();
final Organization org = setOaf(new Organization(), oaf);
return setEntity(org, oaf)
.setLegalshortname(mapStringField(m.getLegalshortname()))
.setLegalname(mapStringField(m.getLegalname()))
.setAlternativeNames(m.getAlternativeNamesList().
stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setWebsiteurl(mapStringField(m.getWebsiteurl()))
.setLogourl(mapStringField(m.getLogourl()))
.setEclegalbody(mapStringField(m.getEclegalbody()))
.setEclegalperson(mapStringField(m.getEclegalperson()))
.setEcnonprofit(mapStringField(m.getEcnonprofit()))
.setEcresearchorganization(mapStringField(m.getEcresearchorganization()))
.setEchighereducation(mapStringField(m.getEchighereducation()))
.setEcinternationalorganizationeurinterests(mapStringField(m.getEcinternationalorganizationeurinterests()))
.setEcinternationalorganization(mapStringField(m.getEcinternationalorganization()))
.setEcenterprise(mapStringField(m.getEcenterprise()))
.setEcsmevalidated(mapStringField(m.getEcsmevalidated()))
.setEcnutscode(mapStringField(m.getEcnutscode()))
.setCountry(mapQualifier(m.getCountry()));
setEntity(org, oaf);
org.setLegalshortname(mapStringField(m.getLegalshortname()));
org.setLegalname(mapStringField(m.getLegalname()));
org.setAlternativeNames(m.getAlternativeNamesList().
stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
org.setWebsiteurl(mapStringField(m.getWebsiteurl()));
org.setLogourl(mapStringField(m.getLogourl()));
org.setEclegalbody(mapStringField(m.getEclegalbody()));
org.setEclegalperson(mapStringField(m.getEclegalperson()));
org.setEcnonprofit(mapStringField(m.getEcnonprofit()));
org.setEcresearchorganization(mapStringField(m.getEcresearchorganization()));
org.setEchighereducation(mapStringField(m.getEchighereducation()));
org.setEcinternationalorganizationeurinterests(mapStringField(m.getEcinternationalorganizationeurinterests()));
org.setEcinternationalorganization(mapStringField(m.getEcinternationalorganization()));
org.setEcenterprise(mapStringField(m.getEcenterprise()));
org.setEcsmevalidated(mapStringField(m.getEcsmevalidated()));
org.setEcnutscode(mapStringField(m.getEcnutscode()));
org.setCountry(mapQualifier(m.getCountry()));
return org;
}
private static Datasource convertDataSource(OafProtos.Oaf oaf) {
final DatasourceProtos.Datasource.Metadata m = oaf.getEntity().getDatasource().getMetadata();
final Datasource datasource = setOaf(new Datasource(), oaf);
return setEntity(datasource, oaf)
.setAccessinfopackage(m.getAccessinfopackageList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setCertificates(mapStringField(m.getCertificates()))
.setCitationguidelineurl(mapStringField(m.getCitationguidelineurl()))
.setContactemail(mapStringField(m.getContactemail()))
.setDatabaseaccessrestriction(mapStringField(m.getDatabaseaccessrestriction()))
.setDatabaseaccesstype(mapStringField(m.getDatabaseaccesstype()))
.setDataprovider(mapBoolField(m.getDataprovider()))
.setDatasourcetype(mapQualifier(m.getDatasourcetype()))
.setDatauploadrestriction(mapStringField(m.getDatauploadrestriction()))
.setCitationguidelineurl(mapStringField(m.getCitationguidelineurl()))
.setDatauploadtype(mapStringField(m.getDatauploadtype()))
.setDateofvalidation(mapStringField(m.getDateofvalidation()))
.setDescription(mapStringField(m.getDescription()))
.setEnglishname(mapStringField(m.getEnglishname()))
.setLatitude(mapStringField(m.getLatitude()))
.setLongitude(mapStringField(m.getLongitude()))
.setLogourl(mapStringField(m.getLogourl()))
.setMissionstatementurl(mapStringField(m.getMissionstatementurl()))
.setNamespaceprefix(mapStringField(m.getNamespaceprefix()))
.setOdcontenttypes(m.getOdcontenttypesList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setOdlanguages(m.getOdlanguagesList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setOdnumberofitems(mapStringField(m.getOdnumberofitems()))
.setOdnumberofitemsdate(mapStringField(m.getOdnumberofitemsdate()))
.setOdpolicies(mapStringField(m.getOdpolicies()))
.setOfficialname(mapStringField(m.getOfficialname()))
.setOpenairecompatibility(mapQualifier(m.getOpenairecompatibility()))
.setPidsystems(mapStringField(m.getPidsystems()))
.setPolicies(m.getPoliciesList()
.stream()
.map(ProtoUtils::mapKV)
.collect(Collectors.toList()))
.setQualitymanagementkind(mapStringField(m.getQualitymanagementkind()))
.setReleaseenddate(mapStringField(m.getReleaseenddate()))
.setServiceprovider(mapBoolField(m.getServiceprovider()))
.setReleasestartdate(mapStringField(m.getReleasestartdate()))
.setSubjects(m.getSubjectsList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()))
.setVersioning(mapBoolField(m.getVersioning()))
.setWebsiteurl(mapStringField(m.getWebsiteurl()))
.setJournal(mapJournal(m.getJournal()));
setEntity(datasource, oaf);
datasource.setAccessinfopackage(m.getAccessinfopackageList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
datasource.setCertificates(mapStringField(m.getCertificates()));
datasource.setCitationguidelineurl(mapStringField(m.getCitationguidelineurl()));
datasource.setContactemail(mapStringField(m.getContactemail()));
datasource.setDatabaseaccessrestriction(mapStringField(m.getDatabaseaccessrestriction()));
datasource.setDatabaseaccesstype(mapStringField(m.getDatabaseaccesstype()));
datasource.setDataprovider(mapBoolField(m.getDataprovider()));
datasource.setDatasourcetype(mapQualifier(m.getDatasourcetype()));
datasource.setDatauploadrestriction(mapStringField(m.getDatauploadrestriction()));
datasource.setCitationguidelineurl(mapStringField(m.getCitationguidelineurl()));
datasource.setDatauploadtype(mapStringField(m.getDatauploadtype()));
datasource.setDateofvalidation(mapStringField(m.getDateofvalidation()));
datasource.setDescription(mapStringField(m.getDescription()));
datasource.setEnglishname(mapStringField(m.getEnglishname()));
datasource.setLatitude(mapStringField(m.getLatitude()));
datasource.setLongitude(mapStringField(m.getLongitude()));
datasource.setLogourl(mapStringField(m.getLogourl()));
datasource.setMissionstatementurl(mapStringField(m.getMissionstatementurl()));
datasource.setNamespaceprefix(mapStringField(m.getNamespaceprefix()));
datasource.setOdcontenttypes(m.getOdcontenttypesList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
datasource.setOdlanguages(m.getOdlanguagesList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
datasource.setOdnumberofitems(mapStringField(m.getOdnumberofitems()));
datasource.setOdnumberofitemsdate(mapStringField(m.getOdnumberofitemsdate()));
datasource.setOdpolicies(mapStringField(m.getOdpolicies()));
datasource.setOfficialname(mapStringField(m.getOfficialname()));
datasource.setOpenairecompatibility(mapQualifier(m.getOpenairecompatibility()));
datasource.setPidsystems(mapStringField(m.getPidsystems()));
datasource.setPolicies(m.getPoliciesList()
.stream()
.map(ProtoUtils::mapKV)
.collect(Collectors.toList()));
datasource.setQualitymanagementkind(mapStringField(m.getQualitymanagementkind()));
datasource.setReleaseenddate(mapStringField(m.getReleaseenddate()));
datasource.setServiceprovider(mapBoolField(m.getServiceprovider()));
datasource.setReleasestartdate(mapStringField(m.getReleasestartdate()));
datasource.setSubjects(m.getSubjectsList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()));
datasource.setVersioning(mapBoolField(m.getVersioning()));
datasource.setWebsiteurl(mapStringField(m.getWebsiteurl()));
datasource.setJournal(mapJournal(m.getJournal()));
return datasource;
}
private static Project convertProject(OafProtos.Oaf oaf) {
final ProjectProtos.Project.Metadata m = oaf.getEntity().getProject().getMetadata();
final Project project = setOaf(new Project(), oaf);
return setEntity(project, oaf)
.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.getSubjectsList().stream()
.map(sp -> mapStructuredProperty(sp))
.collect(Collectors.toList()))
.setTitle(mapStringField(m.getTitle()))
.setWebsiteurl(mapStringField(m.getWebsiteurl()))
.setFundingtree(m.getFundingtreeList().stream()
.map(f -> mapStringField(f))
.collect(Collectors.toList()))
.setJsonextrainfo(mapStringField(m.getJsonextrainfo()))
.setSummary(mapStringField(m.getSummary()))
.setOptional1(mapStringField(m.getOptional1()))
.setOptional2(mapStringField(m.getOptional2()));
setEntity(project, oaf);
project.setAcronym(mapStringField(m.getAcronym()));
project.setCallidentifier(mapStringField(m.getCallidentifier()));
project.setCode(mapStringField(m.getCode()));
project.setContactemail(mapStringField(m.getContactemail()));
project.setContactfax(mapStringField(m.getContactfax()));
project.setContactfullname(mapStringField(m.getContactfullname()));
project.setContactphone(mapStringField(m.getContactphone()));
project.setContracttype(mapQualifier(m.getContracttype()));
project.setCurrency(mapStringField(m.getCurrency()));
project.setDuration(mapStringField(m.getDuration()));
project.setEcarticle29_3(mapStringField(m.getEcarticle293()));
project.setEcsc39(mapStringField(m.getEcsc39()));
project.setOamandatepublications(mapStringField(m.getOamandatepublications()));
project.setStartdate(mapStringField(m.getStartdate()));
project.setEnddate(mapStringField(m.getEnddate()));
project.setFundedamount(m.getFundedamount());
project.setTotalcost(m.getTotalcost());
project.setKeywords(mapStringField(m.getKeywords()));
project.setSubjects(m.getSubjectsList().stream()
.map(sp -> mapStructuredProperty(sp))
.collect(Collectors.toList()));
project.setTitle(mapStringField(m.getTitle()));
project.setWebsiteurl(mapStringField(m.getWebsiteurl()));
project.setFundingtree(m.getFundingtreeList().stream()
.map(f -> mapStringField(f))
.collect(Collectors.toList()));
project.setJsonextrainfo(mapStringField(m.getJsonextrainfo()));
project.setSummary(mapStringField(m.getSummary()));
project.setOptional1(mapStringField(m.getOptional1()));
project.setOptional2(mapStringField(m.getOptional2()));
return project;
}
private static Result convertResult(OafProtos.Oaf oaf) {
@ -195,37 +201,40 @@ public class ProtoConverter implements Serializable {
ResultProtos.Result.Metadata m = oaf.getEntity().getResult().getMetadata();
Software software = setOaf(new Software(), oaf);
setEntity(software, oaf);
return setResult(software, oaf)
.setDocumentationUrl(m.getDocumentationUrlList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setLicense(m.getLicenseList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()))
.setCodeRepositoryUrl(ProtoUtils.mapStringField(m.getCodeRepositoryUrl()))
.setProgrammingLanguage(ProtoUtils.mapQualifier(m.getProgrammingLanguage()));
setResult(software, oaf);
software.setDocumentationUrl(m.getDocumentationUrlList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
software.setLicense(m.getLicenseList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()));
software.setCodeRepositoryUrl(ProtoUtils.mapStringField(m.getCodeRepositoryUrl()));
software.setProgrammingLanguage(ProtoUtils.mapQualifier(m.getProgrammingLanguage()));
return software;
}
private static OtherResearchProducts createORP(OafProtos.Oaf oaf) {
ResultProtos.Result.Metadata m = oaf.getEntity().getResult().getMetadata();
OtherResearchProducts otherResearchProducts = setOaf(new OtherResearchProducts(), oaf);
setEntity(otherResearchProducts, oaf);
return setResult(otherResearchProducts, oaf)
.setContactperson(m.getContactpersonList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setContactgroup(m.getContactgroupList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setTool(m.getToolList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
setResult(otherResearchProducts, oaf);
otherResearchProducts.setContactperson(m.getContactpersonList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
otherResearchProducts.setContactgroup(m.getContactgroupList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
otherResearchProducts.setTool(m.getToolList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
return otherResearchProducts;
}
private static Publication createPublication(OafProtos.Oaf oaf) {
@ -233,8 +242,9 @@ public class ProtoConverter implements Serializable {
ResultProtos.Result.Metadata m = oaf.getEntity().getResult().getMetadata();
Publication publication = setOaf(new Publication(), oaf);
setEntity(publication, oaf);
return setResult(publication, oaf)
.setJournal(mapJournal(m.getJournal()));
setResult(publication, oaf);
publication.setJournal(mapJournal(m.getJournal()));
return publication;
}
private static Dataset createDataset(OafProtos.Oaf oaf) {
@ -242,16 +252,18 @@ public class ProtoConverter implements Serializable {
ResultProtos.Result.Metadata m = oaf.getEntity().getResult().getMetadata();
Dataset dataset = setOaf(new Dataset(), oaf);
setEntity(dataset, oaf);
return setResult(dataset, oaf)
.setStoragedate(ProtoUtils.mapStringField(m.getStoragedate()))
.setDevice(ProtoUtils.mapStringField(m.getDevice()))
.setSize(ProtoUtils.mapStringField(m.getSize()))
.setVersion(ProtoUtils.mapStringField(m.getVersion()))
.setLastmetadataupdate(ProtoUtils.mapStringField(m.getLastmetadataupdate()))
.setMetadataversionnumber(ProtoUtils.mapStringField(m.getMetadataversionnumber()))
.setGeolocation(m.getGeolocationList()
.stream()
.map(ProtoUtils::mapGeolocation)
.collect(Collectors.toList()));
setResult(dataset, oaf);
dataset.setStoragedate(ProtoUtils.mapStringField(m.getStoragedate()));
dataset.setDevice(ProtoUtils.mapStringField(m.getDevice()));
dataset.setSize(ProtoUtils.mapStringField(m.getSize()));
dataset.setVersion(ProtoUtils.mapStringField(m.getVersion()));
dataset.setLastmetadataupdate(ProtoUtils.mapStringField(m.getLastmetadataupdate()));
dataset.setMetadataversionnumber(ProtoUtils.mapStringField(m.getMetadataversionnumber()));
dataset.setGeolocation(m.getGeolocationList()
.stream()
.map(ProtoUtils::mapGeolocation)
.collect(Collectors.toList()));
return dataset;
}
}

View File

@ -17,220 +17,230 @@ public class ProtoUtils {
}
public static <T extends Oaf> T setOaf(T oaf, OafProtos.Oaf o) {
oaf.setDataInfo(mapDataInfo(o.getDataInfo())).setLastupdatetimestamp(o.getLastupdatetimestamp());
oaf.setDataInfo(mapDataInfo(o.getDataInfo()));
oaf.setLastupdatetimestamp(o.getLastupdatetimestamp());
return oaf;
}
public static <T extends OafEntity> T setEntity(T entity, OafProtos.Oaf oaf) {
//setting Entity fields
final OafProtos.OafEntity e = oaf.getEntity();
entity
.setId(e.getId())
.setOriginalId(e.getOriginalIdList())
.setCollectedfrom(e.getCollectedfromList()
.stream()
.map(ProtoUtils::mapKV)
.collect(Collectors.toList()))
.setPid(e.getPidList().stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()))
.setDateofcollection(entity.getDateofcollection())
.setDateoftransformation(entity.getDateoftransformation())
.setExtraInfo(e.getExtraInfoList()
.stream()
.map(ProtoUtils::mapExtraInfo)
.collect(Collectors.toList()));
entity.setId(e.getId());
entity.setOriginalId(e.getOriginalIdList());
entity.setCollectedfrom(e.getCollectedfromList()
.stream()
.map(ProtoUtils::mapKV)
.collect(Collectors.toList()));
entity.setPid(e.getPidList().stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()));
entity.setDateofcollection(entity.getDateofcollection());
entity.setDateoftransformation(entity.getDateoftransformation());
entity.setExtraInfo(e.getExtraInfoList()
.stream()
.map(ProtoUtils::mapExtraInfo)
.collect(Collectors.toList()));
return entity;
}
public static <T extends Result> T setResult(T entity, OafProtos.Oaf oaf) {
//setting Entity fields
final ResultProtos.Result.Metadata m = oaf.getEntity().getResult().getMetadata();
entity
.setAuthor(m.getAuthorList()
.stream()
.map(ProtoUtils::mapAuthor)
.collect(Collectors.toList()))
.setResulttype(mapQualifier(m.getResulttype()))
.setLanguage(ProtoUtils.mapQualifier(m.getLanguage()))
.setCountry(m.getCountryList()
.stream()
.map(ProtoUtils::mapQualifier)
.collect(Collectors.toList()))
.setSubject(m.getSubjectList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()))
.setTitle(m.getTitleList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()))
.setRelevantdate(m.getRelevantdateList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()))
.setDescription(m.getDescriptionList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setDateofacceptance(ProtoUtils.mapStringField(m.getDateofacceptance()))
.setPublisher(ProtoUtils.mapStringField(m.getPublisher()))
.setEmbargoenddate(ProtoUtils.mapStringField(m.getEmbargoenddate()))
.setSource(m.getSourceList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setFulltext(m.getFulltextList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setFormat(m.getFormatList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setContributor(m.getContributorList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setResourcetype(ProtoUtils.mapQualifier(m.getResourcetype()))
.setCoverage(m.getCoverageList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()))
.setRefereed(mapStringField(m.getRefereed()))
.setContext(m.getContextList()
.stream()
.map(ProtoUtils::mapContext)
.collect(Collectors.toList()));
entity.setAuthor(m.getAuthorList()
.stream()
.map(ProtoUtils::mapAuthor)
.collect(Collectors.toList()));
entity.setResulttype(mapQualifier(m.getResulttype()));
entity.setLanguage(ProtoUtils.mapQualifier(m.getLanguage()));
entity.setCountry(m.getCountryList()
.stream()
.map(ProtoUtils::mapQualifier)
.collect(Collectors.toList()));
entity.setSubject(m.getSubjectList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()));
entity.setTitle(m.getTitleList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()));
entity.setRelevantdate(m.getRelevantdateList()
.stream()
.map(ProtoUtils::mapStructuredProperty)
.collect(Collectors.toList()));
entity.setDescription(m.getDescriptionList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
entity.setDateofacceptance(ProtoUtils.mapStringField(m.getDateofacceptance()));
entity.setPublisher(ProtoUtils.mapStringField(m.getPublisher()));
entity.setEmbargoenddate(ProtoUtils.mapStringField(m.getEmbargoenddate()));
entity.setSource(m.getSourceList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
entity.setFulltext(m.getFulltextList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
entity.setFormat(m.getFormatList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
entity.setContributor(m.getContributorList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
entity.setResourcetype(ProtoUtils.mapQualifier(m.getResourcetype()));
entity.setCoverage(m.getCoverageList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
entity.setRefereed(mapStringField(m.getRefereed()));
entity.setContext(m.getContextList()
.stream()
.map(ProtoUtils::mapContext)
.collect(Collectors.toList()));
return entity;
}
private static Context mapContext(ResultProtos.Result.Context context) {
return new Context()
.setId(context.getId())
.setDataInfo(context.getDataInfoList()
.stream()
.map(ProtoUtils::mapDataInfo)
.collect(Collectors.toList()));
final Context entity = new Context();
entity.setId(context.getId());
entity.setDataInfo(context.getDataInfoList()
.stream()
.map(ProtoUtils::mapDataInfo)
.collect(Collectors.toList()));
return entity;
}
public static KeyValue mapKV(FieldTypeProtos.KeyValue kv) {
return new KeyValue()
.setKey(kv.getKey())
.setValue(kv.getValue())
.setDataInfo(mapDataInfo(kv.getDataInfo()));
final KeyValue keyValue = new KeyValue();
keyValue.setKey(kv.getKey());
keyValue.setValue(kv.getValue());
keyValue.setDataInfo(mapDataInfo(kv.getDataInfo()));
return keyValue;
}
public static DataInfo mapDataInfo(FieldTypeProtos.DataInfo d) {
return new DataInfo()
.setDeletedbyinference(d.getDeletedbyinference())
.setInferenceprovenance(d.getInferenceprovenance())
.setInferred(d.getInferred())
.setInvisible(d.getInvisible())
.setProvenanceaction(mapQualifier(d.getProvenanceaction()));
final DataInfo dataInfo = new DataInfo();
dataInfo.setDeletedbyinference(d.getDeletedbyinference());
dataInfo.setInferenceprovenance(d.getInferenceprovenance());
dataInfo.setInferred(d.getInferred());
dataInfo.setInvisible(d.getInvisible());
dataInfo.setProvenanceaction(mapQualifier(d.getProvenanceaction()));
return dataInfo;
}
public static Qualifier mapQualifier(FieldTypeProtos.Qualifier q) {
return new Qualifier()
.setClassid(q.getClassid())
.setClassname(q.getClassname())
.setSchemeid(q.getSchemeid())
.setSchemename(q.getSchemename());
//.setDataInfo(q.hasDataInfo() ? mapDataInfo(q.getDataInfo()) : null);
final Qualifier qualifier = new Qualifier();
qualifier.setClassid(q.getClassid());
qualifier.setClassname(q.getClassname());
qualifier.setSchemeid(q.getSchemeid());
qualifier.setSchemename(q.getSchemename());
return qualifier;
}
public static StructuredProperty mapStructuredProperty(FieldTypeProtos.StructuredProperty sp) {
return new StructuredProperty()
.setValue(sp.getValue())
.setQualifier(mapQualifier(sp.getQualifier()))
.setDataInfo(sp.hasDataInfo() ? mapDataInfo(sp.getDataInfo()) : null);
final StructuredProperty structuredProperty = new StructuredProperty();
structuredProperty.setValue(sp.getValue());
structuredProperty.setQualifier(mapQualifier(sp.getQualifier()));
structuredProperty.setDataInfo(mapDataInfo(sp.getDataInfo()));
return structuredProperty;
}
public static ExtraInfo mapExtraInfo(FieldTypeProtos.ExtraInfo extraInfo) {
return new ExtraInfo()
.setName(extraInfo.getName())
.setTypology(extraInfo.getTypology())
.setProvenance(extraInfo.getProvenance())
.setTrust(extraInfo.getTrust())
.setValue(extraInfo.getValue());
final ExtraInfo entity = new ExtraInfo();
entity.setName(extraInfo.getName());
entity.setTypology(extraInfo.getTypology());
entity.setProvenance(extraInfo.getProvenance());
entity.setTrust(extraInfo.getTrust());
entity.setValue(extraInfo.getValue());
return entity;
}
public static OAIProvenance mapOAIProvenance(FieldTypeProtos.OAIProvenance oaiProvenance) {
return new OAIProvenance().setOriginDescription(mapOriginalDescription(oaiProvenance.getOriginDescription()));
final OAIProvenance entity = new OAIProvenance();
entity.setOriginDescription(mapOriginalDescription(oaiProvenance.getOriginDescription()));
return entity;
}
public static OriginDescription mapOriginalDescription(FieldTypeProtos.OAIProvenance.OriginDescription originDescription) {
final OriginDescription originDescriptionResult = new OriginDescription()
.setHarvestDate(originDescription.getHarvestDate())
.setAltered(originDescription.getAltered())
.setBaseURL(originDescription.getBaseURL())
.setIdentifier(originDescription.getIdentifier())
.setDatestamp(originDescription.getDatestamp())
.setMetadataNamespace(originDescription.getMetadataNamespace());
// if (originDescription.hasOriginDescription())
// originDescriptionResult.setOriginDescription(mapOriginalDescription(originDescription.getOriginDescription()));
final OriginDescription originDescriptionResult = new OriginDescription();
originDescriptionResult.setHarvestDate(originDescription.getHarvestDate());
originDescriptionResult.setAltered(originDescription.getAltered());
originDescriptionResult.setBaseURL(originDescription.getBaseURL());
originDescriptionResult.setIdentifier(originDescription.getIdentifier());
originDescriptionResult.setDatestamp(originDescription.getDatestamp());
originDescriptionResult.setMetadataNamespace(originDescription.getMetadataNamespace());
return originDescriptionResult;
}
public static Field<String> mapStringField(FieldTypeProtos.StringField s) {
return new Field<String>()
.setValue(s.getValue())
.setDataInfo(s.hasDataInfo() ? mapDataInfo(s.getDataInfo()) : null);
final Field<String> stringField = new Field<>();
stringField.setValue(s.getValue());
stringField.setDataInfo(mapDataInfo(s.getDataInfo()));
return stringField;
}
public static Field<Boolean> mapBoolField(FieldTypeProtos.BoolField b) {
return new Field<Boolean>()
.setValue(b.getValue())
.setDataInfo(b.hasDataInfo() ? mapDataInfo(b.getDataInfo()) : null);
final Field<Boolean> booleanField = new Field<>();
booleanField.setValue(b.getValue());
booleanField.setDataInfo(mapDataInfo(b.getDataInfo()));
return booleanField;
}
public static Field<Integer> mapIntField(FieldTypeProtos.IntField b) {
return new Field<Integer>()
.setValue(b.getValue())
.setDataInfo(b.hasDataInfo() ? mapDataInfo(b.getDataInfo()) : null);
final Field<Integer> entity = new Field<>();
entity.setValue(b.getValue());
entity.setDataInfo(mapDataInfo(b.getDataInfo()));
return entity;
}
public static Journal mapJournal(FieldTypeProtos.Journal j) {
return new Journal()
.setConferencedate(j.getConferencedate())
.setConferenceplace(j.getConferenceplace())
.setEdition(j.getEdition())
.setEp(j.getEp())
.setIss(j.getIss())
.setIssnLinking(j.getIssnLinking())
.setIssnOnline(j.getIssnOnline())
.setIssnPrinted(j.getIssnPrinted())
.setName(j.getName())
.setSp(j.getSp())
.setVol(j.getVol())
.setDataInfo(mapDataInfo(j.getDataInfo()));
final Journal journal = new Journal();
journal.setConferencedate(j.getConferencedate());
journal.setConferenceplace(j.getConferenceplace());
journal.setEdition(j.getEdition());
journal.setEp(j.getEp());
journal.setIss(j.getIss());
journal.setIssnLinking(j.getIssnLinking());
journal.setIssnOnline(j.getIssnOnline());
journal.setIssnPrinted(j.getIssnPrinted());
journal.setName(j.getName());
journal.setSp(j.getSp());
journal.setVol(j.getVol());
journal.setDataInfo(mapDataInfo(j.getDataInfo()));
return journal;
}
public static Author mapAuthor(FieldTypeProtos.Author author) {
return new Author()
.setFullname(author.getFullname())
.setName(author.getName())
.setSurname(author.getSurname())
.setRank(author.getRank())
.setPid(author.getPidList()
.stream()
.map(ProtoUtils::mapKV)
.collect(Collectors.toList()))
.setAffiliation(author.getAffiliationList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
final Author entity = new Author();
entity.setFullname(author.getFullname());
entity.setName(author.getName());
entity.setSurname(author.getSurname());
entity.setRank(author.getRank());
entity.setPid(author.getPidList()
.stream()
.map(ProtoUtils::mapKV)
.collect(Collectors.toList()));
entity.setAffiliation(author.getAffiliationList()
.stream()
.map(ProtoUtils::mapStringField)
.collect(Collectors.toList()));
return entity;
}
public static GeoLocation mapGeolocation(ResultProtos.Result.GeoLocation geoLocation) {
return new GeoLocation()
.setPoint(geoLocation.getPoint())
.setBox(geoLocation.getBox())
.setPlace(geoLocation.getPlace());
final GeoLocation entity = new GeoLocation();
entity.setPoint(geoLocation.getPoint());
entity.setBox(geoLocation.getBox());
entity.setPlace(geoLocation.getPlace());
return entity;
}
}

View File

@ -1,7 +1,10 @@
package eu.dnetlib.dhp.graph;
import eu.dnetlib.dhp.schema.oaf.Organization;
import eu.dnetlib.dhp.application.ArgumentApplicationParser;
import eu.dnetlib.dhp.schema.oaf.*;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.io.Text;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
@ -14,49 +17,49 @@ import scala.Tuple2;
public class SparkGraphImporterJob {
public static void main(String[] args) throws Exception{
public static void main(String[] args) throws Exception {
//TODO add argument parser
// final ArgumentApplicationParser parser = new ArgumentApplicationParser(IOUtils.toString(SparkGraphImporterJob.class.getResourceAsStream("/eu/dnetlib/dhp/graph/graph_importer_parameters.json")));
// parser.parseArgument(args);
final ArgumentApplicationParser parser = new ArgumentApplicationParser(IOUtils.toString(SparkGraphImporterJob.class.getResourceAsStream("/eu/dnetlib/dhp/graph/input_graph_parameters.json")));
parser.parseArgument(args);
final SparkSession spark = SparkSession
.builder()
.appName("ImportGraph")
//TODO replace with: master(parser.get("master"))
.master("local[16]")
.master(parser.get("master"))
.getOrCreate();
final JavaSparkContext sc = new JavaSparkContext(spark.sparkContext());
final String inputPath = parser.get("input");
final String outputPath = parser.get("outputDir");
final String path = "file:///Users/miconis/Downloads/part-m-02236";
final JavaRDD<Tuple2<String, String>> inputRDD = sc.sequenceFile(path, Text.class, Text.class)
// Read the input file and convert it into RDD of serializable object
final JavaRDD<Tuple2<String, String>> inputRDD = sc.sequenceFile(inputPath, Text.class, Text.class)
.map(item -> new Tuple2<>(item._1.toString(), item._2.toString()));
final JavaRDD<Oaf> oafRdd = inputRDD.filter(s -> !StringUtils.isBlank(s._2()) && !s._1().contains("@update")).map(Tuple2::_2).map(ProtoConverter::convert);
final String body = inputRDD.filter(s -> s._1().contains("20|") && s._1().split("@")[2].equalsIgnoreCase("body")).map(Tuple2::_2).first();
final Encoder<Organization> organizationEncoder = Encoders.bean(Organization.class);
final Encoder<Project> projectEncoder = Encoders.bean(Project.class);
final Encoder<Datasource> datasourceEncoder = Encoders.bean(Datasource.class);
System.out.println(body);
final Encoder<eu.dnetlib.dhp.schema.oaf.Dataset> datasetEncoder = Encoders.bean(eu.dnetlib.dhp.schema.oaf.Dataset.class);
final Encoder<Publication> publicationEncoder = Encoders.bean(Publication.class);
final Encoder<Software> softwareEncoder = Encoders.bean(Software.class);
final Encoder<OtherResearchProducts> otherResearchProductsEncoder = Encoders.bean(OtherResearchProducts.class);
final Encoder<Relation> relationEncoder = Encoders.bean(Relation.class);
final JavaRDD<Organization> organization = inputRDD
.filter(s -> s._1().split("@")[2].equalsIgnoreCase("body"))
.map(Tuple2::_2)
.map(ProtoConverter::convert)
.filter(s-> s instanceof Organization)
.map(s->(Organization)s);
final Encoder<Organization> encoder = Encoders.bean(Organization.class);
final Dataset<Organization> mdstore = spark.createDataset(organization.rdd(), encoder);
spark.createDataset(oafRdd.filter(s -> s instanceof Organization).map(s -> (Organization) s).rdd(), organizationEncoder).write().save(outputPath + "/organizations");
spark.createDataset(oafRdd.filter(s -> s instanceof Project).map(s -> (Project) s).rdd(), projectEncoder).write().save(outputPath + "/projects");
spark.createDataset(oafRdd.filter(s -> s instanceof Datasource).map(s -> (Datasource) s).rdd(), datasourceEncoder).write().save(outputPath + "/datasources");
spark.createDataset(oafRdd.filter(s -> s instanceof eu.dnetlib.dhp.schema.oaf.Dataset).map(s -> (eu.dnetlib.dhp.schema.oaf.Dataset) s).rdd(), datasetEncoder).write().save(outputPath + "/datasets");
System.out.println(mdstore.count());
//
//
// .filter(s -> s instanceof Publication)
// .count();
spark.createDataset(oafRdd.filter(s -> s instanceof Publication).map(s -> (Publication) s).rdd(), publicationEncoder).write().save(outputPath + "/publications");
spark.createDataset(oafRdd.filter(s -> s instanceof Software).map(s -> (Software) s).rdd(), softwareEncoder).write().save(outputPath + "/software");
spark.createDataset(oafRdd.filter(s -> s instanceof OtherResearchProducts).map(s -> (OtherResearchProducts) s).rdd(), otherResearchProductsEncoder).write().save(outputPath + "/otherResearchProducts");
spark.createDataset(oafRdd.filter(s -> s instanceof Relation).map(s -> (Relation) s).rdd(), relationEncoder).write().save(outputPath + "/relations");

View File

@ -0,0 +1,5 @@
[
{"paramName":"mt", "paramLongName":"master", "paramDescription": "should be local or yarn", "paramRequired": true},
{"paramName":"i", "paramLongName":"input", "paramDescription": "the path of the sequencial file to read", "paramRequired": true},
{"paramName":"o", "paramLongName":"outputDir", "paramDescription": "the path where store DataFrames on HDFS", "paramRequired": true}
]

View File

@ -6,7 +6,7 @@ public class SparkGraphImporterJobTest {
@Test
public void testImport() throws Exception {
SparkGraphImporterJob.main(null);
SparkGraphImporterJob.main(new String[]{"-mt", "local[*]","-i", "/home/sandro/part-m-02236", "-o", "/tmp/dataframes"});
}
}