Merge branch 'master' into dump_extention

This commit is contained in:
Claudio Atzori 2021-10-01 11:05:27 +02:00
commit db21240a3f
37 changed files with 227 additions and 126 deletions

View File

@ -5,7 +5,7 @@
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId> <artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.7.17-SNAPSHOT</version> <version>2.7.19-SNAPSHOT</version>
<licenses> <licenses>
<license> <license>

View File

@ -4,7 +4,6 @@ package eu.dnetlib.dhp.schema.action;
import java.io.IOException; import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@ -12,10 +11,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.Oaf; import eu.dnetlib.dhp.schema.oaf.Oaf;
public class AtomicActionDeserializer extends JsonDeserializer { public class AtomicActionDeserializer<T extends Oaf> extends JsonDeserializer<AtomicAction<T>> {
@Override @Override
public Object deserialize(JsonParser jp, DeserializationContext ctxt) @SuppressWarnings("unchecked")
public AtomicAction<T> deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException { throws IOException {
JsonNode node = jp.getCodec().readTree(jp); JsonNode node = jp.getCodec().readTree(jp);
String classTag = node.get("clazz").asText(); String classTag = node.get("clazz").asText();
@ -23,8 +23,9 @@ public class AtomicActionDeserializer extends JsonDeserializer {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
final Class<?> clazz = Class.forName(classTag); final Class<T> clazz = (Class<T>) Class.forName(classTag);
return new AtomicAction(clazz, (Oaf) mapper.readValue(payload.toString(), clazz)); final T oaf = mapper.readValue(payload.toString(), clazz);
return new AtomicAction(clazz, oaf);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IOException(e); throw new IOException(e);
} }

View File

@ -3,7 +3,6 @@ package eu.dnetlib.dhp.schema.common;
import java.util.Comparator; import java.util.Comparator;
import eu.dnetlib.dhp.schema.oaf.AccessRight;
import eu.dnetlib.dhp.schema.oaf.Qualifier; import eu.dnetlib.dhp.schema.oaf.Qualifier;
public class AccessRightComparator<T extends Qualifier> implements Comparator<T> { public class AccessRightComparator<T extends Qualifier> implements Comparator<T> {

View File

@ -8,6 +8,8 @@ import eu.dnetlib.dhp.schema.oaf.Qualifier;
public class ModelConstants { public class ModelConstants {
private ModelConstants() {}
public static final String ORCID = "orcid"; public static final String ORCID = "orcid";
public static final String ORCID_PENDING = "orcid_pending"; public static final String ORCID_PENDING = "orcid_pending";
public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID"; public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID";
@ -25,6 +27,9 @@ public class ModelConstants {
public static final String OPENORGS_NAME = "OpenOrgs Database"; public static final String OPENORGS_NAME = "OpenOrgs Database";
public static final String OPENOCITATIONS_NAME = "OpenCitations";
public static final String OPENOCITATIONS_ID = "10|openaire____::c06df618c5de1c786535ccf3f8b7b059";
// VOCABULARY VALUE // VOCABULARY VALUE
public static final String ACCESS_RIGHT_OPEN = "OPEN"; public static final String ACCESS_RIGHT_OPEN = "OPEN";
public static final String ACCESS_RIGHT_EMBARGO = "EMBARGO"; public static final String ACCESS_RIGHT_EMBARGO = "EMBARGO";
@ -45,6 +50,9 @@ public class ModelConstants {
public static final String DNET_REVIEW_LEVELS = "dnet:review_levels"; public static final String DNET_REVIEW_LEVELS = "dnet:review_levels";
public static final String DNET_PROGRAMMING_LANGUAGES = "dnet:programming_languages"; public static final String DNET_PROGRAMMING_LANGUAGES = "dnet:programming_languages";
public static final String DNET_EXTERNAL_REFERENCE_TYPE = "dnet:externalReference_typologies"; public static final String DNET_EXTERNAL_REFERENCE_TYPE = "dnet:externalReference_typologies";
public static final String DNET_RELATION_RELTYPE = "dnet:relation_relType";
public static final String DNET_RELATION_SUBRELTYPE = "dnet:relation_subRelType";
public static final String DNET_RELATION_RELCLASS = "dnet:relation_relClass";
public static final String SYSIMPORT_CROSSWALK_REPOSITORY = "sysimport:crosswalk:repository"; public static final String SYSIMPORT_CROSSWALK_REPOSITORY = "sysimport:crosswalk:repository";
public static final String SYSIMPORT_CROSSWALK_ENTITYREGISTRY = "sysimport:crosswalk:entityregistry"; public static final String SYSIMPORT_CROSSWALK_ENTITYREGISTRY = "sysimport:crosswalk:entityregistry";

View File

@ -7,13 +7,14 @@ import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.ParseException; import java.text.ParseException;
import java.time.format.DateTimeParseException; import java.util.Date;
import java.util.*; import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import com.github.sisyphsu.dateparser.DateParserUtils; import com.github.sisyphsu.dateparser.DateParserUtils;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;

View File

@ -2,7 +2,6 @@
package eu.dnetlib.dhp.schema.dump.oaf; package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* Used to represent the generic author of the result. It has six parameters: - name of type String to store the given * Used to represent the generic author of the result. It has six parameters: - name of type String to store the given

View File

@ -2,7 +2,6 @@
package eu.dnetlib.dhp.schema.dump.oaf; package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
/** /**
* To store information about the conference or journal where the result has been presented or published. It contains * To store information about the conference or journal where the result has been presented or published. It contains

View File

@ -3,10 +3,6 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
/** /**
* To represent the information described by a code and a value It has two parameters: - code to store the code * To represent the information described by a code and a value It has two parameters: - code to store the code
* (generally the classid of the eu.dnetlib.dhp.schema.oaf.Qualifier element) - label to store the label (generally the * (generally the classid of the eu.dnetlib.dhp.schema.oaf.Qualifier element) - label to store the label (generally the

View File

@ -4,8 +4,6 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.dump.oaf.community.Project;
/** /**
* To represent the dumped result. It will be extended in the dump for Research Communities - Research * To represent the dumped result. It will be extended in the dump for Research Communities - Research
* Initiative/Infrastructures. It has the following parameters: - author of type * Initiative/Infrastructures. It has the following parameters: - author of type

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
import eu.dnetlib.dhp.schema.dump.oaf.Qualifier; import eu.dnetlib.dhp.schema.dump.oaf.Qualifier;
@ -32,9 +34,13 @@ public class Context extends Qualifier {
@Override @Override
public int hashCode() { public int hashCode() {
String provenance = ""; final String p = Optional.ofNullable(getProvenance())
this.provenance.forEach(p -> provenance.concat(p.toString())); .map(prov -> prov.stream()
return Objects.hash(getCode(), getLabel(), provenance); .map(Provenance::toString)
.collect(Collectors.joining()))
.orElse("");
return Objects.hash(getCode(), getLabel(), p);
} }
} }

View File

@ -1,8 +1,6 @@
package eu.dnetlib.dhp.schema.dump.oaf.community; package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.io.Serializable;
/** /**
* To store information about the funder funding the project related to the result. It has the following parameters: - * To store information about the funder funding the project related to the result. It has the following parameters: -
* shortName of type String to store the funder short name (e.c. AKA). - name of type String to store the funder name * shortName of type String to store the funder short name (e.c. AKA). - name of type String to store the funder name

View File

@ -1,8 +1,6 @@
package eu.dnetlib.dhp.schema.dump.oaf.community; package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.io.Serializable;
import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
/** /**

View File

@ -6,7 +6,6 @@ import java.util.List;
import eu.dnetlib.dhp.schema.dump.oaf.Container; import eu.dnetlib.dhp.schema.dump.oaf.Container;
import eu.dnetlib.dhp.schema.dump.oaf.ControlledField; import eu.dnetlib.dhp.schema.dump.oaf.ControlledField;
import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
/** /**
* To store information about the datasource OpenAIRE collects information from. It contains the following parameters: - * To store information about the datasource OpenAIRE collects information from. It contains the following parameters: -

View File

@ -1,8 +1,6 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph; package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable;
/** /**
* To store information about the funder funding the project related to the result. It extends * To store information about the funder funding the project related to the result. It extends
* eu.dnetlib.dhp.schema.dump.oaf.Funder with the following parameter: - - private * eu.dnetlib.dhp.schema.dump.oaf.Funder with the following parameter: - - private

View File

@ -2,7 +2,6 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph; package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.Optional;
/** /**
* To describe the funded amount. It has the following parameters: - private String currency to store the currency of * To describe the funded amount. It has the following parameters: - private String currency to store the currency of

View File

@ -5,10 +5,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.dump.oaf.ControlledField; import eu.dnetlib.dhp.schema.dump.oaf.ControlledField;
import eu.dnetlib.dhp.schema.dump.oaf.Country;
import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
import eu.dnetlib.dhp.schema.dump.oaf.Qualifier; import eu.dnetlib.dhp.schema.dump.oaf.Qualifier;
import eu.dnetlib.dhp.schema.dump.oaf.community.Project;
/** /**
* To represent the generic organizaiton. It has the following parameters: - private String legalshortname to store the * To represent the generic organizaiton. It has the following parameters: - private String legalshortname to store the

View File

@ -18,6 +18,7 @@ public class AccessRight extends Qualifier {
this.openAccessRoute = openAccessRoute; this.openAccessRoute = openAccessRoute;
} }
@Override
public String toComparableString() { public String toComparableString() {
String s = super.toComparableString(); String s = super.toComparableString();
return Optional return Optional

View File

@ -6,8 +6,15 @@ import java.util.List;
public class Datasource extends OafEntity implements Serializable { public class Datasource extends OafEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1019089598408414496L;
private Qualifier datasourcetype; private Qualifier datasourcetype;
private Qualifier datasourcetypeui;
private Qualifier openairecompatibility; private Qualifier openairecompatibility;
private Field<String> officialname; private Field<String> officialname;
@ -83,19 +90,45 @@ public class Datasource extends OafEntity implements Serializable {
private Journal journal; private Journal journal;
// New field for EOSC
private List<String> providedentitytypes;
// New field for EOSC
private List<String> providedproducttypes;
// New field for EOSC
private Qualifier jurisdiction;
// New field for EOSC
private Boolean thematic;
// New field for EOSC
private Boolean knowledgegraph;
// New field for EOSC
private List<Qualifier> contentpolicies;
public Qualifier getDatasourcetype() { public Qualifier getDatasourcetype() {
return datasourcetype; return datasourcetype;
} }
public void setDatasourcetype(Qualifier datasourcetype) { public void setDatasourcetype(final Qualifier datasourcetype) {
this.datasourcetype = datasourcetype; this.datasourcetype = datasourcetype;
} }
public Qualifier getDatasourcetypeui() {
return datasourcetypeui;
}
public void setDatasourcetypeui(final Qualifier datasourcetypeui) {
this.datasourcetypeui = datasourcetypeui;
}
public Qualifier getOpenairecompatibility() { public Qualifier getOpenairecompatibility() {
return openairecompatibility; return openairecompatibility;
} }
public void setOpenairecompatibility(Qualifier openairecompatibility) { public void setOpenairecompatibility(final Qualifier openairecompatibility) {
this.openairecompatibility = openairecompatibility; this.openairecompatibility = openairecompatibility;
} }
@ -103,7 +136,7 @@ public class Datasource extends OafEntity implements Serializable {
return officialname; return officialname;
} }
public void setOfficialname(Field<String> officialname) { public void setOfficialname(final Field<String> officialname) {
this.officialname = officialname; this.officialname = officialname;
} }
@ -111,7 +144,7 @@ public class Datasource extends OafEntity implements Serializable {
return englishname; return englishname;
} }
public void setEnglishname(Field<String> englishname) { public void setEnglishname(final Field<String> englishname) {
this.englishname = englishname; this.englishname = englishname;
} }
@ -119,7 +152,7 @@ public class Datasource extends OafEntity implements Serializable {
return websiteurl; return websiteurl;
} }
public void setWebsiteurl(Field<String> websiteurl) { public void setWebsiteurl(final Field<String> websiteurl) {
this.websiteurl = websiteurl; this.websiteurl = websiteurl;
} }
@ -127,7 +160,7 @@ public class Datasource extends OafEntity implements Serializable {
return logourl; return logourl;
} }
public void setLogourl(Field<String> logourl) { public void setLogourl(final Field<String> logourl) {
this.logourl = logourl; this.logourl = logourl;
} }
@ -135,7 +168,7 @@ public class Datasource extends OafEntity implements Serializable {
return contactemail; return contactemail;
} }
public void setContactemail(Field<String> contactemail) { public void setContactemail(final Field<String> contactemail) {
this.contactemail = contactemail; this.contactemail = contactemail;
} }
@ -143,7 +176,7 @@ public class Datasource extends OafEntity implements Serializable {
return namespaceprefix; return namespaceprefix;
} }
public void setNamespaceprefix(Field<String> namespaceprefix) { public void setNamespaceprefix(final Field<String> namespaceprefix) {
this.namespaceprefix = namespaceprefix; this.namespaceprefix = namespaceprefix;
} }
@ -151,7 +184,7 @@ public class Datasource extends OafEntity implements Serializable {
return latitude; return latitude;
} }
public void setLatitude(Field<String> latitude) { public void setLatitude(final Field<String> latitude) {
this.latitude = latitude; this.latitude = latitude;
} }
@ -159,7 +192,7 @@ public class Datasource extends OafEntity implements Serializable {
return longitude; return longitude;
} }
public void setLongitude(Field<String> longitude) { public void setLongitude(final Field<String> longitude) {
this.longitude = longitude; this.longitude = longitude;
} }
@ -167,7 +200,7 @@ public class Datasource extends OafEntity implements Serializable {
return dateofvalidation; return dateofvalidation;
} }
public void setDateofvalidation(Field<String> dateofvalidation) { public void setDateofvalidation(final Field<String> dateofvalidation) {
this.dateofvalidation = dateofvalidation; this.dateofvalidation = dateofvalidation;
} }
@ -175,7 +208,7 @@ public class Datasource extends OafEntity implements Serializable {
return description; return description;
} }
public void setDescription(Field<String> description) { public void setDescription(final Field<String> description) {
this.description = description; this.description = description;
} }
@ -183,7 +216,7 @@ public class Datasource extends OafEntity implements Serializable {
return subjects; return subjects;
} }
public void setSubjects(List<StructuredProperty> subjects) { public void setSubjects(final List<StructuredProperty> subjects) {
this.subjects = subjects; this.subjects = subjects;
} }
@ -191,7 +224,7 @@ public class Datasource extends OafEntity implements Serializable {
return odnumberofitems; return odnumberofitems;
} }
public void setOdnumberofitems(Field<String> odnumberofitems) { public void setOdnumberofitems(final Field<String> odnumberofitems) {
this.odnumberofitems = odnumberofitems; this.odnumberofitems = odnumberofitems;
} }
@ -199,7 +232,7 @@ public class Datasource extends OafEntity implements Serializable {
return odnumberofitemsdate; return odnumberofitemsdate;
} }
public void setOdnumberofitemsdate(Field<String> odnumberofitemsdate) { public void setOdnumberofitemsdate(final Field<String> odnumberofitemsdate) {
this.odnumberofitemsdate = odnumberofitemsdate; this.odnumberofitemsdate = odnumberofitemsdate;
} }
@ -207,7 +240,7 @@ public class Datasource extends OafEntity implements Serializable {
return odpolicies; return odpolicies;
} }
public void setOdpolicies(Field<String> odpolicies) { public void setOdpolicies(final Field<String> odpolicies) {
this.odpolicies = odpolicies; this.odpolicies = odpolicies;
} }
@ -215,7 +248,7 @@ public class Datasource extends OafEntity implements Serializable {
return odlanguages; return odlanguages;
} }
public void setOdlanguages(List<Field<String>> odlanguages) { public void setOdlanguages(final List<Field<String>> odlanguages) {
this.odlanguages = odlanguages; this.odlanguages = odlanguages;
} }
@ -223,7 +256,7 @@ public class Datasource extends OafEntity implements Serializable {
return odcontenttypes; return odcontenttypes;
} }
public void setOdcontenttypes(List<Field<String>> odcontenttypes) { public void setOdcontenttypes(final List<Field<String>> odcontenttypes) {
this.odcontenttypes = odcontenttypes; this.odcontenttypes = odcontenttypes;
} }
@ -231,7 +264,7 @@ public class Datasource extends OafEntity implements Serializable {
return accessinfopackage; return accessinfopackage;
} }
public void setAccessinfopackage(List<Field<String>> accessinfopackage) { public void setAccessinfopackage(final List<Field<String>> accessinfopackage) {
this.accessinfopackage = accessinfopackage; this.accessinfopackage = accessinfopackage;
} }
@ -239,7 +272,7 @@ public class Datasource extends OafEntity implements Serializable {
return releasestartdate; return releasestartdate;
} }
public void setReleasestartdate(Field<String> releasestartdate) { public void setReleasestartdate(final Field<String> releasestartdate) {
this.releasestartdate = releasestartdate; this.releasestartdate = releasestartdate;
} }
@ -247,7 +280,7 @@ public class Datasource extends OafEntity implements Serializable {
return releaseenddate; return releaseenddate;
} }
public void setReleaseenddate(Field<String> releaseenddate) { public void setReleaseenddate(final Field<String> releaseenddate) {
this.releaseenddate = releaseenddate; this.releaseenddate = releaseenddate;
} }
@ -255,7 +288,7 @@ public class Datasource extends OafEntity implements Serializable {
return missionstatementurl; return missionstatementurl;
} }
public void setMissionstatementurl(Field<String> missionstatementurl) { public void setMissionstatementurl(final Field<String> missionstatementurl) {
this.missionstatementurl = missionstatementurl; this.missionstatementurl = missionstatementurl;
} }
@ -263,7 +296,7 @@ public class Datasource extends OafEntity implements Serializable {
return dataprovider; return dataprovider;
} }
public void setDataprovider(Field<Boolean> dataprovider) { public void setDataprovider(final Field<Boolean> dataprovider) {
this.dataprovider = dataprovider; this.dataprovider = dataprovider;
} }
@ -271,7 +304,7 @@ public class Datasource extends OafEntity implements Serializable {
return serviceprovider; return serviceprovider;
} }
public void setServiceprovider(Field<Boolean> serviceprovider) { public void setServiceprovider(final Field<Boolean> serviceprovider) {
this.serviceprovider = serviceprovider; this.serviceprovider = serviceprovider;
} }
@ -279,7 +312,7 @@ public class Datasource extends OafEntity implements Serializable {
return databaseaccesstype; return databaseaccesstype;
} }
public void setDatabaseaccesstype(Field<String> databaseaccesstype) { public void setDatabaseaccesstype(final Field<String> databaseaccesstype) {
this.databaseaccesstype = databaseaccesstype; this.databaseaccesstype = databaseaccesstype;
} }
@ -287,7 +320,7 @@ public class Datasource extends OafEntity implements Serializable {
return datauploadtype; return datauploadtype;
} }
public void setDatauploadtype(Field<String> datauploadtype) { public void setDatauploadtype(final Field<String> datauploadtype) {
this.datauploadtype = datauploadtype; this.datauploadtype = datauploadtype;
} }
@ -295,7 +328,7 @@ public class Datasource extends OafEntity implements Serializable {
return databaseaccessrestriction; return databaseaccessrestriction;
} }
public void setDatabaseaccessrestriction(Field<String> databaseaccessrestriction) { public void setDatabaseaccessrestriction(final Field<String> databaseaccessrestriction) {
this.databaseaccessrestriction = databaseaccessrestriction; this.databaseaccessrestriction = databaseaccessrestriction;
} }
@ -303,7 +336,7 @@ public class Datasource extends OafEntity implements Serializable {
return datauploadrestriction; return datauploadrestriction;
} }
public void setDatauploadrestriction(Field<String> datauploadrestriction) { public void setDatauploadrestriction(final Field<String> datauploadrestriction) {
this.datauploadrestriction = datauploadrestriction; this.datauploadrestriction = datauploadrestriction;
} }
@ -311,7 +344,7 @@ public class Datasource extends OafEntity implements Serializable {
return versioning; return versioning;
} }
public void setVersioning(Field<Boolean> versioning) { public void setVersioning(final Field<Boolean> versioning) {
this.versioning = versioning; this.versioning = versioning;
} }
@ -319,7 +352,7 @@ public class Datasource extends OafEntity implements Serializable {
return citationguidelineurl; return citationguidelineurl;
} }
public void setCitationguidelineurl(Field<String> citationguidelineurl) { public void setCitationguidelineurl(final Field<String> citationguidelineurl) {
this.citationguidelineurl = citationguidelineurl; this.citationguidelineurl = citationguidelineurl;
} }
@ -327,7 +360,7 @@ public class Datasource extends OafEntity implements Serializable {
return qualitymanagementkind; return qualitymanagementkind;
} }
public void setQualitymanagementkind(Field<String> qualitymanagementkind) { public void setQualitymanagementkind(final Field<String> qualitymanagementkind) {
this.qualitymanagementkind = qualitymanagementkind; this.qualitymanagementkind = qualitymanagementkind;
} }
@ -335,7 +368,7 @@ public class Datasource extends OafEntity implements Serializable {
return pidsystems; return pidsystems;
} }
public void setPidsystems(Field<String> pidsystems) { public void setPidsystems(final Field<String> pidsystems) {
this.pidsystems = pidsystems; this.pidsystems = pidsystems;
} }
@ -343,7 +376,7 @@ public class Datasource extends OafEntity implements Serializable {
return certificates; return certificates;
} }
public void setCertificates(Field<String> certificates) { public void setCertificates(final Field<String> certificates) {
this.certificates = certificates; this.certificates = certificates;
} }
@ -351,7 +384,7 @@ public class Datasource extends OafEntity implements Serializable {
return policies; return policies;
} }
public void setPolicies(List<KeyValue> policies) { public void setPolicies(final List<KeyValue> policies) {
this.policies = policies; this.policies = policies;
} }
@ -359,23 +392,72 @@ public class Datasource extends OafEntity implements Serializable {
return journal; return journal;
} }
public void setJournal(Journal journal) { public void setJournal(final Journal journal) {
this.journal = journal; this.journal = journal;
} }
public List<String> getProvidedentitytypes() {
return providedentitytypes;
}
public void setProvidedentitytypes(final List<String> providedentitytypes) {
this.providedentitytypes = providedentitytypes;
}
public List<String> getProvidedproducttypes() {
return providedproducttypes;
}
public void setProvidedproducttypes(final List<String> providedproducttypes) {
this.providedproducttypes = providedproducttypes;
}
public Qualifier getJurisdiction() {
return jurisdiction;
}
public void setJurisdiction(final Qualifier jurisdiction) {
this.jurisdiction = jurisdiction;
}
public Boolean getThematic() {
return thematic;
}
public void setThematic(final Boolean thematic) {
this.thematic = thematic;
}
public Boolean getKnowledgegraph() {
return knowledgegraph;
}
public void setKnowledgegraph(final Boolean knowledgegraph) {
this.knowledgegraph = knowledgegraph;
}
public List<Qualifier> getContentpolicies() {
return contentpolicies;
}
public void setContentpolicies(final List<Qualifier> contentpolicies) {
this.contentpolicies = contentpolicies;
}
@Override @Override
public void mergeFrom(OafEntity e) { public void mergeFrom(final OafEntity e) {
super.mergeFrom(e); super.mergeFrom(e);
if (!Datasource.class.isAssignableFrom(e.getClass())) { if (!Datasource.class.isAssignableFrom(e.getClass())) { return; }
return;
}
Datasource d = (Datasource) e; final Datasource d = (Datasource) e;
datasourcetype = d.getDatasourcetype() != null && compareTrust(this, e) < 0 datasourcetype = d.getDatasourcetype() != null && compareTrust(this, e) < 0
? d.getDatasourcetype() ? d.getDatasourcetype()
: datasourcetype; : datasourcetype;
datasourcetypeui = d.getDatasourcetypeui() != null && compareTrust(this, e) < 0
? d.getDatasourcetypeui()
: datasourcetypeui;
openairecompatibility = d.getOpenairecompatibility() != null && compareTrust(this, e) < 0 openairecompatibility = d.getOpenairecompatibility() != null && compareTrust(this, e) < 0
? d.getOpenairecompatibility() ? d.getOpenairecompatibility()
: openairecompatibility; : openairecompatibility;
@ -467,6 +549,25 @@ public class Datasource extends OafEntity implements Serializable {
journal = d.getJournal() != null && compareTrust(this, e) < 0 ? d.getJournal() : journal; journal = d.getJournal() != null && compareTrust(this, e) < 0 ? d.getJournal() : journal;
providedentitytypes = mergeLists(providedentitytypes, d.getProvidedentitytypes());;
providedproducttypes = mergeLists(providedproducttypes, d.getProvidedproducttypes());;
jurisdiction = d.getJurisdiction() != null && compareTrust(this, e) < 0
? d.getJurisdiction()
: jurisdiction;
thematic = d.getThematic() != null && compareTrust(this, e) < 0
? d.getThematic()
: thematic;
knowledgegraph = d.getKnowledgegraph() != null && compareTrust(this, e) < 0
? d.getKnowledgegraph()
: knowledgegraph;
contentpolicies = mergeLists(contentpolicies, d.getContentpolicies());;
mergeOAFDataInfo(e); mergeOAFDataInfo(e);
} }
} }

View File

@ -96,7 +96,8 @@ public abstract class OafEntity extends Oaf implements Serializable {
oaiprovenance = e.getOaiprovenance(); oaiprovenance = e.getOaiprovenance();
} }
protected <T> List<T> mergeLists(final List<T>... lists) { @SafeVarargs
protected final <T> List<T> mergeLists(final List<T>... lists) {
return Arrays return Arrays
.stream(lists) .stream(lists)

View File

@ -348,10 +348,6 @@ public class Project extends OafEntity implements Serializable {
: contactemail; : contactemail;
summary = p.getSummary() != null && compareTrust(this, e) < 0 ? p.getSummary() : summary; summary = p.getSummary() != null && compareTrust(this, e) < 0 ? p.getSummary() : summary;
currency = p.getCurrency() != null && compareTrust(this, e) < 0 ? p.getCurrency() : currency; currency = p.getCurrency() != null && compareTrust(this, e) < 0 ? p.getCurrency() : currency;
// totalcost = p.getTotalcost() != null && compareTrust(this, e) < 0 ? p.getTotalcost() : totalcost;
// fundedamount = p.getFundedamount() != null && compareTrust(this, e) < 0
// ? p.getFundedamount()
// : fundedamount;
if (p.getH2020topiccode() != null && StringUtils.isEmpty(h2020topiccode)){ if (p.getH2020topiccode() != null && StringUtils.isEmpty(h2020topiccode)){
h2020topiccode = p.getH2020topiccode(); h2020topiccode = p.getH2020topiccode();

View File

@ -4,9 +4,9 @@ package eu.dnetlib.dhp.schema.oaf;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.ArrayList;
import java.util.stream.Collectors; import java.util.List;
import java.util.stream.Stream; import java.util.Objects;
import eu.dnetlib.dhp.schema.common.ModelSupport; import eu.dnetlib.dhp.schema.common.ModelSupport;

View File

@ -349,10 +349,10 @@ public class Result extends OafEntity implements Serializable {
private StructuredProperty getMainTitle(List<StructuredProperty> titles) { 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 // 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) // main title select in the list)
for (StructuredProperty title : titles) { for (StructuredProperty t : titles) {
if (title.getQualifier() != null && title.getQualifier().getClassid() != null) if (t.getQualifier() != null && t.getQualifier().getClassid() != null)
if (title.getQualifier().getClassid().equals("main title")) if (t.getQualifier().getClassid().equals("main title"))
return title; return t;
} }
return null; return null;
} }

View File

@ -8,8 +8,6 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Joiner;
public class StructuredProperty implements Serializable { public class StructuredProperty implements Serializable {
private String value; private String value;

View File

@ -22,6 +22,8 @@ public class CleaningFunctions {
PID_BLACKLIST.add("na"); PID_BLACKLIST.add("na");
} }
public CleaningFunctions() {}
/** /**
* Utility method that filter PID values on a per-type basis. * Utility method that filter PID values on a per-type basis.
* @param s the PID whose value will be checked. * @param s the PID whose value will be checked.

View File

@ -120,7 +120,7 @@ public class IdentifierFactory implements Serializable {
return pids return pids
.values() .values()
.stream() .stream()
.flatMap(s -> s.stream()) .flatMap(Set::stream)
.min(new PidComparator<>(entity)) .min(new PidComparator<>(entity))
.map( .map(
min -> Optional min -> Optional
@ -140,8 +140,7 @@ public class IdentifierFactory implements Serializable {
if (entity instanceof Result) { if (entity instanceof Result) {
return Optional return Optional
.ofNullable(((Result) entity).getInstance()) .ofNullable(((Result) entity).getInstance())
.map( .map(IdentifierFactory::mapPids)
instance -> mapPids(instance))
.orElse(new HashMap<>()); .orElse(new HashMap<>());
} else { } else {
return entity return entity
@ -247,7 +246,6 @@ public class IdentifierFactory implements Serializable {
md.update(s.getBytes(StandardCharsets.UTF_8)); md.update(s.getBytes(StandardCharsets.UTF_8));
return new String(Hex.encodeHex(md.digest())); return new String(Hex.encodeHex(md.digest()));
} catch (final Exception e) { } catch (final Exception e) {
System.err.println("Error creating id");
return null; return null;
} }
} }

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.oaf.utils;
public class ModelHardLimits { public class ModelHardLimits {
private ModelHardLimits() {}
public static final String LAYOUT = "index"; public static final String LAYOUT = "index";
public static final String INTERPRETATION = "openaire"; public static final String INTERPRETATION = "openaire";
public static final String SEPARATOR = "-"; public static final String SEPARATOR = "-";

View File

@ -34,4 +34,6 @@ public class PidBlacklistProvider {
.orElse(new HashSet<>()); .orElse(new HashSet<>());
} }
private PidBlacklistProvider() {}
} }

View File

@ -9,6 +9,7 @@ import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.common.ModelConstants; import eu.dnetlib.dhp.schema.common.ModelConstants;
import eu.dnetlib.dhp.schema.oaf.KeyValue;
import eu.dnetlib.dhp.schema.oaf.Result; import eu.dnetlib.dhp.schema.oaf.Result;
public class ResultTypeComparator implements Comparator<Result> { public class ResultTypeComparator implements Comparator<Result> {
@ -69,7 +70,7 @@ public class ResultTypeComparator implements Comparator<Result> {
.map( .map(
cf -> cf cf -> cf
.stream() .stream()
.map(c -> c.getKey()) .map(KeyValue::getKey)
.collect(Collectors.toCollection(HashSet::new))) .collect(Collectors.toCollection(HashSet::new)))
.orElse(new HashSet<>()); .orElse(new HashSet<>());
} }

View File

@ -3,12 +3,9 @@ package eu.dnetlib.dhp.schema.orcid;
import java.io.Serializable; import java.io.Serializable;
import eu.dnetlib.dhp.schema.orcid.AuthorData;
/** /**
* This class models the data related to a contributor, that are retrieved from an orcid publication * This class models the data related to a contributor, that are retrieved from an orcid publication
*/ */
public class Contributor extends AuthorData implements Serializable { public class Contributor extends AuthorData implements Serializable {
private String sequence; private String sequence;
private String role; private String role;

View File

@ -4,11 +4,6 @@ package eu.dnetlib.dhp.schema.orcid;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.orcid.Contributor;
import eu.dnetlib.dhp.schema.orcid.ExternalId;
import eu.dnetlib.dhp.schema.orcid.OrcidData;
import eu.dnetlib.dhp.schema.orcid.PublicationDate;
/** /**
* This class models the data that are retrieved from orcid publication * This class models the data that are retrieved from orcid publication
*/ */

View File

@ -0,0 +1,9 @@
-- Table to extend the datasource properties according to the eosc model
CREATE TABLE dsm_datasources_eosc(
id varchar(255) references dsm_datasources(id),
jurisdiction text,
thematic boolean,
knowledge_graph boolean,
content_policies text[],
_dnet_resource_identifier_ varchar(2048) default ((('temp_'::text || md5((clock_timestamp())::text)) || '_'::text) || md5((random())::text))
);

View File

@ -14,10 +14,11 @@ import eu.dnetlib.dhp.schema.common.ModelConstants;
import eu.dnetlib.dhp.schema.oaf.Relation; import eu.dnetlib.dhp.schema.oaf.Relation;
/** @author claudio.atzori */ /** @author claudio.atzori */
public class AtomicActionTest { class AtomicActionTest {
@Test @Test
public void serializationTest() throws IOException { @SuppressWarnings("unchecked")
void serializationTest() throws IOException {
Relation rel = new Relation(); Relation rel = new Relation();
rel.setSource("1"); rel.setSource("1");

View File

@ -17,7 +17,7 @@ public class ModelSupportTest {
class IsSubClass { class IsSubClass {
@Test @Test
public void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() { void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() {
// when // when
Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class); Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class);
@ -26,7 +26,7 @@ public class ModelSupportTest {
} }
@Test @Test
public void shouldReturnTrueWhenSubClassExtendsSuperClass() { void shouldReturnTrueWhenSubClassExtendsSuperClass() {
// when // when
Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class); Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class);

View File

@ -12,13 +12,13 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
public class MeasureTest { class MeasureTest {
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL); .setSerializationInclusion(JsonInclude.Include.NON_NULL);
@Test @Test
public void testMeasureSerialization() throws IOException { void testMeasureSerialization() throws IOException {
Measure popularity = new Measure(); Measure popularity = new Measure();
popularity.setId("popularity"); popularity.setId("popularity");

View File

@ -10,7 +10,7 @@ import java.util.List;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class MergeTest { class MergeTest {
OafEntity oaf; OafEntity oaf;
@ -20,7 +20,8 @@ public class MergeTest {
} }
@Test @Test
public void mergeListsTest() { @SuppressWarnings("unchecked")
void mergeListsTest() {
// string list merge test // string list merge test
List<String> a = Arrays.asList("a", "b", "c", "e"); List<String> a = Arrays.asList("a", "b", "c", "e");
@ -35,7 +36,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationCollectedFromTest() { void mergePublicationCollectedFromTest() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -50,7 +51,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_bothPresent() { void mergePublicationDateOfAcceptanceTest_bothPresent() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -65,7 +66,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_bothPresent_1() { void mergePublicationDateOfAcceptanceTest_bothPresent_1() {
Publication a = publication("0.8"); Publication a = publication("0.8");
Publication b = publication("0.9"); Publication b = publication("0.9");
@ -80,7 +81,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_bothPresent_2() { void mergePublicationDateOfAcceptanceTest_bothPresent_2() {
Publication a = publication("0.9"); Publication a = publication("0.9");
Publication b = publication("0.8"); Publication b = publication("0.8");
@ -95,7 +96,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_leftMissing() { void mergePublicationDateOfAcceptanceTest_leftMissing() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -109,7 +110,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_leftMissing_1() { void mergePublicationDateOfAcceptanceTest_leftMissing_1() {
Publication a = publication("0.9"); Publication a = publication("0.9");
Publication b = publication("0.8"); Publication b = publication("0.8");
@ -123,7 +124,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_leftMissing_2() { void mergePublicationDateOfAcceptanceTest_leftMissing_2() {
Publication a = publication("0.8"); Publication a = publication("0.8");
Publication b = publication("0.9"); Publication b = publication("0.9");
@ -137,7 +138,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_rightMissing() { void mergePublicationDateOfAcceptanceTest_rightMissing() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -151,7 +152,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_rightMissing_1() { void mergePublicationDateOfAcceptanceTest_rightMissing_1() {
Publication a = publication("0.8"); Publication a = publication("0.8");
Publication b = publication("0.9"); Publication b = publication("0.9");
@ -165,7 +166,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationDateOfAcceptanceTest_rightMissing_2() { void mergePublicationDateOfAcceptanceTest_rightMissing_2() {
Publication a = publication("0.9"); Publication a = publication("0.9");
Publication b = publication("0.8"); Publication b = publication("0.8");
@ -179,7 +180,7 @@ public class MergeTest {
} }
@Test @Test
public void mergePublicationSubjectTest() { void mergePublicationSubjectTest() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -194,7 +195,7 @@ public class MergeTest {
} }
@Test @Test
public void mergeRelationTest() { void mergeRelationTest() {
Relation a = createRel(null, null); Relation a = createRel(null, null);
Relation b = createRel(null, null); Relation b = createRel(null, null);
@ -235,7 +236,7 @@ public class MergeTest {
} }
@Test @Test
public void mergeRelationTestParseException() { void mergeRelationTestParseException() {
assertThrows(DateTimeParseException.class, () -> { assertThrows(DateTimeParseException.class, () -> {
Relation a = createRel(true, "Once upon a time ..."); Relation a = createRel(true, "Once upon a time ...");
Relation b = createRel(true, "... in a far away land"); Relation b = createRel(true, "... in a far away land");
@ -279,7 +280,7 @@ public class MergeTest {
} }
private <T> Field<T> field(T value) { private <T> Field<T> field(T value) {
Field<T> f = new Field<T>(); Field<T> f = new Field();
f.setValue(value); f.setValue(value);
return f; return f;
} }

View File

@ -6,10 +6,10 @@ import java.util.Set;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class BlackListProviderTest { class BlackListProviderTest {
@Test @Test
public void blackListTest() { void blackListTest() {
Assertions.assertNotNull(PidBlacklistProvider.getBlacklist()); Assertions.assertNotNull(PidBlacklistProvider.getBlacklist());
Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi")); Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi"));

View File

@ -14,13 +14,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.Publication; import eu.dnetlib.dhp.schema.oaf.Publication;
public class IdentifierFactoryTest { class IdentifierFactoryTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@Test @Test
public void testCreateIdentifierForPublication() throws IOException { void testCreateIdentifierForPublication() throws IOException {
verifyIdentifier( verifyIdentifier(
"publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true); "publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true);
@ -51,7 +51,7 @@ public class IdentifierFactoryTest {
} }
@Test @Test
public void testCreateIdentifierForPublicationNoHash() throws IOException { void testCreateIdentifierForPublicationNoHash() throws IOException {
verifyIdentifier("publication_doi1.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false); verifyIdentifier("publication_doi1.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false);
verifyIdentifier("publication_doi2.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false); verifyIdentifier("publication_doi2.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false);