Merge pull request 'COAR based resource & irish tender fields' (#25) from resource_types into master
Reviewed-on: #25
This commit is contained in:
commit
77a12c0a2d
75
CHANGES.md
75
CHANGES.md
|
@ -2,41 +2,42 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
| **Version** | **Changes** | **Readiness** |
|
||||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| 3.17.1 | [Graph model] </br> <ul><li>added fulltext field on the instance level.</li><li>added extra organization specific PID types</li><ul> | beta |
|
||||
| 3.16.0 | [Graph model] </br> <ul><li>added entity level measures.</li><ul> | beta |
|
||||
| 3.15.0 | [Graph model] </br> <ul><li>added w3id as PID type, with ROHub as authority.</li> <ul> | beta |
|
||||
| 3.14.0 | [Graph model] </br> <ul><li>introduced specific type for result.subject</li> <ul> | beta |
|
||||
| 2.13.0 | [Scholexplorer] </br> <ul><li>update swagger annotation jar version to be compatible with new implementation of openAPI ui</li> <ul> | beta |
|
||||
| 2.12.1 | [Graph model] </br> <ul><li>added field oafEntity.eoscifguidelines</li> <ul> | production |
|
||||
| 2.12.0 | [Graph model] </br> <ul><li>Introducing EOSC Services as datasources</li> <ul> | production |
|
||||
| 2.11.33 | [Scholexplorer] </br> <ul><li>Moved Scholix API Data model into dhp-schemas</li><li>implementation of the compareTo method on Scholix objects and all model properties</li> <li>Unit Test to verify that compareTo works on different case</li> <ul> | production |
|
||||
| 2.10.31 | [Minor] </br>NPE checks | production |
|
||||
| 2.10.30 | [Minor] </br>added comparator for refereed field instances | production |
|
||||
| 2.10.29 | [Merge Result] </br>merge logics changed to consider invisble in dataInfo | production |
|
||||
| 2.10.28 | [Graph Model] </br> Added APC information at the level of the result | production |
|
||||
| 2.10.27 | [Graph Model] </br> change name and id of OpenAPC datasource | production |
|
||||
| 2.10.26 | [Graph Model] </br> OpenAIRE ids of the delegated authorities and enrichment providers in the identifier creation strategy | production |
|
||||
| 2.10.25 | [Graph model]</br>implemented enrichment on Result specializing in the method mergefrom. | production |
|
||||
| 2.10.24 | [Graph model]</br>added utility method and constants for checking weather is an OafEntity represents an enrichment. | production |
|
||||
| 2.9.24 | [Dump model]</br>change the names of the classes to be able to automatically create the json schema with specific descriptions | production |
|
||||
| 2.9.23 | [Graph model]<br>Added Instance.measures field, allowing to maintain the association between them and the individual result instance</br>[Dump model]</br>added json schemas | production |
|
||||
| 2.8.22 | [Graph model]<br>minor: added serializable to the Measures model class</br>[Dump model]</br>added dedicated BestAccessRight class, used at the result level instead of AccessRight | production |
|
||||
| 2.8.21 | [Graph model]<br>added the following relation terms Describes/IsDescribedBy, IsMetadataFor/IsMetadataOf, HasAssociationWith/HasAssociationWith, IsRequiredBy/Requires. All these are used in combination with the relation subRelType "relationship" | production |
|
||||
| 2.8.20 | [Graph model]<br>added constants declaring the values used for hierarchical relationships among the organizations IsParentOf / IsChildOf | production |
|
||||
| 2.7.18-19 | [Dump model]<br>include validation info in relations<br>[Graph model]<br>added constants declaring vocabulary names for relation fields | production |
|
||||
| 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 | production |
|
||||
| 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` | production |
|
||||
| 2.7.15 | 1. added support for delegated authorities<br>2. fixed regex for DOI cleaning | production |
|
||||
| 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` | production |
|
||||
| 2.6.14 | [Scholexplorer]<br>1. Added model classes for Scholexplorer, package `eu.dnetlib.dhp.schema.sx` | production |
|
||||
| 2.6.13 | 1. `Result.mergeFrom` handles field `dateOfAcceptance` | production |
|
||||
| 2.5.12 | 1. delegating the date parsing to https://github.com/sisyphsu/dateparser | production |
|
||||
| 2.5.[11-9] | 1. support for more date formats<br>2. enable the possibility to extend the date formats used to parse `Relation.validationDate` | production |
|
||||
| 2.4.8 | 1. added constant for ORCID datasource name | production |
|
||||
| 2.4.7 | refactoring | production |
|
||||
| 2.3.6 | [Aggregation]<br>1. introduced MetadataStoreManager (MdSM) model classes | production |
|
||||
| 2.2.5 | [Graph model]<br>1. introduced fields `Instance.pid` and `Instance.alternateIdentifier`<br>2. `LicenseComparator` renamed as `AccessRightComparator`<br>3. introduced `AccessRight` model class defining the `OpenAccessRoute` field to keep track of the OpenAccess color at the `Instance` level<br>4. `ExternalReference` cleanup (removed description, added alternateLabel(s))<br>5. added several ModelConstants<br>[Aggregation]<br>7. introduced MDStore record model classes<br>8. Introduced ORCID specific model classes | production |
|
||||
| 2.2.4 | 1. ORCID specific model classes backported in the version used in PROD<br>2. added constant for dnet:externalReference_typologies<br>3. added constant for ORCID datasource name<br>4. `Result.mergeFrom` handles field `dateOfAcceptance` | production |
|
||||
| **Version** | **Changes** | **Readiness** |
|
||||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| 4.17.1 | [Graph model] </br> <ul><li>added InstaceTypeMapping field on the instance level.</li><li>new result level fields to support the activities in the Irish tender `isGreen`, `openAccessColor`, `isInDiamondJournal`, `publiclyFunded`</li><ul> | beta |
|
||||
| 3.17.1 | [Graph model] </br> <ul><li>added fulltext field on the instance level.</li><li>added extra organization specific PID types</li><ul> | production |
|
||||
| 3.16.0 | [Graph model] </br> <ul><li>added entity level measures.</li><ul> | production |
|
||||
| 3.15.0 | [Graph model] </br> <ul><li>added w3id as PID type, with ROHub as authority.</li> <ul> | production |
|
||||
| 3.14.0 | [Graph model] </br> <ul><li>introduced specific type for result.subject</li> <ul> | production |
|
||||
| 2.13.0 | [Scholexplorer] </br> <ul><li>update swagger annotation jar version to be compatible with new implementation of openAPI ui</li> <ul> | production |
|
||||
| 2.12.1 | [Graph model] </br> <ul><li>added field oafEntity.eoscifguidelines</li> <ul> | production |
|
||||
| 2.12.0 | [Graph model] </br> <ul><li>Introducing EOSC Services as datasources</li> <ul> | production |
|
||||
| 2.11.33 | [Scholexplorer] </br> <ul><li>Moved Scholix API Data model into dhp-schemas</li><li>implementation of the compareTo method on Scholix objects and all model properties</li> <li>Unit Test to verify that compareTo works on different case</li> <ul> | production |
|
||||
| 2.10.31 | [Minor] </br>NPE checks | production |
|
||||
| 2.10.30 | [Minor] </br>added comparator for refereed field instances | production |
|
||||
| 2.10.29 | [Merge Result] </br>merge logics changed to consider invisble in dataInfo | production |
|
||||
| 2.10.28 | [Graph Model] </br> Added APC information at the level of the result | production |
|
||||
| 2.10.27 | [Graph Model] </br> change name and id of OpenAPC datasource | production |
|
||||
| 2.10.26 | [Graph Model] </br> OpenAIRE ids of the delegated authorities and enrichment providers in the identifier creation strategy | production |
|
||||
| 2.10.25 | [Graph model]</br>implemented enrichment on Result specializing in the method mergefrom. | production |
|
||||
| 2.10.24 | [Graph model]</br>added utility method and constants for checking weather is an OafEntity represents an enrichment. | production |
|
||||
| 2.9.24 | [Dump model]</br>change the names of the classes to be able to automatically create the json schema with specific descriptions | production |
|
||||
| 2.9.23 | [Graph model]<br>Added Instance.measures field, allowing to maintain the association between them and the individual result instance</br>[Dump model]</br>added json schemas | production |
|
||||
| 2.8.22 | [Graph model]<br>minor: added serializable to the Measures model class</br>[Dump model]</br>added dedicated BestAccessRight class, used at the result level instead of AccessRight | production |
|
||||
| 2.8.21 | [Graph model]<br>added the following relation terms Describes/IsDescribedBy, IsMetadataFor/IsMetadataOf, HasAssociationWith/HasAssociationWith, IsRequiredBy/Requires. All these are used in combination with the relation subRelType "relationship" | production |
|
||||
| 2.8.20 | [Graph model]<br>added constants declaring the values used for hierarchical relationships among the organizations IsParentOf / IsChildOf | production |
|
||||
| 2.7.18-19 | [Dump model]<br>include validation info in relations<br>[Graph model]<br>added constants declaring vocabulary names for relation fields | production |
|
||||
| 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 | production |
|
||||
| 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` | production |
|
||||
| 2.7.15 | 1. added support for delegated authorities<br>2. fixed regex for DOI cleaning | production |
|
||||
| 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` | production |
|
||||
| 2.6.14 | [Scholexplorer]<br>1. Added model classes for Scholexplorer, package `eu.dnetlib.dhp.schema.sx` | production |
|
||||
| 2.6.13 | 1. `Result.mergeFrom` handles field `dateOfAcceptance` | production |
|
||||
| 2.5.12 | 1. delegating the date parsing to https://github.com/sisyphsu/dateparser | production |
|
||||
| 2.5.[11-9] | 1. support for more date formats<br>2. enable the possibility to extend the date formats used to parse `Relation.validationDate` | production |
|
||||
| 2.4.8 | 1. added constant for ORCID datasource name | production |
|
||||
| 2.4.7 | refactoring | production |
|
||||
| 2.3.6 | [Aggregation]<br>1. introduced MetadataStoreManager (MdSM) model classes | production |
|
||||
| 2.2.5 | [Graph model]<br>1. introduced fields `Instance.pid` and `Instance.alternateIdentifier`<br>2. `LicenseComparator` renamed as `AccessRightComparator`<br>3. introduced `AccessRight` model class defining the `OpenAccessRoute` field to keep track of the OpenAccess color at the `Instance` level<br>4. `ExternalReference` cleanup (removed description, added alternateLabel(s))<br>5. added several ModelConstants<br>[Aggregation]<br>7. introduced MDStore record model classes<br>8. Introduced ORCID specific model classes | production |
|
||||
| 2.2.4 | 1. ORCID specific model classes backported in the version used in PROD<br>2. added constant for dnet:externalReference_typologies<br>3. added constant for ORCID datasource name<br>4. `Result.mergeFrom` handles field `dateOfAcceptance` | production |
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<groupId>eu.dnetlib.dhp</groupId>
|
||||
<artifactId>dhp-schemas</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>3.17.3-SNAPSHOT</version>
|
||||
<version>4.17.2-SNAPSHOT</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
|
|
|
@ -62,7 +62,9 @@ public class ModelConstants {
|
|||
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 OPENAIRE_COAR_RESOURCE_TYPES_3_1 = "openaire::coar_resource_types_3_1";
|
||||
public static final String OPENAIRE_USER_RESOURCE_TYPES = "openaire::user_resource_types";
|
||||
public static final String OPENAIRE_META_RESOURCE_TYPE = "openaire::meta_resource_types";
|
||||
public static final String PEER_REVIEWED_CLASSNAME = "nonPeerReviewed";
|
||||
public static final String NON_PEER_REVIEWED_CLASSNAME = "nonPeerReviewed";
|
||||
public static final String PEER_REVIEWED_CLASSID = "0001";
|
||||
|
|
|
@ -12,6 +12,8 @@ public class Instance implements Serializable {
|
|||
|
||||
private Qualifier instancetype;
|
||||
|
||||
private List<InstanceTypeMapping> instanceTypeMapping;
|
||||
|
||||
private KeyValue hostedby;
|
||||
|
||||
private List<String> url;
|
||||
|
@ -68,6 +70,14 @@ public class Instance implements Serializable {
|
|||
this.instancetype = instancetype;
|
||||
}
|
||||
|
||||
public List<InstanceTypeMapping> getInstanceTypeMapping() {
|
||||
return instanceTypeMapping;
|
||||
}
|
||||
|
||||
public void setInstanceTypeMapping(List<InstanceTypeMapping> instanceTypeMapping) {
|
||||
this.instanceTypeMapping = instanceTypeMapping;
|
||||
}
|
||||
|
||||
public KeyValue getHostedby() {
|
||||
return hostedby;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Defines a mapping between the original resource types and the type code and label available in a given vocabulary.
|
||||
*/
|
||||
public class InstanceTypeMapping implements Serializable {
|
||||
|
||||
/**
|
||||
* Original resource type, typically mapped from dc:type, datacite:resourceType.
|
||||
*/
|
||||
private String originalType;
|
||||
|
||||
/**
|
||||
* Contains the code of the resource type resulted from the mapping.
|
||||
*/
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* Contains the label of the resource type resulted from the mapping.
|
||||
*/
|
||||
private String typeLabel;
|
||||
|
||||
/**
|
||||
* Contains name of the vocabulary used to produce this resource type mapping.
|
||||
*/
|
||||
private String vocabularyName;
|
||||
|
||||
public String getOriginalType() {
|
||||
return originalType;
|
||||
}
|
||||
|
||||
public void setOriginalType(String originalType) {
|
||||
this.originalType = originalType;
|
||||
}
|
||||
|
||||
public String getTypeCode() {
|
||||
return typeCode;
|
||||
}
|
||||
|
||||
public void setTypeCode(String typeCode) {
|
||||
this.typeCode = typeCode;
|
||||
}
|
||||
|
||||
public String getTypeLabel() {
|
||||
return typeLabel;
|
||||
}
|
||||
|
||||
public void setTypeLabel(String typeLabel) {
|
||||
this.typeLabel = typeLabel;
|
||||
}
|
||||
|
||||
public String getVocabularyName() {
|
||||
return vocabularyName;
|
||||
}
|
||||
|
||||
public void setVocabularyName(String vocabularyName) {
|
||||
this.vocabularyName = vocabularyName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
/**
|
||||
* The OpenAccess color meant to be used on the result level
|
||||
*/
|
||||
public enum OpenAccessColor {
|
||||
|
||||
gold, hybrid, bronze
|
||||
|
||||
}
|
|
@ -1,14 +1,19 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import static java.util.Objects.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||
import eu.dnetlib.dhp.schema.oaf.utils.CleaningFunctions;
|
||||
|
@ -21,17 +26,13 @@ public class Result extends OafEntity implements Serializable {
|
|||
/**
|
||||
* ( article | book ) processing charges.
|
||||
*/
|
||||
|
||||
private Field<String> processingchargeamount;
|
||||
|
||||
|
||||
/**
|
||||
* currency - alphabetic code describe in ISO-4217.
|
||||
*/
|
||||
private Field<String> processingchargecurrency;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Author.
|
||||
*/
|
||||
|
@ -43,6 +44,11 @@ public class Result extends OafEntity implements Serializable {
|
|||
// resulttype allows subclassing results into publications | datasets | software
|
||||
private Qualifier resulttype;
|
||||
|
||||
/**
|
||||
* Temporary field suporting the analysis of the new COAR-based resource types
|
||||
*/
|
||||
private Qualifier metaResourceType;
|
||||
|
||||
/**
|
||||
* The Language.
|
||||
*/
|
||||
|
@ -144,7 +150,15 @@ public class Result extends OafEntity implements Serializable {
|
|||
*/
|
||||
private List<EoscIfGuidelines> eoscifguidelines;
|
||||
|
||||
@JsonProperty("isGreen")
|
||||
private Boolean isGreen;
|
||||
|
||||
private OpenAccessColor openAccessColor;
|
||||
|
||||
@JsonProperty("isInDiamondJournal")
|
||||
private Boolean isInDiamondJournal;
|
||||
|
||||
private Boolean publiclyFunded;
|
||||
|
||||
public Field<String> getProcessingchargeamount() {
|
||||
return processingchargeamount;
|
||||
|
@ -198,6 +212,14 @@ public class Result extends OafEntity implements Serializable {
|
|||
this.resulttype = resulttype;
|
||||
}
|
||||
|
||||
public Qualifier getMetaResourceType() {
|
||||
return metaResourceType;
|
||||
}
|
||||
|
||||
public void setMetaResourceType(Qualifier metaResourceType) {
|
||||
this.metaResourceType = metaResourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets language.
|
||||
*
|
||||
|
@ -548,6 +570,38 @@ public class Result extends OafEntity implements Serializable {
|
|||
this.eoscifguidelines = eoscifguidelines;
|
||||
}
|
||||
|
||||
public Boolean getIsGreen() {
|
||||
return isGreen;
|
||||
}
|
||||
|
||||
public void setIsGreen(Boolean green) {
|
||||
isGreen = green;
|
||||
}
|
||||
|
||||
public OpenAccessColor getOpenAccessColor() {
|
||||
return openAccessColor;
|
||||
}
|
||||
|
||||
public void setOpenAccessColor(OpenAccessColor openAccessColor) {
|
||||
this.openAccessColor = openAccessColor;
|
||||
}
|
||||
|
||||
public Boolean getIsInDiamondJournal() {
|
||||
return isInDiamondJournal;
|
||||
}
|
||||
|
||||
public void setIsInDiamondJournal(Boolean inDiamondJournal) {
|
||||
isInDiamondJournal = inDiamondJournal;
|
||||
}
|
||||
|
||||
public Boolean getPubliclyFunded() {
|
||||
return publiclyFunded;
|
||||
}
|
||||
|
||||
public void setPubliclyFunded(Boolean publiclyFunded) {
|
||||
this.publiclyFunded = publiclyFunded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is an enrichment boolean.
|
||||
*
|
||||
|
@ -560,7 +614,6 @@ public class Result extends OafEntity implements Serializable {
|
|||
&& ModelConstants.PROVENANCE_ENRICH.equalsIgnoreCase(e.getDataInfo().getProvenanceaction().getClassid());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Normalize pid string.
|
||||
*
|
||||
|
@ -684,11 +737,11 @@ public class Result extends OafEntity implements Serializable {
|
|||
|
||||
//ENRICH measures
|
||||
if (enrichment.getMeasures()!=null)
|
||||
if (currentInstance.getMeasures() == null)
|
||||
if (currentInstance.getMeasures() == null) {
|
||||
currentInstance.setMeasures(enrichment.getMeasures());
|
||||
else
|
||||
} else {
|
||||
enrichment.getMeasures().forEach(currentInstance.getMeasures()::add);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -712,11 +765,11 @@ public class Result extends OafEntity implements Serializable {
|
|||
|
||||
toEnrichInstances.forEach(i -> {
|
||||
final List<Instance> e = findEnrichmentsByPID(i.getPid(), ri);
|
||||
if (e!= null && e.size()> 0) {
|
||||
if (e!= null && !e.isEmpty()) {
|
||||
e.forEach(enr -> applyEnrichment(i, enr));
|
||||
} else {
|
||||
final List<Instance> a = findEnrichmentsByPID(i.getAlternateIdentifier(), ri);
|
||||
if (a!= null && a.size()> 0) {
|
||||
if (a!= null && !a.isEmpty()) {
|
||||
a.forEach(enr -> applyEnrichment(i, enr));
|
||||
}
|
||||
}
|
||||
|
@ -735,15 +788,25 @@ public class Result extends OafEntity implements Serializable {
|
|||
|
||||
Result r = (Result) e;
|
||||
|
||||
if(processingchargeamount == null || StringUtils.isBlank(processingchargeamount.getValue() )){
|
||||
if(processingchargeamount == null || StringUtils.isBlank(processingchargeamount.getValue())){
|
||||
processingchargeamount = r.getProcessingchargeamount();
|
||||
processingchargecurrency = r.getProcessingchargecurrency();
|
||||
}
|
||||
|
||||
|
||||
|
||||
eoscifguidelines = mergeLists(eoscifguidelines, r.getEoscifguidelines());
|
||||
|
||||
setIsGreen(mergeBooleanOR(getIsGreen(), r.getIsGreen()));
|
||||
|
||||
setIsInDiamondJournal(mergeBooleanOR(getIsInDiamondJournal(), r.getIsInDiamondJournal()));
|
||||
|
||||
setPubliclyFunded(mergeBooleanOR(getPubliclyFunded(), r.getPubliclyFunded()));
|
||||
|
||||
if (Boolean.logicalXor(nonNull(getOpenAccessColor()), nonNull(r.getOpenAccessColor()))) {
|
||||
setOpenAccessColor(ObjectUtils.firstNonNull(getOpenAccessColor(), r.getOpenAccessColor()));
|
||||
} else if (!Objects.equals(getOpenAccessColor(), r.getOpenAccessColor())) {
|
||||
setOpenAccessColor(null);
|
||||
}
|
||||
|
||||
if( !isAnEnrichment(this) && !isAnEnrichment(e))
|
||||
instance = mergeLists(instance, r.getInstance());
|
||||
else {
|
||||
|
@ -764,8 +827,8 @@ 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())) {
|
||||
if (nonNull(r.getDateofacceptance())) {
|
||||
if (isNull(getDateofacceptance())) {
|
||||
dateofacceptance = r.getDateofacceptance();
|
||||
} else if (compareTrust(this, r) < 0) {
|
||||
dateofacceptance = r.getDateofacceptance();
|
||||
|
@ -832,6 +895,16 @@ public class Result extends OafEntity implements Serializable {
|
|||
externalReference = mergeLists(externalReference, r.getExternalReference());
|
||||
}
|
||||
|
||||
private Boolean mergeBooleanOR(Boolean a, Boolean b) {
|
||||
if (Boolean.logicalXor(isNull(a), isNull(b))) {
|
||||
return ObjectUtils.firstNonNull(a, b);
|
||||
} else if (nonNull(a) & nonNull(b)) {
|
||||
return a || b;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Longest lists list.
|
||||
*
|
||||
|
|
|
@ -143,20 +143,16 @@ class MergeTest {
|
|||
List<Result> publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publication_apc.json", Publication.class);
|
||||
System.out.println(publications.size());
|
||||
publications.forEach(p -> assertEquals(1, p.getInstance().size()));
|
||||
publications.forEach(p -> assertTrue(p.getProcessingchargeamount() != null ));
|
||||
publications.forEach(p -> assertTrue(p.getProcessingchargecurrency() != null ));
|
||||
publications.forEach(p -> assertNotNull(p.getProcessingchargeamount()));
|
||||
publications.forEach(p -> assertNotNull(p.getProcessingchargecurrency()));
|
||||
publications.forEach(p -> assertTrue(StringUtils.isNotBlank(p.getProcessingchargeamount().getValue() )));
|
||||
publications.forEach(p -> assertTrue(StringUtils.isNotBlank(p.getProcessingchargecurrency().getValue() )));
|
||||
|
||||
publications.forEach(p -> p.getInstance().stream()
|
||||
.forEach(i -> assertTrue(i.getProcessingchargeamount() != null)));
|
||||
publications.forEach(p -> p.getInstance().stream()
|
||||
.forEach(i -> assertTrue(i.getProcessingchargecurrency() != null)));
|
||||
publications.forEach(p -> p.getInstance().forEach(i -> assertNotNull(i.getProcessingchargeamount())));
|
||||
publications.forEach(p -> p.getInstance().forEach(i -> assertNotNull(i.getProcessingchargecurrency())));
|
||||
|
||||
publications.forEach(p -> p.getInstance().stream()
|
||||
.forEach(i -> assertTrue(StringUtils.isNotBlank(i.getProcessingchargeamount().getValue()))));
|
||||
publications.forEach(p -> p.getInstance().stream()
|
||||
.forEach(i -> assertTrue(StringUtils.isNotBlank(i.getProcessingchargecurrency().getValue()))));
|
||||
publications.forEach(p -> p.getInstance().forEach(i -> assertTrue(StringUtils.isNotBlank(i.getProcessingchargeamount().getValue()))));
|
||||
publications.forEach(p -> p.getInstance().forEach(i -> assertTrue(StringUtils.isNotBlank(i.getProcessingchargecurrency().getValue()))));
|
||||
|
||||
Result p1 = publications.get(0);
|
||||
Result p2 = publications.get(1);
|
||||
|
@ -168,24 +164,25 @@ class MergeTest {
|
|||
|
||||
assertEquals(2 , p1.getInstance().size());
|
||||
|
||||
p1.getInstance().stream().forEach(i -> assertTrue(i.getProcessingchargeamount() != null));
|
||||
p1.getInstance().stream().forEach(i -> assertTrue(i.getProcessingchargecurrency() != null));
|
||||
p1.getInstance().forEach(i -> assertNotNull(i.getProcessingchargeamount()));
|
||||
p1.getInstance().forEach(i -> assertNotNull(i.getProcessingchargecurrency()));
|
||||
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount().getValue().equals("2000.47"));
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount().getValue().equals("1721.47"));
|
||||
assertTrue(p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount().getValue().equals("2000.47")));
|
||||
assertTrue(p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount().getValue().equals("1721.47")));
|
||||
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency().getValue().equals("EUR"));
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency().getValue().equals("USD"));
|
||||
assertTrue(p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency().getValue().equals("EUR")));
|
||||
assertTrue(p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency().getValue().equals("USD")));
|
||||
System.out.println(new ObjectMapper().writeValueAsString(p1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAPCMerge2() throws Exception {
|
||||
List<Result> publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publication_apc2.json", Publication.class);
|
||||
System.out.println(publications.size());
|
||||
publications.forEach(p -> assertEquals(1, p.getInstance().size()));
|
||||
assertTrue(publications.get(0).getProcessingchargeamount() != null );
|
||||
assertTrue(publications.get(0).getProcessingchargecurrency() != null );
|
||||
assertTrue(publications.get(1).getProcessingchargeamount() == null );
|
||||
assertNotNull(publications.get(0).getProcessingchargeamount());
|
||||
assertNotNull(publications.get(0).getProcessingchargecurrency());
|
||||
assertNull(publications.get(1).getProcessingchargeamount());
|
||||
|
||||
Result p1 = publications.get(1);
|
||||
Result p2 = publications.get(0);
|
||||
|
@ -198,9 +195,9 @@ class MergeTest {
|
|||
assertEquals("EUR", p1.getProcessingchargecurrency().getValue());
|
||||
|
||||
assertEquals(2 , p1.getInstance().size());
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount() != null);
|
||||
assertTrue(p1.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount() != null));
|
||||
|
||||
p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency() != null);
|
||||
assertTrue(p1.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency() != null));
|
||||
|
||||
assertEquals("1721.47", p1.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargeamount().getValue());
|
||||
|
@ -217,16 +214,47 @@ class MergeTest {
|
|||
assertEquals("EUR", p2.getProcessingchargecurrency().getValue());
|
||||
|
||||
assertEquals(2 , p2.getInstance().size());
|
||||
p2.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount() != null);
|
||||
assertTrue(p2.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount() != null));
|
||||
|
||||
p2.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency() != null);
|
||||
assertTrue(p2.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency() != null));
|
||||
|
||||
assertEquals("1721.47", p2.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargeamount().getValue());
|
||||
|
||||
assertEquals("EUR", p2.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargecurrency().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_merge_irish_1() throws Exception {
|
||||
List<Result> publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publication_irish_tender_1.json", Publication.class);
|
||||
|
||||
Publication p = new Publication();
|
||||
|
||||
publications.forEach(p::mergeFrom);
|
||||
|
||||
assertNotNull(p);
|
||||
|
||||
assertTrue(p.getIsGreen());
|
||||
assertTrue(p.getIsInDiamondJournal());
|
||||
assertFalse(p.getPubliclyFunded());
|
||||
assertEquals(OpenAccessColor.gold, p.getOpenAccessColor());
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_merge_irish_2() throws Exception {
|
||||
List<Result> publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publication_irish_tender_2.json", Publication.class);
|
||||
|
||||
Publication p = new Publication();
|
||||
|
||||
publications.forEach(p::mergeFrom);
|
||||
|
||||
assertNotNull(p);
|
||||
|
||||
assertTrue(p.getIsGreen());
|
||||
assertTrue(p.getIsInDiamondJournal());
|
||||
assertFalse(p.getPubliclyFunded());
|
||||
assertNull(p.getOpenAccessColor());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,7 +302,6 @@ class MergeTest {
|
|||
updatePidIntoPublicationInstance(publications, enrichment, true);
|
||||
applyAndVerifyEnrichment( enrichment, publications);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", "resulttype" : { "classid" : "publication" }, "pid":[{"qualifier":{"classid":"doi"},"value":"10.1016/j.cmet.2011.03.013"},{"qualifier":{"classid":"urn"},"value":"urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2"},{"qualifier":{"classid":"scp-number"},"value":"79953761260"},{"qualifier":{"classid":"pmc"},"value":"21459329"}], "collectedfrom" : [ { "key" : "10|openaire____::081b82f96300b6a6e3d282bad31cb6e2", "value" : "Crossref"} ], "isGreen": null, "openAccessColor": "gold", "isInDiamondJournal": null, "publiclyFunded": null}
|
||||
{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1g", "resulttype" : { "classid" : "publication" }, "isGreen": true, "openAccessColor": "gold", "isInDiamondJournal": true, "publiclyFunded": false }
|
||||
{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1h", "resulttype" : { "classid" : "publication" }, "isGreen": false, "openAccessColor": null, "isInDiamondJournal": true, "publiclyFunded": false }
|
|
@ -0,0 +1,3 @@
|
|||
{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", "resulttype" : { "classid" : "publication" }, "pid":[{"qualifier":{"classid":"doi"},"value":"10.1016/j.cmet.2011.03.013"},{"qualifier":{"classid":"urn"},"value":"urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2"},{"qualifier":{"classid":"scp-number"},"value":"79953761260"},{"qualifier":{"classid":"pmc"},"value":"21459329"}], "collectedfrom" : [ { "key" : "10|openaire____::081b82f96300b6a6e3d282bad31cb6e2", "value" : "Crossref"} ], "isGreen": null, "openAccessColor": "gold", "isInDiamondJournal": null, "publiclyFunded": null}
|
||||
{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1g", "resulttype" : { "classid" : "publication" }, "isGreen": true, "openAccessColor": "bronze", "isInDiamondJournal": true, "publiclyFunded": false }
|
||||
{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1h", "resulttype" : { "classid" : "publication" }, "isGreen": false, "openAccessColor": null, "isInDiamondJournal": true, "publiclyFunded": false }
|
Loading…
Reference in New Issue