From c8d6d6bbd162ce5db7f6f48354b401f03b4b68aa Mon Sep 17 00:00:00 2001 From: "sandro.labruzzo" Date: Fri, 25 Oct 2019 10:23:51 +0200 Subject: [PATCH 1/2] implemented organization mapping --- .../eu/dnetlib/dhp/graph/ProtoConverter.java | 70 +++++++++++-------- .../dhp/graph/SparkGraphImporterJob.java | 11 +-- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/ProtoConverter.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/ProtoConverter.java index c27d819cc..8ecb5c999 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/ProtoConverter.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/ProtoConverter.java @@ -1,9 +1,6 @@ package eu.dnetlib.dhp.graph; -import eu.dnetlib.data.proto.DatasourceProtos; -import eu.dnetlib.data.proto.KindProtos; -import eu.dnetlib.data.proto.OafProtos; -import eu.dnetlib.data.proto.ProjectProtos; +import eu.dnetlib.data.proto.*; import eu.dnetlib.dhp.schema.oaf.*; import java.io.Serializable; @@ -61,21 +58,38 @@ public class ProtoConverter implements Serializable { } private static Organization convertOrganization(OafProtos.Oaf oaf) { - final DatasourceProtos.Datasource.Metadata m = oaf.getEntity().getDatasource().getMetadata(); + final OrganizationProtos.Organization.Metadata m = oaf.getEntity().getOrganization().getMetadata(); final Organization org = setOaf(new Organization(), oaf); - return setEntity(org, oaf); - - //TODO set org fields - } + 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())); + } 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())) + .stream() + .map(ProtoUtils::mapStringField) + .collect(Collectors.toList())) .setCertificates(mapStringField(m.getCertificates())) .setCitationguidelineurl(mapStringField(m.getCitationguidelineurl())) .setContactemail(mapStringField(m.getContactemail())) @@ -95,13 +109,13 @@ public class ProtoConverter implements Serializable { .setMissionstatementurl(mapStringField(m.getMissionstatementurl())) .setNamespaceprefix(mapStringField(m.getNamespaceprefix())) .setOdcontenttypes(m.getOdcontenttypesList() - .stream() - .map(ProtoUtils::mapStringField) - .collect(Collectors.toList())) + .stream() + .map(ProtoUtils::mapStringField) + .collect(Collectors.toList())) .setOdlanguages(m.getOdlanguagesList() - .stream() - .map(ProtoUtils::mapStringField) - .collect(Collectors.toList())) + .stream() + .map(ProtoUtils::mapStringField) + .collect(Collectors.toList())) .setOdnumberofitems(mapStringField(m.getOdnumberofitems())) .setOdnumberofitemsdate(mapStringField(m.getOdnumberofitemsdate())) .setOdpolicies(mapStringField(m.getOdpolicies())) @@ -109,17 +123,17 @@ public class ProtoConverter implements Serializable { .setOpenairecompatibility(mapQualifier(m.getOpenairecompatibility())) .setPidsystems(mapStringField(m.getPidsystems())) .setPolicies(m.getPoliciesList() - .stream() - .map(ProtoUtils::mapKV) - .collect(Collectors.toList())) + .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())) + .stream() + .map(ProtoUtils::mapStructuredProperty) + .collect(Collectors.toList())) .setVersioning(mapBoolField(m.getVersioning())) .setWebsiteurl(mapStringField(m.getWebsiteurl())) .setJournal(mapJournal(m.getJournal())); @@ -148,13 +162,13 @@ public class ProtoConverter implements Serializable { .setTotalcost(m.getTotalcost()) .setKeywords(mapStringField(m.getKeywords())) .setSubjects(m.getSubjectsList().stream() - .map(sp -> mapStructuredProperty(sp)) - .collect(Collectors.toList())) + .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())) + .map(f -> mapStringField(f)) + .collect(Collectors.toList())) .setJsonextrainfo(mapStringField(m.getJsonextrainfo())) .setSummary(mapStringField(m.getSummary())) .setOptional1(mapStringField(m.getOptional1())) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/SparkGraphImporterJob.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/SparkGraphImporterJob.java index f0edbc032..76bcc0cf9 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/SparkGraphImporterJob.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/graph/SparkGraphImporterJob.java @@ -3,6 +3,7 @@ package eu.dnetlib.dhp.graph; import eu.dnetlib.dhp.schema.oaf.Datasource; import eu.dnetlib.dhp.schema.oaf.Oaf; +import eu.dnetlib.dhp.schema.oaf.Organization; import eu.dnetlib.dhp.schema.oaf.Publication; import org.apache.hadoop.io.Text; import org.apache.spark.api.java.JavaRDD; @@ -42,14 +43,14 @@ public class SparkGraphImporterJob { - final JavaRDD datasources = inputRDD + final JavaRDD datasources = inputRDD .filter(s -> s._1().split("@")[2].equalsIgnoreCase("body")) .map(Tuple2::_2) .map(ProtoConverter::convert) - .filter(s-> s instanceof Datasource) - .map(s->(Datasource)s); - final Encoder encoder = Encoders.bean(Datasource.class); - final Dataset mdstore = spark.createDataset(datasources.rdd(), encoder); + .filter(s-> s instanceof Organization) + .map(s->(Organization)s); + final Encoder encoder = Encoders.bean(Organization.class); + final Dataset mdstore = spark.createDataset(datasources.rdd(), encoder); System.out.println(mdstore.count()); From 4eaff36ea61dbe714db9cfd387f48e5e1501dcf7 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Fri, 25 Oct 2019 10:55:35 +0200 Subject: [PATCH 2/2] a bit of syntactic sugar on the object inheritance --- .../eu/dnetlib/dhp/schema/oaf/Dataset.java | 7 +- .../eu/dnetlib/dhp/schema/oaf/Datasource.java | 7 +- .../java/eu/dnetlib/dhp/schema/oaf/Oaf.java | 12 +-- .../eu/dnetlib/dhp/schema/oaf/OafEntity.java | 35 ++++---- .../dnetlib/dhp/schema/oaf/Organization.java | 7 +- .../dhp/schema/oaf/OtherResearchProducts.java | 7 +- .../eu/dnetlib/dhp/schema/oaf/Project.java | 7 +- .../dnetlib/dhp/schema/oaf/Publication.java | 7 +- .../eu/dnetlib/dhp/schema/oaf/Relation.java | 17 ++-- .../eu/dnetlib/dhp/schema/oaf/Result.java | 86 +++++++++---------- .../eu/dnetlib/dhp/schema/oaf/Software.java | 7 +- 11 files changed, 120 insertions(+), 79 deletions(-) diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java index 25fd7e5d5..2b5562b4c 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public class Dataset extends Result implements Serializable { +public class Dataset extends Result implements Serializable { private Field storagedate; @@ -81,4 +81,9 @@ public class Dataset extends Result implements Serializable { this.geolocation = geolocation; return this; } + + @Override + protected Dataset self() { + return this; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java index 33e994d4a..ca261bec7 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public class Datasource extends OafEntity implements Serializable { +public class Datasource extends OafEntity implements Serializable { private Qualifier datasourcetype; @@ -396,4 +396,9 @@ public class Datasource extends OafEntity implements Serializable { this.journal = journal; return this; } + + @Override + protected Datasource self() { + return this; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java index 2924deaba..5d198c4e6 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java @@ -2,27 +2,29 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; -public abstract class Oaf implements Serializable { +public abstract class Oaf> implements Serializable { private DataInfo dataInfo; private Long lastupdatetimestamp; + protected abstract T self(); + public DataInfo getDataInfo() { return dataInfo; } - public Oaf setDataInfo(DataInfo dataInfo) { + public T setDataInfo(DataInfo dataInfo) { this.dataInfo = dataInfo; - return this; + return self(); } public Long getLastupdatetimestamp() { return lastupdatetimestamp; } - public Oaf setLastupdatetimestamp(Long lastupdatetimestamp) { + public T setLastupdatetimestamp(Long lastupdatetimestamp) { this.lastupdatetimestamp = lastupdatetimestamp; - return this; + return self(); } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java index f00d38583..5e5fdd70b 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OafEntity.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public abstract class OafEntity extends Oaf implements Serializable { +public abstract class OafEntity> extends Oaf implements Serializable { private String id; @@ -21,76 +21,75 @@ public abstract class OafEntity extends Oaf implements Serializable { private OAIProvenance oaiprovenance; - public String getId() { return id; } - public OafEntity setId(String id) { + public T setId(String id) { this.id = id; - return this; + return self(); } public List getOriginalId() { return originalId; } - public OafEntity setOriginalId(List originalId) { + public T setOriginalId(List originalId) { this.originalId = originalId; - return this; + return self(); } public List getCollectedfrom() { return collectedfrom; } - public OafEntity setCollectedfrom(List collectedfrom) { + public T setCollectedfrom(List collectedfrom) { this.collectedfrom = collectedfrom; - return this; + return self(); } public List getPid() { return pid; } - public OafEntity setPid(List pid) { + public T setPid(List pid) { this.pid = pid; - return this; + return self(); } public String getDateofcollection() { return dateofcollection; } - public OafEntity setDateofcollection(String dateofcollection) { + public T setDateofcollection(String dateofcollection) { this.dateofcollection = dateofcollection; - return this; + return self(); } public String getDateoftransformation() { return dateoftransformation; } - public OafEntity setDateoftransformation(String dateoftransformation) { + public T setDateoftransformation(String dateoftransformation) { this.dateoftransformation = dateoftransformation; - return this; + return self(); } public List getExtraInfo() { return extraInfo; } - public OafEntity setExtraInfo(List extraInfo) { + public T setExtraInfo(List extraInfo) { this.extraInfo = extraInfo; - return this; + return self(); } public OAIProvenance getOaiprovenance() { return oaiprovenance; } - public OafEntity setOaiprovenance(OAIProvenance oaiprovenance) { + public T setOaiprovenance(OAIProvenance oaiprovenance) { this.oaiprovenance = oaiprovenance; - return this; + return self(); } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Organization.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Organization.java index 260fc22b6..c03a78419 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Organization.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Organization.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public class Organization extends OafEntity implements Serializable { +public class Organization extends OafEntity implements Serializable { private Field legalshortname; @@ -180,4 +180,9 @@ public class Organization extends OafEntity implements Serializable { this.country = country; return this; } + + @Override + protected Organization self() { + return this; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OtherResearchProducts.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OtherResearchProducts.java index 3ca231587..3fdf1ae32 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OtherResearchProducts.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/OtherResearchProducts.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public class OtherResearchProducts extends Result implements Serializable { +public class OtherResearchProducts extends Result implements Serializable { private List> contactperson; @@ -37,4 +37,9 @@ public class OtherResearchProducts extends Result implements Serializable { this.tool = tool; return this; } + + @Override + protected OtherResearchProducts self() { + return this; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java index 5efe1526f..13e0b4431 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Project.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public class Project extends OafEntity implements Serializable { +public class Project extends OafEntity implements Serializable { private Field websiteurl; @@ -290,4 +290,9 @@ public class Project extends OafEntity implements Serializable { this.fundedamount = fundedamount; return this; } + + @Override + protected Project self() { + return this; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Publication.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Publication.java index bf4eab93c..29e1cb02f 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Publication.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Publication.java @@ -2,7 +2,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; -public class Publication extends Result implements Serializable { +public class Publication extends Result implements Serializable { // publication specific private Journal journal; @@ -15,4 +15,9 @@ public class Publication extends Result implements Serializable { this.journal = journal; return this; } + + @Override + protected Publication self() { + return self(); + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java index db8807e21..da1b4b439 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java @@ -2,7 +2,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.util.List; -public class Relation extends Oaf { +public class Relation extends Oaf { private String relType; @@ -22,7 +22,7 @@ public class Relation extends Oaf { public Relation setRelType(String relType) { this.relType = relType; - return this; + return self(); } public String getSubRelType() { @@ -31,7 +31,7 @@ public class Relation extends Oaf { public Relation setSubRelType(String subRelType) { this.subRelType = subRelType; - return this; + return self(); } public String getRelClass() { @@ -40,7 +40,7 @@ public class Relation extends Oaf { public Relation setRelClass(String relClass) { this.relClass = relClass; - return this; + return self(); } public String getSource() { @@ -49,7 +49,7 @@ public class Relation extends Oaf { public Relation setSource(String source) { this.source = source; - return this; + return self(); } public String getTarget() { @@ -58,7 +58,7 @@ public class Relation extends Oaf { public Relation setTarget(String target) { this.target = target; - return this; + return self(); } public List getCollectedFrom() { @@ -67,6 +67,11 @@ public class Relation extends Oaf { public Relation setCollectedFrom(List collectedFrom) { this.collectedFrom = collectedFrom; + return self(); + } + + @Override + protected Relation self() { return this; } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java index b0630825a..b496e9683 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public abstract class Result extends OafEntity implements Serializable { +public abstract class Result> extends OafEntity implements Serializable { private List author; @@ -53,188 +53,188 @@ public abstract class Result extends OafEntity implements Serializable { return author; } - public Result setAuthor(List author) { + public T setAuthor(List author) { this.author = author; - return this; + return self(); } public Qualifier getResulttype() { return resulttype; } - public Result setResulttype(Qualifier resulttype) { + public T setResulttype(Qualifier resulttype) { this.resulttype = resulttype; - return this; + return self(); } public Qualifier getLanguage() { return language; } - public Result setLanguage(Qualifier language) { + public T setLanguage(Qualifier language) { this.language = language; - return this; + return self(); } public List getCountry() { return country; } - public Result setCountry(List country) { + public T setCountry(List country) { this.country = country; - return this; + return self(); } public List getSubject() { return subject; } - public Result setSubject(List subject) { + public T setSubject(List subject) { this.subject = subject; - return this; + return self(); } public List getTitle() { return title; } - public Result setTitle(List title) { + public T setTitle(List title) { this.title = title; - return this; + return self(); } public List getRelevantdate() { return relevantdate; } - public Result setRelevantdate(List relevantdate) { + public T setRelevantdate(List relevantdate) { this.relevantdate = relevantdate; - return this; + return self(); } public List> getDescription() { return description; } - public Result setDescription(List> description) { + public T setDescription(List> description) { this.description = description; - return this; + return self(); } public Field getDateofacceptance() { return dateofacceptance; } - public Result setDateofacceptance(Field dateofacceptance) { + public T setDateofacceptance(Field dateofacceptance) { this.dateofacceptance = dateofacceptance; - return this; + return self(); } public Field getPublisher() { return publisher; } - public Result setPublisher(Field publisher) { + public T setPublisher(Field publisher) { this.publisher = publisher; - return this; + return self(); } public Field getEmbargoenddate() { return embargoenddate; } - public Result setEmbargoenddate(Field embargoenddate) { + public T setEmbargoenddate(Field embargoenddate) { this.embargoenddate = embargoenddate; - return this; + return self(); } public List> getSource() { return source; } - public Result setSource(List> source) { + public T setSource(List> source) { this.source = source; - return this; + return self(); } public List> getFulltext() { return fulltext; } - public Result setFulltext(List> fulltext) { + public T setFulltext(List> fulltext) { this.fulltext = fulltext; - return this; + return self(); } public List> getFormat() { return format; } - public Result setFormat(List> format) { + public T setFormat(List> format) { this.format = format; - return this; + return self(); } public List> getContributor() { return contributor; } - public Result setContributor(List> contributor) { + public T setContributor(List> contributor) { this.contributor = contributor; - return this; + return self(); } public Qualifier getResourcetype() { return resourcetype; } - public Result setResourcetype(Qualifier resourcetype) { + public T setResourcetype(Qualifier resourcetype) { this.resourcetype = resourcetype; - return this; + return self(); } public List> getCoverage() { return coverage; } - public Result setCoverage(List> coverage) { + public T setCoverage(List> coverage) { this.coverage = coverage; - return this; + return self(); } public Field getRefereed() { return refereed; } - public Result setRefereed(Field refereed) { + public T setRefereed(Field refereed) { this.refereed = refereed; - return this; + return self(); } public List getContext() { return context; } - public Result setContext(List context) { + public T setContext(List context) { this.context = context; - return this; + return self(); } public List getExternalReference() { return externalReference; } - public Result setExternalReference(List externalReference) { + public T setExternalReference(List externalReference) { this.externalReference = externalReference; - return this; + return self(); } public List getInstance() { return instance; } - public Result setInstance(List instance) { + public T setInstance(List instance) { this.instance = instance; - return this; + return self(); } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Software.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Software.java index 451efb99a..26c673d14 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Software.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Software.java @@ -3,7 +3,7 @@ package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; -public class Software extends Result implements Serializable { +public class Software extends Result implements Serializable { private List> documentationUrl; @@ -48,4 +48,9 @@ public class Software extends Result implements Serializable { this.programmingLanguage = programmingLanguage; return this; } + + @Override + protected Software self() { + return this; + } }