2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.schema.oaf;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
import static java.util.Objects.*;
|
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
import java.io.Serializable;
|
2022-01-13 14:50:18 +01:00
|
|
|
import java.util.*;
|
2021-04-23 12:15:36 +02:00
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
2022-02-04 12:52:12 +01:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-01-14 10:06:49 +01:00
|
|
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
2021-04-23 14:03:59 +02:00
|
|
|
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
|
2022-01-12 16:54:12 +01:00
|
|
|
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
2022-01-14 09:46:32 +01:00
|
|
|
import eu.dnetlib.dhp.schema.oaf.utils.CleaningFunctions;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The type Result.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public class Result extends OafEntity implements Serializable {
|
|
|
|
|
2022-02-04 12:52:12 +01:00
|
|
|
/**
|
|
|
|
* ( article | book ) processing charges.
|
|
|
|
*/
|
|
|
|
private Field<String> processingchargeamount;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* currency - alphabetic code describe in ISO-4217.
|
|
|
|
*/
|
|
|
|
private Field<String> processingchargecurrency;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Author.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Author> author;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Resulttype.
|
|
|
|
*/
|
|
|
|
// resulttype allows subclassing results into publications | datasets | software
|
2021-04-23 12:15:36 +02:00
|
|
|
private Qualifier resulttype;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
/**
|
|
|
|
* Temporary field suporting the analysis of the new COAR-based resource types
|
|
|
|
*/
|
|
|
|
private Qualifier metaResourceType;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Language.
|
|
|
|
*/
|
|
|
|
// common fields
|
2021-04-23 12:15:36 +02:00
|
|
|
private Qualifier language;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Country.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Country> country;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Subject.
|
|
|
|
*/
|
2022-08-04 14:55:43 +02:00
|
|
|
private List<Subject> subject;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Title.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<StructuredProperty> title;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Relevantdate.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<StructuredProperty> relevantdate;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Description.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Field<String>> description;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Dateofacceptance.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private Field<String> dateofacceptance;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Publisher.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private Field<String> publisher;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Embargoenddate.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private Field<String> embargoenddate;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Source.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Field<String>> source;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
2023-05-25 16:28:13 +02:00
|
|
|
* The list of direct fulltext URLs.
|
2022-01-13 14:50:18 +01:00
|
|
|
*/
|
2023-05-25 16:28:13 +02:00
|
|
|
private List<Field<String>> fulltext;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Format.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Field<String>> format;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Contributor.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Field<String>> contributor;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Resourcetype.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private Qualifier resourcetype;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Coverage.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Field<String>> coverage;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Bestaccessright.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private Qualifier bestaccessright;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The External reference.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<ExternalReference> externalReference;
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* The Instance.
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Instance> instance;
|
|
|
|
|
2022-07-13 11:11:22 +02:00
|
|
|
/**
|
|
|
|
* EOSC Interoperability Framework Guidelines
|
|
|
|
*/
|
|
|
|
private List<EoscIfGuidelines> eoscifguidelines;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
@JsonProperty("isGreen")
|
2023-10-13 09:08:00 +02:00
|
|
|
private Boolean isGreen;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
2023-10-13 09:08:00 +02:00
|
|
|
private OpenAccessColor openAccessColor;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
@JsonProperty("isInDiamondJournal")
|
2023-10-13 09:08:00 +02:00
|
|
|
private Boolean isInDiamondJournal;
|
|
|
|
|
|
|
|
private Boolean publiclyFunded;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
2024-01-29 16:28:14 +01:00
|
|
|
private String transformativeAgreement;
|
|
|
|
|
|
|
|
public String getTransformativeAgreement() {
|
|
|
|
return transformativeAgreement;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTransformativeAgreement(String transformativeAgreement) {
|
|
|
|
this.transformativeAgreement = transformativeAgreement;
|
|
|
|
}
|
|
|
|
|
2022-02-04 12:52:12 +01:00
|
|
|
public Field<String> getProcessingchargeamount() {
|
|
|
|
return processingchargeamount;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProcessingchargeamount(Field<String> processingchargeamount) {
|
|
|
|
this.processingchargeamount = processingchargeamount;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Field<String> getProcessingchargecurrency() {
|
|
|
|
return processingchargecurrency;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProcessingchargecurrency(Field<String> processingchargecurrency) {
|
|
|
|
this.processingchargecurrency = processingchargecurrency;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets author.
|
|
|
|
*
|
|
|
|
* @return the author
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Author> getAuthor() {
|
|
|
|
return author;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets author.
|
|
|
|
*
|
|
|
|
* @param author the author
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setAuthor(List<Author> author) {
|
|
|
|
this.author = author;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets resulttype.
|
|
|
|
*
|
|
|
|
* @return the resulttype
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Qualifier getResulttype() {
|
|
|
|
return resulttype;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets resulttype.
|
|
|
|
*
|
|
|
|
* @param resulttype the resulttype
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setResulttype(Qualifier resulttype) {
|
|
|
|
this.resulttype = resulttype;
|
|
|
|
}
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
public Qualifier getMetaResourceType() {
|
|
|
|
return metaResourceType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMetaResourceType(Qualifier metaResourceType) {
|
|
|
|
this.metaResourceType = metaResourceType;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets language.
|
|
|
|
*
|
|
|
|
* @return the language
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Qualifier getLanguage() {
|
|
|
|
return language;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets language.
|
|
|
|
*
|
|
|
|
* @param language the language
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setLanguage(Qualifier language) {
|
|
|
|
this.language = language;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets country.
|
|
|
|
*
|
|
|
|
* @return the country
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Country> getCountry() {
|
|
|
|
return country;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets country.
|
|
|
|
*
|
|
|
|
* @param country the country
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setCountry(List<Country> country) {
|
|
|
|
this.country = country;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets subject.
|
|
|
|
*
|
|
|
|
* @return the subject
|
|
|
|
*/
|
2022-08-04 14:55:43 +02:00
|
|
|
public List<Subject> getSubject() {
|
2021-04-23 12:15:36 +02:00
|
|
|
return subject;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets subject.
|
|
|
|
*
|
|
|
|
* @param subject the subject
|
|
|
|
*/
|
2022-08-04 14:55:43 +02:00
|
|
|
public void setSubject(List<Subject> subject) {
|
2021-04-23 12:15:36 +02:00
|
|
|
this.subject = subject;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets title.
|
|
|
|
*
|
|
|
|
* @return the title
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<StructuredProperty> getTitle() {
|
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets title.
|
|
|
|
*
|
|
|
|
* @param title the title
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setTitle(List<StructuredProperty> title) {
|
|
|
|
this.title = title;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets relevantdate.
|
|
|
|
*
|
|
|
|
* @return the relevantdate
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<StructuredProperty> getRelevantdate() {
|
|
|
|
return relevantdate;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets relevantdate.
|
|
|
|
*
|
|
|
|
* @param relevantdate the relevantdate
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setRelevantdate(List<StructuredProperty> relevantdate) {
|
|
|
|
this.relevantdate = relevantdate;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets description.
|
|
|
|
*
|
|
|
|
* @return the description
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Field<String>> getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets description.
|
|
|
|
*
|
|
|
|
* @param description the description
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setDescription(List<Field<String>> description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets dateofacceptance.
|
|
|
|
*
|
|
|
|
* @return the dateofacceptance
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Field<String> getDateofacceptance() {
|
|
|
|
return dateofacceptance;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets dateofacceptance.
|
|
|
|
*
|
|
|
|
* @param dateofacceptance the dateofacceptance
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setDateofacceptance(Field<String> dateofacceptance) {
|
|
|
|
this.dateofacceptance = dateofacceptance;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets publisher.
|
|
|
|
*
|
|
|
|
* @return the publisher
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Field<String> getPublisher() {
|
|
|
|
return publisher;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets publisher.
|
|
|
|
*
|
|
|
|
* @param publisher the publisher
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setPublisher(Field<String> publisher) {
|
|
|
|
this.publisher = publisher;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets embargoenddate.
|
|
|
|
*
|
|
|
|
* @return the embargoenddate
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Field<String> getEmbargoenddate() {
|
|
|
|
return embargoenddate;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets embargoenddate.
|
|
|
|
*
|
|
|
|
* @param embargoenddate the embargoenddate
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setEmbargoenddate(Field<String> embargoenddate) {
|
|
|
|
this.embargoenddate = embargoenddate;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets source.
|
|
|
|
*
|
|
|
|
* @return the source
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Field<String>> getSource() {
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets source.
|
|
|
|
*
|
|
|
|
* @param source the source
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setSource(List<Field<String>> source) {
|
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets fulltext.
|
|
|
|
*
|
|
|
|
* @return the fulltext
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Field<String>> getFulltext() {
|
|
|
|
return fulltext;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets fulltext.
|
|
|
|
*
|
|
|
|
* @param fulltext the fulltext
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setFulltext(List<Field<String>> fulltext) {
|
|
|
|
this.fulltext = fulltext;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets format.
|
|
|
|
*
|
|
|
|
* @return the format
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Field<String>> getFormat() {
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets format.
|
|
|
|
*
|
|
|
|
* @param format the format
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setFormat(List<Field<String>> format) {
|
|
|
|
this.format = format;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets contributor.
|
|
|
|
*
|
|
|
|
* @return the contributor
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Field<String>> getContributor() {
|
|
|
|
return contributor;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets contributor.
|
|
|
|
*
|
|
|
|
* @param contributor the contributor
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setContributor(List<Field<String>> contributor) {
|
|
|
|
this.contributor = contributor;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets resourcetype.
|
|
|
|
*
|
|
|
|
* @return the resourcetype
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Qualifier getResourcetype() {
|
|
|
|
return resourcetype;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets resourcetype.
|
|
|
|
*
|
|
|
|
* @param resourcetype the resourcetype
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setResourcetype(Qualifier resourcetype) {
|
|
|
|
this.resourcetype = resourcetype;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets coverage.
|
|
|
|
*
|
|
|
|
* @return the coverage
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Field<String>> getCoverage() {
|
|
|
|
return coverage;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets coverage.
|
|
|
|
*
|
|
|
|
* @param coverage the coverage
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setCoverage(List<Field<String>> coverage) {
|
|
|
|
this.coverage = coverage;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets bestaccessright.
|
|
|
|
*
|
|
|
|
* @return the bestaccessright
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public Qualifier getBestaccessright() {
|
|
|
|
return bestaccessright;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets bestaccessright.
|
|
|
|
*
|
|
|
|
* @param bestaccessright the bestaccessright
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setBestaccessright(Qualifier bestaccessright) {
|
|
|
|
this.bestaccessright = bestaccessright;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets external reference.
|
|
|
|
*
|
|
|
|
* @return the external reference
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<ExternalReference> getExternalReference() {
|
|
|
|
return externalReference;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets external reference.
|
|
|
|
*
|
|
|
|
* @param externalReference the external reference
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setExternalReference(List<ExternalReference> externalReference) {
|
|
|
|
this.externalReference = externalReference;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets instance.
|
|
|
|
*
|
|
|
|
* @return the instance
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public List<Instance> getInstance() {
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Sets instance.
|
|
|
|
*
|
|
|
|
* @param instance the instance
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
public void setInstance(List<Instance> instance) {
|
|
|
|
this.instance = instance;
|
|
|
|
}
|
|
|
|
|
2022-07-13 11:11:22 +02:00
|
|
|
public List<EoscIfGuidelines> getEoscifguidelines() {
|
|
|
|
return eoscifguidelines;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEoscifguidelines(List<EoscIfGuidelines> eoscifguidelines) {
|
|
|
|
this.eoscifguidelines = eoscifguidelines;
|
|
|
|
}
|
2022-01-12 16:54:12 +01:00
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
public Boolean getIsGreen() {
|
2023-10-13 09:08:00 +02:00
|
|
|
return isGreen;
|
|
|
|
}
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
public void setIsGreen(Boolean green) {
|
2023-10-13 09:08:00 +02:00
|
|
|
isGreen = green;
|
|
|
|
}
|
|
|
|
|
|
|
|
public OpenAccessColor getOpenAccessColor() {
|
|
|
|
return openAccessColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOpenAccessColor(OpenAccessColor openAccessColor) {
|
|
|
|
this.openAccessColor = openAccessColor;
|
|
|
|
}
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
public Boolean getIsInDiamondJournal() {
|
2023-10-13 09:08:00 +02:00
|
|
|
return isInDiamondJournal;
|
|
|
|
}
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
public void setIsInDiamondJournal(Boolean inDiamondJournal) {
|
2023-10-13 09:08:00 +02:00
|
|
|
isInDiamondJournal = inDiamondJournal;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Boolean getPubliclyFunded() {
|
|
|
|
return publiclyFunded;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPubliclyFunded(Boolean publiclyFunded) {
|
|
|
|
this.publiclyFunded = publiclyFunded;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Is an enrichment boolean.
|
|
|
|
*
|
|
|
|
* @param e the e
|
|
|
|
* @return the boolean
|
|
|
|
*/
|
|
|
|
public static boolean isAnEnrichment(OafEntity e) {
|
2022-01-12 16:54:12 +01:00
|
|
|
return e.getDataInfo()!= null &&
|
|
|
|
e.getDataInfo().getProvenanceaction()!= null
|
|
|
|
&& ModelConstants.PROVENANCE_ENRICH.equalsIgnoreCase(e.getDataInfo().getProvenanceaction().getClassid());
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Normalize pid string.
|
|
|
|
*
|
|
|
|
* @param pid the pid
|
|
|
|
* @return the string
|
|
|
|
*/
|
2022-01-14 09:46:32 +01:00
|
|
|
private static String extractKeyFromPid(final StructuredProperty pid) {
|
|
|
|
if (pid == null)
|
|
|
|
return null;
|
|
|
|
final StructuredProperty normalizedPid = CleaningFunctions.normalizePidValue(pid);
|
|
|
|
|
|
|
|
return String.format("%s::%s", normalizedPid.getQualifier().getClassid(), normalizedPid.getValue());
|
2022-01-13 14:50:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Valid pid boolean.
|
|
|
|
*
|
|
|
|
* @param p the p
|
|
|
|
* @return the boolean
|
|
|
|
*/
|
|
|
|
private static boolean validPid(final StructuredProperty p) {
|
|
|
|
return p.getValue()!= null && p.getQualifier()!= null && p.getQualifier().getClassid()!=null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method converts the list of instance enrichments
|
|
|
|
* into a Map where the key is the normalized identifier
|
|
|
|
* and the value is the instance itself
|
|
|
|
*
|
|
|
|
* @param ri the list of enrichment instances
|
|
|
|
* @return the result map
|
|
|
|
*/
|
|
|
|
public static Map<String, Instance> toInstanceMap(final List<Instance> ri) {
|
2022-01-14 10:06:49 +01:00
|
|
|
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
return ri
|
|
|
|
.stream()
|
|
|
|
.filter(i -> i.getPid() != null || i.getAlternateIdentifier() != null)
|
|
|
|
.flatMap(i -> {
|
2022-01-14 10:06:49 +01:00
|
|
|
final List<Pair<String, Instance>> result = new ArrayList<>();
|
2022-01-13 14:50:18 +01:00
|
|
|
if (i.getPid() != null)
|
2022-01-14 10:06:49 +01:00
|
|
|
i.getPid().stream().filter(Result::validPid).forEach(p -> result.add(new ImmutablePair<>(extractKeyFromPid(p), i)));
|
2022-01-13 14:50:18 +01:00
|
|
|
if (i.getAlternateIdentifier() != null)
|
2022-01-14 10:06:49 +01:00
|
|
|
i.getAlternateIdentifier().stream().filter(Result::validPid).forEach(p -> result.add(new ImmutablePair<>(extractKeyFromPid(p), i)));
|
2022-01-13 14:50:18 +01:00
|
|
|
return result.stream();
|
|
|
|
}).collect(Collectors.toMap(
|
2022-01-14 10:06:49 +01:00
|
|
|
Pair::getLeft,
|
|
|
|
Pair::getRight,
|
2022-01-13 14:50:18 +01:00
|
|
|
(a, b) -> a
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This utility method finds the list of enrichment instances
|
|
|
|
* that match one or more PIDs in the input list
|
|
|
|
*
|
|
|
|
* @param pids the list of PIDs
|
|
|
|
* @param enrichments the List of enrichment instances having the same pid
|
|
|
|
* @return the list
|
|
|
|
*/
|
|
|
|
private static List<Instance> findEnrichmentsByPID(final List<StructuredProperty> pids, final Map<String,Instance> enrichments) {
|
|
|
|
if (pids == null || enrichments == null)
|
|
|
|
return null;
|
|
|
|
return pids
|
|
|
|
.stream()
|
2022-01-14 09:46:32 +01:00
|
|
|
.map(Result::extractKeyFromPid)
|
2022-01-13 14:50:18 +01:00
|
|
|
.map(enrichments::get)
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method apply enrichment on a single instance
|
|
|
|
* The enrichment consists of replacing values on
|
|
|
|
* single attribute only if in the current instance is missing
|
|
|
|
* The only repeatable field enriched is measures
|
|
|
|
*
|
|
|
|
* @param currentInstance the current instance
|
|
|
|
* @param enrichment the enrichment instance
|
|
|
|
*/
|
|
|
|
private static void applyEnrichment(final Instance currentInstance, final Instance enrichment) {
|
|
|
|
if (currentInstance == null || enrichment == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
//ENRICH accessright
|
|
|
|
if (enrichment.getAccessright()!=null && currentInstance.getAccessright() == null)
|
|
|
|
currentInstance.setAccessright(enrichment.getAccessright());
|
|
|
|
|
|
|
|
//ENRICH license
|
|
|
|
if (enrichment.getLicense()!=null && currentInstance.getLicense() == null)
|
|
|
|
currentInstance.setLicense(enrichment.getLicense());
|
|
|
|
|
|
|
|
//ENRICH instanceType
|
|
|
|
if (enrichment.getInstancetype()!=null && currentInstance.getInstancetype() == null)
|
|
|
|
currentInstance.setInstancetype(enrichment.getInstancetype());
|
|
|
|
|
|
|
|
//ENRICH hostedby
|
|
|
|
if (enrichment.getHostedby()!=null && currentInstance.getHostedby() == null)
|
|
|
|
currentInstance.setHostedby(enrichment.getHostedby());
|
|
|
|
|
|
|
|
//ENRICH distributionlocation
|
|
|
|
if (enrichment.getDistributionlocation()!=null && currentInstance.getDistributionlocation() == null)
|
|
|
|
currentInstance.setDistributionlocation(enrichment.getDistributionlocation());
|
|
|
|
|
|
|
|
//ENRICH collectedfrom
|
|
|
|
if (enrichment.getCollectedfrom()!=null && currentInstance.getCollectedfrom() == null)
|
|
|
|
currentInstance.setCollectedfrom(enrichment.getCollectedfrom());
|
|
|
|
|
|
|
|
//ENRICH dateofacceptance
|
|
|
|
if (enrichment.getDateofacceptance()!=null && currentInstance.getDateofacceptance() == null)
|
|
|
|
currentInstance.setDateofacceptance(enrichment.getDateofacceptance());
|
|
|
|
|
|
|
|
//ENRICH processingchargeamount
|
|
|
|
if (enrichment.getProcessingchargeamount()!=null && currentInstance.getProcessingchargeamount() == null)
|
|
|
|
currentInstance.setProcessingchargeamount(enrichment.getProcessingchargeamount());
|
|
|
|
|
|
|
|
//ENRICH refereed
|
|
|
|
if (enrichment.getRefereed()!=null && currentInstance.getRefereed() == null)
|
|
|
|
currentInstance.setRefereed(enrichment.getRefereed());
|
|
|
|
|
|
|
|
//ENRICH measures
|
|
|
|
if (enrichment.getMeasures()!=null)
|
2023-10-13 09:08:00 +02:00
|
|
|
if (currentInstance.getMeasures() == null) {
|
2022-01-13 14:50:18 +01:00
|
|
|
currentInstance.setMeasures(enrichment.getMeasures());
|
2023-10-13 09:08:00 +02:00
|
|
|
} else {
|
2022-01-13 14:50:18 +01:00
|
|
|
enrichment.getMeasures().forEach(currentInstance.getMeasures()::add);
|
2023-10-13 09:08:00 +02:00
|
|
|
}
|
2022-01-13 14:50:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This main method apply the enrichment of the instances
|
|
|
|
*
|
|
|
|
* @param toEnrichInstances the instances that could be enriched
|
|
|
|
* @param enrichmentInstances the enrichment instances
|
|
|
|
* @return list of instances possibly enriched
|
|
|
|
*/
|
|
|
|
private static List<Instance> enrichInstances(final List<Instance> toEnrichInstances,final List<Instance> enrichmentInstances) {
|
|
|
|
final List<Instance> enrichmentResult = new ArrayList<>();
|
|
|
|
|
|
|
|
if (toEnrichInstances == null) {
|
|
|
|
return enrichmentResult;
|
|
|
|
}
|
|
|
|
if (enrichmentInstances == null) {
|
2023-10-20 14:33:03 +02:00
|
|
|
return toEnrichInstances;
|
2022-01-13 14:50:18 +01:00
|
|
|
}
|
|
|
|
Map<String, Instance> ri = toInstanceMap(enrichmentInstances);
|
|
|
|
|
|
|
|
toEnrichInstances.forEach(i -> {
|
|
|
|
final List<Instance> e = findEnrichmentsByPID(i.getPid(), ri);
|
2023-10-13 09:08:00 +02:00
|
|
|
if (e!= null && !e.isEmpty()) {
|
2022-01-13 14:50:18 +01:00
|
|
|
e.forEach(enr -> applyEnrichment(i, enr));
|
|
|
|
} else {
|
|
|
|
final List<Instance> a = findEnrichmentsByPID(i.getAlternateIdentifier(), ri);
|
2023-10-13 09:08:00 +02:00
|
|
|
if (a!= null && !a.isEmpty()) {
|
2022-01-13 14:50:18 +01:00
|
|
|
a.forEach(enr -> applyEnrichment(i, enr));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
enrichmentResult.add(i);
|
|
|
|
});
|
|
|
|
return enrichmentResult;
|
|
|
|
}
|
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
@Override
|
|
|
|
public void mergeFrom(OafEntity e) {
|
|
|
|
super.mergeFrom(e);
|
|
|
|
|
|
|
|
if (!Result.class.isAssignableFrom(e.getClass())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Result r = (Result) e;
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
if(processingchargeamount == null || StringUtils.isBlank(processingchargeamount.getValue())){
|
2022-02-04 12:52:12 +01:00
|
|
|
processingchargeamount = r.getProcessingchargeamount();
|
|
|
|
processingchargecurrency = r.getProcessingchargecurrency();
|
|
|
|
}
|
|
|
|
|
2024-01-29 16:28:14 +01:00
|
|
|
if (Objects.isNull(getTransformativeAgreement()) && Objects.nonNull(r.getTransformativeAgreement())) {
|
|
|
|
setTransformativeAgreement(r.getTransformativeAgreement());
|
|
|
|
}
|
|
|
|
|
2022-07-13 11:11:22 +02:00
|
|
|
eoscifguidelines = mergeLists(eoscifguidelines, r.getEoscifguidelines());
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
setIsGreen(mergeBooleanOR(getIsGreen(), r.getIsGreen()));
|
|
|
|
|
|
|
|
setIsInDiamondJournal(mergeBooleanOR(getIsInDiamondJournal(), r.getIsInDiamondJournal()));
|
|
|
|
|
|
|
|
setPubliclyFunded(mergeBooleanOR(getPubliclyFunded(), r.getPubliclyFunded()));
|
|
|
|
|
|
|
|
if (Boolean.logicalXor(nonNull(getOpenAccessColor()), nonNull(r.getOpenAccessColor()))) {
|
|
|
|
setOpenAccessColor(ObjectUtils.firstNonNull(getOpenAccessColor(), r.getOpenAccessColor()));
|
|
|
|
} else if (!Objects.equals(getOpenAccessColor(), r.getOpenAccessColor())) {
|
|
|
|
setOpenAccessColor(null);
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
if( !isAnEnrichment(this) && !isAnEnrichment(e))
|
|
|
|
instance = mergeLists(instance, r.getInstance());
|
|
|
|
else {
|
|
|
|
final List<Instance> enrichmentInstances = isAnEnrichment(this) ? instance : r.getInstance();
|
|
|
|
final List<Instance> enrichedInstances= isAnEnrichment(this) ? r.getInstance(): instance;
|
|
|
|
if (isAnEnrichment(this))
|
|
|
|
setDataInfo(e.getDataInfo());
|
|
|
|
instance = enrichInstances(enrichedInstances,enrichmentInstances);
|
|
|
|
}
|
2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
if (r.getBestaccessright() != null
|
2021-04-23 14:03:59 +02:00
|
|
|
&& new AccessRightComparator().compare(r.getBestaccessright(), bestaccessright) < 0)
|
2021-04-23 12:15:36 +02:00
|
|
|
bestaccessright = r.getBestaccessright();
|
|
|
|
|
|
|
|
if (r.getResulttype() != null && compareTrust(this, r) < 0)
|
|
|
|
resulttype = r.getResulttype();
|
|
|
|
|
|
|
|
if (r.getLanguage() != null && compareTrust(this, r) < 0)
|
|
|
|
language = r.getLanguage();
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
if (nonNull(r.getDateofacceptance())) {
|
|
|
|
if (isNull(getDateofacceptance())) {
|
2021-06-18 09:58:30 +02:00
|
|
|
dateofacceptance = r.getDateofacceptance();
|
|
|
|
} else if (compareTrust(this, r) < 0) {
|
|
|
|
dateofacceptance = r.getDateofacceptance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
country = mergeLists(country, r.getCountry());
|
|
|
|
|
|
|
|
subject = mergeLists(subject, r.getSubject());
|
|
|
|
|
|
|
|
// merge title lists: main title with higher trust and distinct between the others
|
|
|
|
StructuredProperty baseMainTitle = null;
|
|
|
|
if (title != null) {
|
|
|
|
baseMainTitle = getMainTitle(title);
|
|
|
|
if (baseMainTitle != null) {
|
|
|
|
final StructuredProperty p = baseMainTitle;
|
|
|
|
title = title.stream().filter(t -> t != p).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StructuredProperty newMainTitle = null;
|
|
|
|
if (r.getTitle() != null) {
|
|
|
|
newMainTitle = getMainTitle(r.getTitle());
|
|
|
|
if (newMainTitle != null) {
|
|
|
|
final StructuredProperty p = newMainTitle;
|
|
|
|
r.setTitle(r.getTitle().stream().filter(t -> t != p).collect(Collectors.toList()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newMainTitle != null && compareTrust(this, r) < 0) {
|
|
|
|
baseMainTitle = newMainTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
title = mergeLists(title, r.getTitle());
|
|
|
|
if (title != null && baseMainTitle != null) {
|
|
|
|
title.add(baseMainTitle);
|
|
|
|
}
|
|
|
|
|
|
|
|
relevantdate = mergeLists(relevantdate, r.getRelevantdate());
|
|
|
|
|
|
|
|
description = longestLists(description, r.getDescription());
|
|
|
|
|
|
|
|
if (r.getPublisher() != null && compareTrust(this, r) < 0)
|
|
|
|
publisher = r.getPublisher();
|
|
|
|
|
|
|
|
if (r.getEmbargoenddate() != null && compareTrust(this, r) < 0)
|
|
|
|
embargoenddate = r.getEmbargoenddate();
|
|
|
|
|
|
|
|
source = mergeLists(source, r.getSource());
|
|
|
|
|
|
|
|
fulltext = mergeLists(fulltext, r.getFulltext());
|
|
|
|
|
|
|
|
format = mergeLists(format, r.getFormat());
|
|
|
|
|
|
|
|
contributor = mergeLists(contributor, r.getContributor());
|
|
|
|
|
|
|
|
if (r.getResourcetype() != null)
|
|
|
|
resourcetype = r.getResourcetype();
|
|
|
|
|
|
|
|
coverage = mergeLists(coverage, r.getCoverage());
|
|
|
|
|
|
|
|
externalReference = mergeLists(externalReference, r.getExternalReference());
|
|
|
|
}
|
|
|
|
|
2023-10-16 12:59:29 +02:00
|
|
|
private Boolean mergeBooleanOR(Boolean a, Boolean b) {
|
|
|
|
if (Boolean.logicalXor(isNull(a), isNull(b))) {
|
|
|
|
return ObjectUtils.firstNonNull(a, b);
|
|
|
|
} else if (nonNull(a) & nonNull(b)) {
|
|
|
|
return a || b;
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Longest lists list.
|
|
|
|
*
|
|
|
|
* @param a the a
|
|
|
|
* @param b the b
|
|
|
|
* @return the list
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private List<Field<String>> longestLists(List<Field<String>> a, List<Field<String>> b) {
|
|
|
|
if (a == null || b == null)
|
|
|
|
return a == null ? b : a;
|
|
|
|
if (a.size() == b.size()) {
|
|
|
|
int msa = a
|
|
|
|
.stream()
|
|
|
|
.filter(i -> i != null && i.getValue() != null)
|
|
|
|
.map(i -> i.getValue().length())
|
|
|
|
.max(Comparator.naturalOrder())
|
|
|
|
.orElse(0);
|
|
|
|
int msb = b
|
|
|
|
.stream()
|
|
|
|
.filter(i -> i != null && i.getValue() != null)
|
|
|
|
.map(i -> i.getValue().length())
|
|
|
|
.max(Comparator.naturalOrder())
|
|
|
|
.orElse(0);
|
|
|
|
return msa > msb ? a : b;
|
|
|
|
}
|
|
|
|
return a.size() > b.size() ? a : b;
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:50:18 +01:00
|
|
|
/**
|
|
|
|
* Gets main title.
|
|
|
|
*
|
|
|
|
* @param titles the titles
|
|
|
|
* @return the main title
|
|
|
|
*/
|
2021-04-23 12:15:36 +02:00
|
|
|
private StructuredProperty getMainTitle(List<StructuredProperty> titles) {
|
|
|
|
// need to check if the list of titles contains more than 1 main title? (in that case, we should chose which
|
|
|
|
// main title select in the list)
|
2021-08-10 09:36:37 +02:00
|
|
|
for (StructuredProperty t : titles) {
|
|
|
|
if (t.getQualifier() != null && t.getQualifier().getClassid() != null)
|
|
|
|
if (t.getQualifier().getClassid().equals("main title"))
|
|
|
|
return t;
|
2021-04-23 12:15:36 +02:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|