2019-10-24 11:39:41 +02:00
|
|
|
package eu.dnetlib.dhp.schema.oaf;
|
|
|
|
|
2019-12-10 14:57:16 +01:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
import java.io.Serializable;
|
2019-12-11 16:57:37 +01:00
|
|
|
import java.util.*;
|
2019-12-11 15:43:24 +01:00
|
|
|
import java.util.stream.Collectors;
|
2019-10-24 11:39:41 +02:00
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public abstract class Result extends OafEntity implements Serializable {
|
2019-10-24 11:39:41 +02:00
|
|
|
|
|
|
|
private List<Author> author;
|
|
|
|
|
|
|
|
// resulttype allows subclassing results into publications | datasets | software
|
|
|
|
private Qualifier resulttype;
|
|
|
|
|
|
|
|
// common fields
|
|
|
|
private Qualifier language;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<Qualifier> country;
|
|
|
|
|
|
|
|
private List<StructuredProperty> subject;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<StructuredProperty> title;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<StructuredProperty> relevantdate;
|
|
|
|
|
|
|
|
private List<Field<String>> description;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private Field<String> dateofacceptance;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private Field<String> publisher;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private Field<String> embargoenddate;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<Field<String>> source;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<Field<String>> fulltext; // remove candidate
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<Field<String>> format;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<Field<String>> contributor;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private Qualifier resourcetype;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<Field<String>> coverage;
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private Field<String> refereed; //peer-review status
|
|
|
|
|
|
|
|
private List<Context> context;
|
|
|
|
|
2019-11-14 15:42:52 +01:00
|
|
|
// ( article | book ) processing charges. Defined here to cope with possible wrongly typed results
|
|
|
|
private Field<String> processingchargeamount;
|
|
|
|
|
|
|
|
// currency - alphabetic code describe in ISO-4217. Defined here to cope with possible wrongly typed results
|
|
|
|
private Field<String> processingchargecurrency;
|
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
private List<ExternalReference> externalReference;
|
|
|
|
|
|
|
|
private List<Instance> instance;
|
|
|
|
|
|
|
|
public List<Author> getAuthor() {
|
|
|
|
return author;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setAuthor(List<Author> author) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.author = author;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Qualifier getResulttype() {
|
|
|
|
return resulttype;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setResulttype(Qualifier resulttype) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.resulttype = resulttype;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Qualifier getLanguage() {
|
|
|
|
return language;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setLanguage(Qualifier language) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.language = language;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Qualifier> getCountry() {
|
|
|
|
return country;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setCountry(List<Qualifier> country) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.country = country;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<StructuredProperty> getSubject() {
|
|
|
|
return subject;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setSubject(List<StructuredProperty> subject) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.subject = subject;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<StructuredProperty> getTitle() {
|
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setTitle(List<StructuredProperty> title) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.title = title;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<StructuredProperty> getRelevantdate() {
|
|
|
|
return relevantdate;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setRelevantdate(List<StructuredProperty> relevantdate) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.relevantdate = relevantdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Field<String>> getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setDescription(List<Field<String>> description) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Field<String> getDateofacceptance() {
|
|
|
|
return dateofacceptance;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setDateofacceptance(Field<String> dateofacceptance) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.dateofacceptance = dateofacceptance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Field<String> getPublisher() {
|
|
|
|
return publisher;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setPublisher(Field<String> publisher) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.publisher = publisher;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Field<String> getEmbargoenddate() {
|
|
|
|
return embargoenddate;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setEmbargoenddate(Field<String> embargoenddate) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.embargoenddate = embargoenddate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Field<String>> getSource() {
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setSource(List<Field<String>> source) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Field<String>> getFulltext() {
|
|
|
|
return fulltext;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setFulltext(List<Field<String>> fulltext) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.fulltext = fulltext;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Field<String>> getFormat() {
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setFormat(List<Field<String>> format) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.format = format;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Field<String>> getContributor() {
|
|
|
|
return contributor;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setContributor(List<Field<String>> contributor) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.contributor = contributor;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Qualifier getResourcetype() {
|
|
|
|
return resourcetype;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setResourcetype(Qualifier resourcetype) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.resourcetype = resourcetype;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Field<String>> getCoverage() {
|
|
|
|
return coverage;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setCoverage(List<Field<String>> coverage) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.coverage = coverage;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Field<String> getRefereed() {
|
|
|
|
return refereed;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setRefereed(Field<String> refereed) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.refereed = refereed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Context> getContext() {
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setContext(List<Context> context) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.context = context;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<ExternalReference> getExternalReference() {
|
|
|
|
return externalReference;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setExternalReference(List<ExternalReference> externalReference) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.externalReference = externalReference;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Instance> getInstance() {
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2019-10-25 18:10:30 +02:00
|
|
|
public void setInstance(List<Instance> instance) {
|
2019-10-24 11:39:41 +02:00
|
|
|
this.instance = instance;
|
|
|
|
}
|
2019-11-14 15:42:52 +01:00
|
|
|
|
|
|
|
public Field<String> getProcessingchargeamount() {
|
|
|
|
return processingchargeamount;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Result setProcessingchargeamount(Field<String> processingchargeamount) {
|
|
|
|
this.processingchargeamount = processingchargeamount;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Field<String> getProcessingchargecurrency() {
|
|
|
|
return processingchargecurrency;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Result setProcessingchargecurrency(Field<String> processingchargecurrency) {
|
|
|
|
this.processingchargecurrency = processingchargecurrency;
|
|
|
|
return this;
|
|
|
|
}
|
2019-12-10 14:57:16 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void mergeFrom(OafEntity e) {
|
|
|
|
super.mergeFrom(e);
|
|
|
|
|
|
|
|
Result r = (Result) e;
|
|
|
|
|
2019-12-11 15:43:24 +01:00
|
|
|
instance = mergeLists(instance, r.getInstance());
|
2019-12-10 14:57:16 +01:00
|
|
|
|
|
|
|
if (r.getResulttype() != null)
|
|
|
|
resulttype = r.getResulttype();
|
|
|
|
|
|
|
|
if (r.getLanguage() != null)
|
|
|
|
language = r.getLanguage();
|
|
|
|
|
|
|
|
country = mergeLists(country, r.getCountry());
|
|
|
|
|
|
|
|
subject = mergeLists(subject, r.getSubject());
|
|
|
|
|
|
|
|
title = mergeLists(title, r.getTitle());
|
|
|
|
|
|
|
|
relevantdate = mergeLists(relevantdate, r.getRelevantdate());
|
|
|
|
|
2019-12-11 16:57:37 +01:00
|
|
|
description = longestLists(description, r.getDescription());
|
2019-12-10 14:57:16 +01:00
|
|
|
|
|
|
|
if (r.getPublisher() != null)
|
|
|
|
publisher = r.getPublisher();
|
|
|
|
|
|
|
|
if (r.getEmbargoenddate() != null)
|
|
|
|
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());
|
|
|
|
|
|
|
|
if (r.getRefereed() != null)
|
|
|
|
refereed = r.getRefereed();
|
|
|
|
|
|
|
|
context = mergeLists(context, r.getContext());
|
|
|
|
|
|
|
|
if (r.getProcessingchargeamount() != null)
|
|
|
|
processingchargeamount = r.getProcessingchargeamount();
|
|
|
|
|
|
|
|
if (r.getProcessingchargecurrency() != null)
|
|
|
|
processingchargecurrency = r.getProcessingchargecurrency();
|
|
|
|
|
|
|
|
externalReference = mergeLists(externalReference, r.getExternalReference());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-12-11 16:57:37 +01: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.getValue() != null).map(i -> i.getValue().length()).max(Comparator.naturalOrder()).orElse(0);
|
|
|
|
int msb = b.stream().filter(i -> 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;
|
|
|
|
}
|
|
|
|
|
2019-12-10 14:57:16 +01:00
|
|
|
|
2019-10-24 11:39:41 +02:00
|
|
|
}
|