Compare commits
6 Commits
master
...
orcid_mode
Author | SHA1 | Date |
---|---|---|
Miriam Baglioni | 9550ce0b96 | |
Claudio Atzori | 4ec690e4cd | |
Claudio Atzori | 6283ba69c2 | |
Claudio Atzori | d77ee107f4 | |
Claudio Atzori | 33e90864b0 | |
Claudio Atzori | 76c4af7c2b |
4
pom.xml
4
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<groupId>eu.dnetlib.dhp</groupId>
|
||||
<artifactId>dhp-schemas</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.2.4-SNAPSHOT</version>
|
||||
<version>2.2.4</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<connection>scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git</connection>
|
||||
<developerConnection>scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git</developerConnection>
|
||||
<url>https://code-repo.d4science.org/D-Net/dhp-schemas/</url>
|
||||
<tag>HEAD</tag>
|
||||
<tag>dhp-schemas-2.2.4</tag>
|
||||
</scm>
|
||||
|
||||
<description>This module contains common schema classes meant to be used across the dnet-hadoop submodules</description>
|
||||
|
|
|
@ -10,6 +10,7 @@ public class ModelConstants {
|
|||
public static final String ORCID = "orcid";
|
||||
public static final String ORCID_PENDING = "orcid_pending";
|
||||
public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID";
|
||||
public static final String ORCID_DS = ORCID.toUpperCase();
|
||||
|
||||
public static final String DNET_SUBJECT_TYPOLOGIES = "dnet:subject_classification_typologies";
|
||||
public static final String DNET_RESULT_TYPOLOGIES = "dnet:result_typologies";
|
||||
|
@ -22,6 +23,7 @@ public class ModelConstants {
|
|||
public static final String DNET_PROVENANCE_ACTIONS = "dnet:provenanceActions";
|
||||
public static final String DNET_COUNTRY_TYPE = "dnet:countries";
|
||||
public static final String DNET_REVIEW_LEVELS = "dnet:review_levels";
|
||||
public static final String DNET_EXTERNAL_REFERENCE_TYPE = "dnet:externalReference_typologies";
|
||||
|
||||
public static final String SYSIMPORT_CROSSWALK_REPOSITORY = "sysimport:crosswalk:repository";
|
||||
public static final String SYSIMPORT_CROSSWALK_ENTITYREGISTRY = "sysimport:crosswalk:entityregistry";
|
||||
|
|
|
@ -4,7 +4,7 @@ package eu.dnetlib.dhp.schema.dump.oaf;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Used to refer to the Article Processing Charge information. Not dumped in this release. It contains two parameters: -
|
||||
* Used to refer to the Article Processing Charge information. It contains two parameters: -
|
||||
* currency of type String to store the currency of the APC - amount of type String to stores the charged amount
|
||||
*/
|
||||
public class APC implements Serializable {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.LicenseComparator;
|
||||
|
@ -257,6 +258,14 @@ public class Result extends OafEntity implements Serializable {
|
|||
if (r.getLanguage() != null && compareTrust(this, r) < 0)
|
||||
language = r.getLanguage();
|
||||
|
||||
if (Objects.nonNull(r.getDateofacceptance())) {
|
||||
if (Objects.isNull(getDateofacceptance())) {
|
||||
dateofacceptance = r.getDateofacceptance();
|
||||
} else if (compareTrust(this, r) < 0) {
|
||||
dateofacceptance = r.getDateofacceptance();
|
||||
}
|
||||
}
|
||||
|
||||
country = mergeLists(country, r.getCountry());
|
||||
|
||||
subject = mergeLists(subject, r.getSubject());
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AuthorHistory implements Serializable {
|
||||
private String creationMethod;
|
||||
private String completionDate;
|
||||
private String submissionDate;
|
||||
private String lastModifiedDate;
|
||||
private boolean claimed;
|
||||
private String deactivationDate;
|
||||
private boolean verifiedEmail;
|
||||
private boolean verifiedPrimaryEmail;
|
||||
|
||||
public String getCreationMethod() {
|
||||
return creationMethod;
|
||||
}
|
||||
|
||||
public void setCreationMethod(String creationMethod) {
|
||||
this.creationMethod = creationMethod;
|
||||
}
|
||||
|
||||
public String getCompletionDate() {
|
||||
return completionDate;
|
||||
}
|
||||
|
||||
public void setCompletionDate(String completionDate) {
|
||||
this.completionDate = completionDate;
|
||||
}
|
||||
|
||||
public String getSubmissionDate() {
|
||||
return submissionDate;
|
||||
}
|
||||
|
||||
public void setSubmissionDate(String submissionDate) {
|
||||
this.submissionDate = submissionDate;
|
||||
}
|
||||
|
||||
public String getLastModifiedDate() {
|
||||
return lastModifiedDate;
|
||||
}
|
||||
|
||||
public void setLastModifiedDate(String lastModifiedDate) {
|
||||
this.lastModifiedDate = lastModifiedDate;
|
||||
}
|
||||
|
||||
public boolean isClaimed() {
|
||||
return claimed;
|
||||
}
|
||||
|
||||
public void setClaimed(boolean claimed) {
|
||||
this.claimed = claimed;
|
||||
}
|
||||
|
||||
public String getDeactivationDate() {
|
||||
return deactivationDate;
|
||||
}
|
||||
|
||||
public void setDeactivationDate(String deactivationDate) {
|
||||
this.deactivationDate = deactivationDate;
|
||||
}
|
||||
|
||||
public boolean isVerifiedEmail() {
|
||||
return verifiedEmail;
|
||||
}
|
||||
|
||||
public void setVerifiedEmail(boolean verifiedEmail) {
|
||||
this.verifiedEmail = verifiedEmail;
|
||||
}
|
||||
|
||||
public boolean isVerifiedPrimaryEmail() {
|
||||
return verifiedPrimaryEmail;
|
||||
}
|
||||
|
||||
public void setVerifiedPrimaryEmail(boolean verifiedPrimaryEmail) {
|
||||
this.verifiedPrimaryEmail = verifiedPrimaryEmail;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AuthorSummary extends OrcidData implements Serializable {
|
||||
private AuthorData authorData;
|
||||
private AuthorHistory authorHistory;
|
||||
|
||||
public AuthorData getAuthorData() {
|
||||
return authorData;
|
||||
}
|
||||
|
||||
public void setAuthorData(AuthorData authorData) {
|
||||
this.authorData = authorData;
|
||||
}
|
||||
|
||||
public AuthorHistory getAuthorHistory() {
|
||||
return authorHistory;
|
||||
}
|
||||
|
||||
public void setAuthorHistory(AuthorHistory authorHistory) {
|
||||
this.authorHistory = authorHistory;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
public class Contributor extends AuthorData implements Serializable {
|
||||
private String sequence;
|
||||
private String role;
|
||||
private transient boolean simpleMatch;
|
||||
private transient Double score;
|
||||
private transient boolean bestMatch;
|
||||
|
||||
public String getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public void setSequence(String sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public boolean isSimpleMatch() {
|
||||
return simpleMatch;
|
||||
}
|
||||
|
||||
public void setSimpleMatch(boolean simpleMatch) {
|
||||
this.simpleMatch = simpleMatch;
|
||||
}
|
||||
|
||||
public Double getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(Double score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public boolean isBestMatch() {
|
||||
return bestMatch;
|
||||
}
|
||||
|
||||
public void setBestMatch(boolean bestMatch) {
|
||||
this.bestMatch = bestMatch;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class models the data related to external id, that are retrieved from an orcid publication
|
||||
*/
|
||||
|
||||
public class ExternalId implements Serializable {
|
||||
private String type;
|
||||
private String value;
|
||||
private String relationShip;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getRelationShip() {
|
||||
return relationShip;
|
||||
}
|
||||
|
||||
public void setRelationShip(String relationShip) {
|
||||
this.relationShip = relationShip;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OrcidData implements Serializable {
|
||||
protected String base64CompressData;
|
||||
protected String statusCode;
|
||||
protected String downloadDate;
|
||||
|
||||
public String getBase64CompressData() {
|
||||
return base64CompressData;
|
||||
}
|
||||
|
||||
public void setBase64CompressData(String base64CompressData) {
|
||||
this.base64CompressData = base64CompressData;
|
||||
}
|
||||
|
||||
public String getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(String statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
public String getDownloadDate() {
|
||||
return downloadDate;
|
||||
}
|
||||
|
||||
public void setDownloadDate(String downloadDate) {
|
||||
this.downloadDate = downloadDate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class models the data related to a publication date, that are retrieved from an orcid publication
|
||||
*/
|
||||
|
||||
public class PublicationDate implements Serializable {
|
||||
private String year;
|
||||
private String month;
|
||||
private String day;
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(String day) {
|
||||
this.day = day;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Work extends OrcidData implements Serializable {
|
||||
WorkDetail workDetail;
|
||||
|
||||
public WorkDetail getWorkDetail() {
|
||||
return workDetail;
|
||||
}
|
||||
|
||||
public void setWorkDetail(WorkDetail workDetail) {
|
||||
this.workDetail = workDetail;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package eu.dnetlib.dhp.schema.orcid;
|
||||
|
||||
import java.io.Serializable;
|
||||
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
|
||||
*/
|
||||
|
||||
public class WorkDetail implements Serializable {
|
||||
|
||||
private String oid;
|
||||
private String id;
|
||||
private String sourceName;
|
||||
private String type;
|
||||
private List<String> titles;
|
||||
private List<String> urls;
|
||||
List<ExternalId> extIds;
|
||||
List<PublicationDate> publicationDates;
|
||||
List<Contributor> contributors;
|
||||
|
||||
public String getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(String oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
private String errorCode;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<String> getTitles() {
|
||||
return titles;
|
||||
}
|
||||
|
||||
public void setTitles(List<String> titles) {
|
||||
this.titles = titles;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<String> getUrls() {
|
||||
return urls;
|
||||
}
|
||||
|
||||
public void setUrls(List<String> urls) {
|
||||
this.urls = urls;
|
||||
}
|
||||
|
||||
public List<ExternalId> getExtIds() {
|
||||
return extIds;
|
||||
}
|
||||
|
||||
public void setExtIds(List<ExternalId> extIds) {
|
||||
this.extIds = extIds;
|
||||
}
|
||||
|
||||
public List<PublicationDate> getPublicationDates() {
|
||||
return publicationDates;
|
||||
}
|
||||
|
||||
public void setPublicationDates(List<PublicationDate> publicationDates) {
|
||||
this.publicationDates = publicationDates;
|
||||
}
|
||||
|
||||
public List<Contributor> getContributors() {
|
||||
return contributors;
|
||||
}
|
||||
|
||||
public void setContributors(List<Contributor> contributors) {
|
||||
this.contributors = contributors;
|
||||
}
|
||||
}
|
|
@ -37,8 +37,8 @@ public class MergeTest {
|
|||
@Test
|
||||
public void mergePublicationCollectedFromTest() {
|
||||
|
||||
Publication a = new Publication();
|
||||
Publication b = new Publication();
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
||||
a.setCollectedfrom(Arrays.asList(setKV("a", "open"), setKV("b", "closed")));
|
||||
b.setCollectedfrom(Arrays.asList(setKV("A", "open"), setKV("b", "Open")));
|
||||
|
@ -49,11 +49,140 @@ public class MergeTest {
|
|||
assertEquals(3, a.getCollectedfrom().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_bothPresent() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
||||
a.setDateofacceptance(field("2021-06-18"));
|
||||
b.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-18", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_bothPresent_1() {
|
||||
|
||||
Publication a = publication("0.8");
|
||||
Publication b = publication("0.9");
|
||||
|
||||
a.setDateofacceptance(field("2021-06-18"));
|
||||
b.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_bothPresent_2() {
|
||||
|
||||
Publication a = publication("0.9");
|
||||
Publication b = publication("0.8");
|
||||
|
||||
a.setDateofacceptance(field("2021-06-18"));
|
||||
b.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-18", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_leftMissing() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
||||
b.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_leftMissing_1() {
|
||||
|
||||
Publication a = publication("0.9");
|
||||
Publication b = publication("0.8");
|
||||
|
||||
b.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_leftMissing_2() {
|
||||
|
||||
Publication a = publication("0.8");
|
||||
Publication b = publication("0.9");
|
||||
|
||||
b.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_rightMissing() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
||||
a.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_rightMissing_1() {
|
||||
|
||||
Publication a = publication("0.8");
|
||||
Publication b = publication("0.9");
|
||||
|
||||
a.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_rightMissing_2() {
|
||||
|
||||
Publication a = publication("0.9");
|
||||
Publication b = publication("0.8");
|
||||
|
||||
a.setDateofacceptance(field("2021-06-19"));
|
||||
|
||||
a.mergeFrom(b);
|
||||
|
||||
assertNotNull(a.getDateofacceptance());
|
||||
assertEquals("2021-06-19", a.getDateofacceptance().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationSubjectTest() {
|
||||
|
||||
Publication a = new Publication();
|
||||
Publication b = new Publication();
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
||||
a.setSubject(Arrays.asList(setSP("a", "open", "classe"), setSP("b", "open", "classe")));
|
||||
b.setSubject(Arrays.asList(setSP("A", "open", "classe"), setSP("c", "open", "classe")));
|
||||
|
@ -136,4 +265,28 @@ public class MergeTest {
|
|||
s.setQualifier(q);
|
||||
return s;
|
||||
}
|
||||
|
||||
private <T> Field<T> field(T value) {
|
||||
Field<T> f = new Field<T>();
|
||||
f.setValue(value);
|
||||
return f;
|
||||
}
|
||||
|
||||
private Publication publication() {
|
||||
Publication p = new Publication();
|
||||
p.setDataInfo(df("0.9"));
|
||||
return p;
|
||||
}
|
||||
|
||||
private Publication publication(String trust) {
|
||||
Publication p = new Publication();
|
||||
p.setDataInfo(df(trust));
|
||||
return p;
|
||||
}
|
||||
|
||||
private DataInfo df(String trust) {
|
||||
DataInfo d = new DataInfo();
|
||||
d.setTrust(trust);
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue