Merge branch 'master' into datasource_model_eosc
This commit is contained in:
commit
65023a7520
|
@ -4,6 +4,7 @@
|
|||
|
||||
| **Version** | **Changes** | **Readiness** |
|
||||
|---|---|---|
|
||||
| 2.7.17 | [Dump model]<br>aligned the graph dump schema to mirror the changes in the model<br>1. Added openaccessroute at the level of the instance inside the AccessRight element;<br>2. Added pid and the alternate identifiers at the level of the instance;<br>3. Added the bipFinder measures | beta |
|
||||
| 2.7.16 | [Graph model]<br>Updated the casing of the following terms (`relation.relClass`):<br>1. `isRelatedTo -> IsRelatedTo`<br>Added the following `relClass` terms:<br>1. `IsAmongTopNSimilarDocuments`<br>2. `HasAmongTopNSimilarDocuments` | beta |
|
||||
| 2.7.15 | 1. added support for delegated authorities<br>2. fixed regex for DOI cleaning | beta |
|
||||
| 2.7.14 | [Graph model]<br>Relation types are now inspired by the Datacite definitions https://schema.datacite.org/meta/kernel-4.4/doc/DataCite-MetadataKernel_v4.4.pdf <br>The changes involve the values stored in `relation.subRelType` and `relation.relClass`:<br>Updated the casing of the following terms (`relation.relClass`):<br>1. `isSupplementTo -> IsSupplementTo` / `isSupplementedBy -> IsSupplementedBy`<br>2. `isPartOf -> IsPartOf` / `hasPart -> HasPart`<br>3. `cites -> Cites` / `isCitedBy -> IsCitedBy`<br>4. `reviews -> Reviews` / `isReviewedBy -> IsReviewedBy`<br>Added the following terms [`subRelType: relClass / relClass (inverse)`]:<br>1. `relationship: References / IsReferencedBy`<br>2. `relationship: IsIdenticalTo`<br>3. `relationship: IsContinuedBy / Continues`<br>4. `relationship: IsDocumentedBy / Documents`<br>5. `relationship: Documents / IsDocumentedBy`<br>6. `relationship: IsCompiledBy / Compiles`<br>7. `version: IsPreviousVersionOf / IsNewVersionOf`<br>8. `version: IsSourceOf / IsDerivedFrom`<br>9. `version: IsVariantFormOf / IsOriginalFormOf`<br>10. `version: IsObsoletedBy / Obsoletes`<br>11. `version: IsVersionOf / HasVersion` | beta |
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -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.6.13</tag>
|
||||
</scm>
|
||||
|
||||
<description>This module contains common schema classes meant to be used across the dnet-hadoop submodules</description>
|
||||
|
|
|
@ -4,7 +4,6 @@ package eu.dnetlib.dhp.schema.action;
|
|||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
@ -12,10 +11,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
|
||||
import eu.dnetlib.dhp.schema.oaf.Oaf;
|
||||
|
||||
public class AtomicActionDeserializer extends JsonDeserializer {
|
||||
public class AtomicActionDeserializer<T extends Oaf> extends JsonDeserializer<AtomicAction<T>> {
|
||||
|
||||
@Override
|
||||
public Object deserialize(JsonParser jp, DeserializationContext ctxt)
|
||||
@SuppressWarnings("unchecked")
|
||||
public AtomicAction<T> deserialize(JsonParser jp, DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
JsonNode node = jp.getCodec().readTree(jp);
|
||||
String classTag = node.get("clazz").asText();
|
||||
|
@ -23,8 +23,9 @@ public class AtomicActionDeserializer extends JsonDeserializer {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
final Class<?> clazz = Class.forName(classTag);
|
||||
return new AtomicAction(clazz, (Oaf) mapper.readValue(payload.toString(), clazz));
|
||||
final Class<T> clazz = (Class<T>) Class.forName(classTag);
|
||||
final T oaf = mapper.readValue(payload.toString(), clazz);
|
||||
return new AtomicAction(clazz, oaf);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package eu.dnetlib.dhp.schema.common;
|
|||
|
||||
import java.util.Comparator;
|
||||
|
||||
import eu.dnetlib.dhp.schema.oaf.AccessRight;
|
||||
import eu.dnetlib.dhp.schema.oaf.Qualifier;
|
||||
|
||||
public class AccessRightComparator<T extends Qualifier> implements Comparator<T> {
|
||||
|
|
|
@ -8,6 +8,8 @@ import eu.dnetlib.dhp.schema.oaf.Qualifier;
|
|||
|
||||
public class ModelConstants {
|
||||
|
||||
private 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";
|
||||
|
|
|
@ -7,13 +7,14 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.ParseException;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import com.github.sisyphsu.dateparser.DateParserUtils;
|
||||
import com.google.common.collect.Maps;
|
||||
|
|
|
@ -13,6 +13,8 @@ public class AccessRight extends Qualifier {
|
|||
|
||||
private String scheme;
|
||||
|
||||
private OpenAccessRoute openAccessRoute ;
|
||||
|
||||
public String getScheme() {
|
||||
return scheme;
|
||||
}
|
||||
|
@ -28,4 +30,12 @@ public class AccessRight extends Qualifier {
|
|||
ar.setScheme(scheme);
|
||||
return ar;
|
||||
}
|
||||
|
||||
public OpenAccessRoute getOpenAccessRoute() {
|
||||
return openAccessRoute;
|
||||
}
|
||||
|
||||
public void setOpenAccessRoute(OpenAccessRoute openAccessRoute) {
|
||||
this.openAccessRoute = openAccessRoute;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package eu.dnetlib.dhp.schema.dump.oaf;
|
||||
|
||||
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
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package eu.dnetlib.dhp.schema.dump.oaf;
|
||||
|
||||
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
|
||||
|
|
|
@ -12,14 +12,20 @@ import java.util.List;
|
|||
* type of type String to store the type of the instance as defined in the corresponding dnet vocabulary
|
||||
* (dnet:pubication_resource). It corresponds to the instancetype.classname of the instance to be mapped - url of type
|
||||
* List<String> list of locations where the instance is accessible. It corresponds to url of the instance to be dumped -
|
||||
* publicationdate of type String to store the publication date of the instance ;// dateofacceptance;
|
||||
* - refereed of type
|
||||
* publicationdate of type String to store the publication date of the instance ;// dateofacceptance; - refereed of type
|
||||
* String to store information abour the review status of the instance. Possible values are 'Unknown',
|
||||
* 'nonPeerReviewed', 'peerReviewed'. It corresponds to refereed.classname of the instance to be dumped
|
||||
* - articleprocessingcharge of type APC to store the article processing charges possibly associated to the instance
|
||||
* -pid of type List<ControlledField> that is the list of pids associated to the result coming from authoritative sources for that pid
|
||||
* -alternateIdentifier of type List<ControlledField> that is the list of pids associated to the result coming from NON authoritative
|
||||
* sources for that pid
|
||||
*/
|
||||
public class Instance implements Serializable {
|
||||
|
||||
private List<ControlledField> pid;
|
||||
|
||||
private List<ControlledField> alternateIdentifier;
|
||||
|
||||
private String license;
|
||||
|
||||
private AccessRight accessright;
|
||||
|
@ -28,10 +34,10 @@ public class Instance implements Serializable {
|
|||
|
||||
private List<String> url;
|
||||
|
||||
private String publicationdate;// dateofacceptance;
|
||||
|
||||
private APC articleprocessingcharge;
|
||||
|
||||
private String publicationdate;// dateofacceptance;
|
||||
|
||||
private String refereed; // peer-review status
|
||||
|
||||
public String getLicense() {
|
||||
|
@ -89,4 +95,20 @@ public class Instance implements Serializable {
|
|||
public void setArticleprocessingcharge(APC articleprocessingcharge) {
|
||||
this.articleprocessingcharge = articleprocessingcharge;
|
||||
}
|
||||
|
||||
public List<ControlledField> getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(List<ControlledField> pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public List<ControlledField> getAlternateIdentifier() {
|
||||
return alternateIdentifier;
|
||||
}
|
||||
|
||||
public void setAlternateIdentifier(List<ControlledField> alternateIdentifier) {
|
||||
this.alternateIdentifier = alternateIdentifier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.dump.oaf;
|
||||
|
||||
/**
|
||||
* This Enum models the OpenAccess status, currently including only the values from Unpaywall
|
||||
*
|
||||
* https://support.unpaywall.org/support/solutions/articles/44001777288-what-do-the-types-of-oa-status-green-gold-hybrid-and-bronze-mean-
|
||||
*/
|
||||
public enum OpenAccessRoute {
|
||||
|
||||
gold, green, hybrid, bronze
|
||||
|
||||
}
|
|
@ -3,10 +3,6 @@ package eu.dnetlib.dhp.schema.dump.oaf;
|
|||
|
||||
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
|
||||
* (generally the classid of the eu.dnetlib.dhp.schema.oaf.Qualifier element) - label to store the label (generally the
|
||||
|
|
|
@ -4,8 +4,6 @@ package eu.dnetlib.dhp.schema.dump.oaf;
|
|||
import java.io.Serializable;
|
||||
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
|
||||
* Initiative/Infrastructures. It has the following parameters: - author of type
|
||||
|
@ -62,9 +60,12 @@ import eu.dnetlib.dhp.schema.dump.oaf.community.Project;
|
|||
* to store information about the time OpenAIRE collected the record. It corresponds to dateofcollection of the result
|
||||
* represented in the internal model - lasteupdatetimestamp of type String to store the timestamp of the last update of
|
||||
* the record. It corresponds to lastupdatetimestamp of the resord represented in the internal model
|
||||
* -measure list<KeyValue> to represent the measure of beepFinder. It corresponds to measures in the model
|
||||
*/
|
||||
public class Result implements Serializable {
|
||||
|
||||
private List<KeyValue> measures;
|
||||
|
||||
private List<Author> author;
|
||||
|
||||
// resulttype allows subclassing results into publications | datasets | software
|
||||
|
@ -376,4 +377,12 @@ public class Result implements Serializable {
|
|||
public void setGeolocation(List<GeoLocation> geolocation) {
|
||||
this.geolocation = geolocation;
|
||||
}
|
||||
|
||||
public List<KeyValue> getMeasures() {
|
||||
return measures;
|
||||
}
|
||||
|
||||
public void setMeasures(List<KeyValue> measures) {
|
||||
this.measures = measures;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.community;
|
|||
|
||||
import java.util.List;
|
||||
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.Qualifier;
|
||||
|
@ -32,9 +34,13 @@ public class Context extends Qualifier {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
String provenance = "";
|
||||
this.provenance.forEach(p -> provenance.concat(p.toString()));
|
||||
return Objects.hash(getCode(), getLabel(), provenance);
|
||||
final String p = Optional.ofNullable(getProvenance())
|
||||
.map(prov -> prov.stream()
|
||||
.map(Provenance::toString)
|
||||
.collect(Collectors.joining()))
|
||||
.orElse("");
|
||||
|
||||
return Objects.hash(getCode(), getLabel(), p);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
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: -
|
||||
* shortName of type String to store the funder short name (e.c. AKA). - name of type String to store the funder name
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.dump.oaf.community;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
|
||||
import eu.dnetlib.dhp.schema.dump.oaf.Container;
|
||||
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: -
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
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
|
||||
* eu.dnetlib.dhp.schema.dump.oaf.Funder with the following parameter: - - private
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package eu.dnetlib.dhp.schema.dump.oaf.graph;
|
||||
|
||||
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
|
||||
|
|
|
@ -5,10 +5,7 @@ import java.io.Serializable;
|
|||
import java.util.List;
|
||||
|
||||
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.community.Project;
|
||||
|
||||
/**
|
||||
* To represent the generic organizaiton. It has the following parameters: - private String legalshortname to store the
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.io.Serializable;
|
|||
*/
|
||||
public class ResearchInitiative implements Serializable {
|
||||
private String id; // openaireId
|
||||
private String originalId; // context id
|
||||
private String acronym; // context id
|
||||
private String name; // context name
|
||||
private String type; // context type: research initiative or research community
|
||||
private String description;
|
||||
|
@ -57,12 +57,12 @@ public class ResearchInitiative implements Serializable {
|
|||
this.name = label;
|
||||
}
|
||||
|
||||
public String getOriginalId() {
|
||||
return originalId;
|
||||
public String getAcronym() {
|
||||
return acronym;
|
||||
}
|
||||
|
||||
public void setOriginalId(String originalId) {
|
||||
this.originalId = originalId;
|
||||
public void setAcronym(String acronym) {
|
||||
this.acronym = acronym;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
|
@ -18,6 +18,7 @@ public class AccessRight extends Qualifier {
|
|||
this.openAccessRoute = openAccessRoute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toComparableString() {
|
||||
String s = super.toComparableString();
|
||||
return Optional
|
||||
|
|
|
@ -16,7 +16,7 @@ public class Measure {
|
|||
private String id;
|
||||
|
||||
/**
|
||||
* List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value, plus
|
||||
* List of units associated with this measure. KeyValue provides a pair to store the label (key) and the value, plus
|
||||
* common provenance information.
|
||||
*/
|
||||
private List<KeyValue> unit;
|
||||
|
|
|
@ -96,7 +96,8 @@ public abstract class OafEntity extends Oaf implements Serializable {
|
|||
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
|
||||
.stream(lists)
|
||||
|
|
|
@ -348,10 +348,6 @@ public class Project extends OafEntity implements Serializable {
|
|||
: contactemail;
|
||||
summary = p.getSummary() != null && compareTrust(this, e) < 0 ? p.getSummary() : summary;
|
||||
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)){
|
||||
h2020topiccode = p.getH2020topiccode();
|
||||
|
|
|
@ -4,9 +4,9 @@ package eu.dnetlib.dhp.schema.oaf;
|
|||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||
|
||||
|
|
|
@ -349,10 +349,10 @@ public class Result extends OafEntity implements Serializable {
|
|||
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)
|
||||
for (StructuredProperty title : titles) {
|
||||
if (title.getQualifier() != null && title.getQualifier().getClassid() != null)
|
||||
if (title.getQualifier().getClassid().equals("main title"))
|
||||
return title;
|
||||
for (StructuredProperty t : titles) {
|
||||
if (t.getQualifier() != null && t.getQualifier().getClassid() != null)
|
||||
if (t.getQualifier().getClassid().equals("main title"))
|
||||
return t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.util.stream.Stream;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class StructuredProperty implements Serializable {
|
||||
|
||||
private String value;
|
||||
|
|
|
@ -22,6 +22,8 @@ public class CleaningFunctions {
|
|||
PID_BLACKLIST.add("na");
|
||||
}
|
||||
|
||||
public CleaningFunctions() {}
|
||||
|
||||
/**
|
||||
* Utility method that filter PID values on a per-type basis.
|
||||
* @param s the PID whose value will be checked.
|
||||
|
|
|
@ -120,7 +120,7 @@ public class IdentifierFactory implements Serializable {
|
|||
return pids
|
||||
.values()
|
||||
.stream()
|
||||
.flatMap(s -> s.stream())
|
||||
.flatMap(Set::stream)
|
||||
.min(new PidComparator<>(entity))
|
||||
.map(
|
||||
min -> Optional
|
||||
|
@ -140,8 +140,7 @@ public class IdentifierFactory implements Serializable {
|
|||
if (entity instanceof Result) {
|
||||
return Optional
|
||||
.ofNullable(((Result) entity).getInstance())
|
||||
.map(
|
||||
instance -> mapPids(instance))
|
||||
.map(IdentifierFactory::mapPids)
|
||||
.orElse(new HashMap<>());
|
||||
} else {
|
||||
return entity
|
||||
|
@ -247,7 +246,6 @@ public class IdentifierFactory implements Serializable {
|
|||
md.update(s.getBytes(StandardCharsets.UTF_8));
|
||||
return new String(Hex.encodeHex(md.digest()));
|
||||
} catch (final Exception e) {
|
||||
System.err.println("Error creating id");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.oaf.utils;
|
|||
|
||||
public class ModelHardLimits {
|
||||
|
||||
private ModelHardLimits() {}
|
||||
|
||||
public static final String LAYOUT = "index";
|
||||
public static final String INTERPRETATION = "openaire";
|
||||
public static final String SEPARATOR = "-";
|
||||
|
|
|
@ -34,4 +34,6 @@ public class PidBlacklistProvider {
|
|||
.orElse(new HashSet<>());
|
||||
}
|
||||
|
||||
private PidBlacklistProvider() {}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Optional;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||
import eu.dnetlib.dhp.schema.oaf.KeyValue;
|
||||
import eu.dnetlib.dhp.schema.oaf.Result;
|
||||
|
||||
public class ResultTypeComparator implements Comparator<Result> {
|
||||
|
@ -69,7 +70,7 @@ public class ResultTypeComparator implements Comparator<Result> {
|
|||
.map(
|
||||
cf -> cf
|
||||
.stream()
|
||||
.map(c -> c.getKey())
|
||||
.map(KeyValue::getKey)
|
||||
.collect(Collectors.toCollection(HashSet::new)))
|
||||
.orElse(new HashSet<>());
|
||||
}
|
||||
|
|
|
@ -3,12 +3,9 @@ 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;
|
||||
|
|
|
@ -4,11 +4,6 @@ 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
|
||||
*/
|
||||
|
|
|
@ -14,10 +14,11 @@ import eu.dnetlib.dhp.schema.common.ModelConstants;
|
|||
import eu.dnetlib.dhp.schema.oaf.Relation;
|
||||
|
||||
/** @author claudio.atzori */
|
||||
public class AtomicActionTest {
|
||||
class AtomicActionTest {
|
||||
|
||||
@Test
|
||||
public void serializationTest() throws IOException {
|
||||
@SuppressWarnings("unchecked")
|
||||
void serializationTest() throws IOException {
|
||||
|
||||
Relation rel = new Relation();
|
||||
rel.setSource("1");
|
||||
|
|
|
@ -17,7 +17,7 @@ public class ModelSupportTest {
|
|||
class IsSubClass {
|
||||
|
||||
@Test
|
||||
public void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() {
|
||||
void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() {
|
||||
// when
|
||||
Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class);
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class ModelSupportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnTrueWhenSubClassExtendsSuperClass() {
|
||||
void shouldReturnTrueWhenSubClassExtendsSuperClass() {
|
||||
// when
|
||||
Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class);
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class MeasureTest {
|
||||
class MeasureTest {
|
||||
|
||||
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
|
||||
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
|
||||
@Test
|
||||
public void testMeasureSerialization() throws IOException {
|
||||
void testMeasureSerialization() throws IOException {
|
||||
|
||||
Measure popularity = new Measure();
|
||||
popularity.setId("popularity");
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class MergeTest {
|
||||
class MergeTest {
|
||||
|
||||
OafEntity oaf;
|
||||
|
||||
|
@ -20,7 +20,8 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergeListsTest() {
|
||||
@SuppressWarnings("unchecked")
|
||||
void mergeListsTest() {
|
||||
|
||||
// string list merge test
|
||||
List<String> a = Arrays.asList("a", "b", "c", "e");
|
||||
|
@ -35,7 +36,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationCollectedFromTest() {
|
||||
void mergePublicationCollectedFromTest() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
@ -50,7 +51,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_bothPresent() {
|
||||
void mergePublicationDateOfAcceptanceTest_bothPresent() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
@ -65,7 +66,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_bothPresent_1() {
|
||||
void mergePublicationDateOfAcceptanceTest_bothPresent_1() {
|
||||
|
||||
Publication a = publication("0.8");
|
||||
Publication b = publication("0.9");
|
||||
|
@ -80,7 +81,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_bothPresent_2() {
|
||||
void mergePublicationDateOfAcceptanceTest_bothPresent_2() {
|
||||
|
||||
Publication a = publication("0.9");
|
||||
Publication b = publication("0.8");
|
||||
|
@ -95,7 +96,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_leftMissing() {
|
||||
void mergePublicationDateOfAcceptanceTest_leftMissing() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
@ -109,7 +110,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_leftMissing_1() {
|
||||
void mergePublicationDateOfAcceptanceTest_leftMissing_1() {
|
||||
|
||||
Publication a = publication("0.9");
|
||||
Publication b = publication("0.8");
|
||||
|
@ -123,7 +124,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_leftMissing_2() {
|
||||
void mergePublicationDateOfAcceptanceTest_leftMissing_2() {
|
||||
|
||||
Publication a = publication("0.8");
|
||||
Publication b = publication("0.9");
|
||||
|
@ -137,7 +138,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_rightMissing() {
|
||||
void mergePublicationDateOfAcceptanceTest_rightMissing() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
@ -151,7 +152,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_rightMissing_1() {
|
||||
void mergePublicationDateOfAcceptanceTest_rightMissing_1() {
|
||||
|
||||
Publication a = publication("0.8");
|
||||
Publication b = publication("0.9");
|
||||
|
@ -165,7 +166,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationDateOfAcceptanceTest_rightMissing_2() {
|
||||
void mergePublicationDateOfAcceptanceTest_rightMissing_2() {
|
||||
|
||||
Publication a = publication("0.9");
|
||||
Publication b = publication("0.8");
|
||||
|
@ -179,7 +180,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergePublicationSubjectTest() {
|
||||
void mergePublicationSubjectTest() {
|
||||
|
||||
Publication a = publication();
|
||||
Publication b = publication();
|
||||
|
@ -194,7 +195,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergeRelationTest() {
|
||||
void mergeRelationTest() {
|
||||
|
||||
Relation a = createRel(null, null);
|
||||
Relation b = createRel(null, null);
|
||||
|
@ -235,7 +236,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mergeRelationTestParseException() {
|
||||
void mergeRelationTestParseException() {
|
||||
assertThrows(DateTimeParseException.class, () -> {
|
||||
Relation a = createRel(true, "Once upon a time ...");
|
||||
Relation b = createRel(true, "... in a far away land");
|
||||
|
@ -279,7 +280,7 @@ public class MergeTest {
|
|||
}
|
||||
|
||||
private <T> Field<T> field(T value) {
|
||||
Field<T> f = new Field<T>();
|
||||
Field<T> f = new Field();
|
||||
f.setValue(value);
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ import java.util.Set;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class BlackListProviderTest {
|
||||
class BlackListProviderTest {
|
||||
|
||||
@Test
|
||||
public void blackListTest() {
|
||||
void blackListTest() {
|
||||
|
||||
Assertions.assertNotNull(PidBlacklistProvider.getBlacklist());
|
||||
Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi"));
|
||||
|
|
|
@ -14,13 +14,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
|
||||
import eu.dnetlib.dhp.schema.oaf.Publication;
|
||||
|
||||
public class IdentifierFactoryTest {
|
||||
class IdentifierFactoryTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
@Test
|
||||
public void testCreateIdentifierForPublication() throws IOException {
|
||||
void testCreateIdentifierForPublication() throws IOException {
|
||||
|
||||
verifyIdentifier(
|
||||
"publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true);
|
||||
|
@ -51,7 +51,7 @@ public class IdentifierFactoryTest {
|
|||
}
|
||||
|
||||
@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_doi2.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false);
|
||||
|
|
Loading…
Reference in New Issue