diff --git a/CHANGES.md b/CHANGES.md
index 7b0e957..750c2a4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,31 +2,33 @@
## Changelog
-| **Version** | **Changes** | **Readiness** |
-|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
-| 2.10.29 | [Merge Result] merge logics changed to consider invisble in dataInfo | beta |
-| 2.10.28 | [Graph Model] Added APC information at the level of the result | beta |
-| 2.10.27 | [Graph Model] change name and id of OpenAPC datasource | beta |
-| 2.10.26 | [Graph Model] OpenAIRE ids of the delegated authorities and enrichment providers in the identifier creation strategy | beta |
-| 2.10.25 | [Graph model]implemented enrichment on Result specializing in the method mergefrom. | beta |
-| 2.10.24 | [Graph model]added utility method and constants for checking weather is an OafEntity represents an enrichment. | beta |
-| 2.9.24 | [Dump model]change the names of the classes to be able to automatically create the json schema with specific descriptions | beta |
-| 2.9.23 | [Graph model]
Added Instance.measures field, allowing to maintain the association between them and the individual result instance[Dump model]added json schemas | beta |
-| 2.8.22 | [Graph model]
minor: added serializable to the Measures model class[Dump model]added dedicated BestAccessRight class, used at the result level instead of AccessRight | production |
-| 2.8.21 | [Graph model]
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]
added constants declaring the values used for hierarchical relationships among the organizations IsParentOf / IsChildOf | production |
-| 2.7.18-19 | [Dump model]
include validation info in relations
[Graph model]
added constants declaring vocabulary names for relation fields | production |
-| 2.7.17 | [Dump model]
aligned the graph dump schema to mirror the changes in the model
1. Added openaccessroute at the level of the instance inside the AccessRight element;
2. Added pid and the alternate identifiers at the level of the instance;
3. Added the bipFinder measures | production |
-| 2.7.16 | [Graph model]
Updated the casing of the following terms (`relation.relClass`):
1. `isRelatedTo -> IsRelatedTo`
Added the following `relClass` terms:
1. `IsAmongTopNSimilarDocuments`
2. `HasAmongTopNSimilarDocuments` | production |
-| 2.7.15 | 1. added support for delegated authorities
2. fixed regex for DOI cleaning | production |
-| 2.7.14 | [Graph model]
Relation types are now inspired by the Datacite definitions https://schema.datacite.org/meta/kernel-4.4/doc/DataCite-MetadataKernel_v4.4.pdf
The changes involve the values stored in `relation.subRelType` and `relation.relClass`:
Updated the casing of the following terms (`relation.relClass`):
1. `isSupplementTo -> IsSupplementTo` / `isSupplementedBy -> IsSupplementedBy`
2. `isPartOf -> IsPartOf` / `hasPart -> HasPart`
3. `cites -> Cites` / `isCitedBy -> IsCitedBy`
4. `reviews -> Reviews` / `isReviewedBy -> IsReviewedBy`
Added the following terms [`subRelType: relClass / relClass (inverse)`]:
1. `relationship: References / IsReferencedBy`
2. `relationship: IsIdenticalTo`
3. `relationship: IsContinuedBy / Continues`
4. `relationship: IsDocumentedBy / Documents`
5. `relationship: Documents / IsDocumentedBy`
6. `relationship: IsCompiledBy / Compiles`
7. `version: IsPreviousVersionOf / IsNewVersionOf`
8. `version: IsSourceOf / IsDerivedFrom`
9. `version: IsVariantFormOf / IsOriginalFormOf`
10. `version: IsObsoletedBy / Obsoletes`
11. `version: IsVersionOf / HasVersion` | production |
-| 2.6.14 | [Scholexplorer]
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
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]
1. introduced MetadataStoreManager (MdSM) model classes | production |
-| 2.2.5 | [Graph model]
1. introduced fields `Instance.pid` and `Instance.alternateIdentifier`
2. `LicenseComparator` renamed as `AccessRightComparator`
3. introduced `AccessRight` model class defining the `OpenAccessRoute` field to keep track of the OpenAccess color at the `Instance` level
4. `ExternalReference` cleanup (removed description, added alternateLabel(s))
5. added several ModelConstants
[Aggregation]
7. introduced MDStore record model classes
8. Introduced ORCID specific model classes | production |
-| 2.2.4 | 1. ORCID specific model classes backported in the version used in PROD
2. added constant for dnet:externalReference_typologies
3. added constant for ORCID datasource name
4. `Result.mergeFrom` handles field `dateOfAcceptance` | production |
+| **Version** | **Changes** | **Readiness** |
+|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
+| 2.10.31 | [Minor] NPE checks | beta |
+| 2.10.30 | [Minor] added comparator for refereed field instances | beta |
+| 2.10.29 | [Merge Result] merge logics changed to consider invisble in dataInfo | beta |
+| 2.10.28 | [Graph Model] Added APC information at the level of the result | beta |
+| 2.10.27 | [Graph Model] change name and id of OpenAPC datasource | beta |
+| 2.10.26 | [Graph Model] OpenAIRE ids of the delegated authorities and enrichment providers in the identifier creation strategy | beta |
+| 2.10.25 | [Graph model]implemented enrichment on Result specializing in the method mergefrom. | beta |
+| 2.10.24 | [Graph model]added utility method and constants for checking weather is an OafEntity represents an enrichment. | beta |
+| 2.9.24 | [Dump model]change the names of the classes to be able to automatically create the json schema with specific descriptions | beta |
+| 2.9.23 | [Graph model]
Added Instance.measures field, allowing to maintain the association between them and the individual result instance[Dump model]added json schemas | beta |
+| 2.8.22 | [Graph model]
minor: added serializable to the Measures model class[Dump model]added dedicated BestAccessRight class, used at the result level instead of AccessRight | production |
+| 2.8.21 | [Graph model]
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]
added constants declaring the values used for hierarchical relationships among the organizations IsParentOf / IsChildOf | production |
+| 2.7.18-19 | [Dump model]
include validation info in relations
[Graph model]
added constants declaring vocabulary names for relation fields | production |
+| 2.7.17 | [Dump model]
aligned the graph dump schema to mirror the changes in the model
1. Added openaccessroute at the level of the instance inside the AccessRight element;
2. Added pid and the alternate identifiers at the level of the instance;
3. Added the bipFinder measures | production |
+| 2.7.16 | [Graph model]
Updated the casing of the following terms (`relation.relClass`):
1. `isRelatedTo -> IsRelatedTo`
Added the following `relClass` terms:
1. `IsAmongTopNSimilarDocuments`
2. `HasAmongTopNSimilarDocuments` | production |
+| 2.7.15 | 1. added support for delegated authorities
2. fixed regex for DOI cleaning | production |
+| 2.7.14 | [Graph model]
Relation types are now inspired by the Datacite definitions https://schema.datacite.org/meta/kernel-4.4/doc/DataCite-MetadataKernel_v4.4.pdf
The changes involve the values stored in `relation.subRelType` and `relation.relClass`:
Updated the casing of the following terms (`relation.relClass`):
1. `isSupplementTo -> IsSupplementTo` / `isSupplementedBy -> IsSupplementedBy`
2. `isPartOf -> IsPartOf` / `hasPart -> HasPart`
3. `cites -> Cites` / `isCitedBy -> IsCitedBy`
4. `reviews -> Reviews` / `isReviewedBy -> IsReviewedBy`
Added the following terms [`subRelType: relClass / relClass (inverse)`]:
1. `relationship: References / IsReferencedBy`
2. `relationship: IsIdenticalTo`
3. `relationship: IsContinuedBy / Continues`
4. `relationship: IsDocumentedBy / Documents`
5. `relationship: Documents / IsDocumentedBy`
6. `relationship: IsCompiledBy / Compiles`
7. `version: IsPreviousVersionOf / IsNewVersionOf`
8. `version: IsSourceOf / IsDerivedFrom`
9. `version: IsVariantFormOf / IsOriginalFormOf`
10. `version: IsObsoletedBy / Obsoletes`
11. `version: IsVersionOf / HasVersion` | production |
+| 2.6.14 | [Scholexplorer]
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
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]
1. introduced MetadataStoreManager (MdSM) model classes | production |
+| 2.2.5 | [Graph model]
1. introduced fields `Instance.pid` and `Instance.alternateIdentifier`
2. `LicenseComparator` renamed as `AccessRightComparator`
3. introduced `AccessRight` model class defining the `OpenAccessRoute` field to keep track of the OpenAccess color at the `Instance` level
4. `ExternalReference` cleanup (removed description, added alternateLabel(s))
5. added several ModelConstants
[Aggregation]
7. introduced MDStore record model classes
8. Introduced ORCID specific model classes | production |
+| 2.2.4 | 1. ORCID specific model classes backported in the version used in PROD
2. added constant for dnet:externalReference_typologies
3. added constant for ORCID datasource name
4. `Result.mergeFrom` handles field `dateOfAcceptance` | production |
diff --git a/pom.xml b/pom.xml
index 0ebb86f..3ae2473 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
eu.dnetlib.dhp
dhp-schemas
jar
- 2.10.30-SNAPSHOT
+ 2.10.32-SNAPSHOT
@@ -33,7 +33,7 @@
scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git
scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git
https://code-repo.d4science.org/D-Net/dhp-schemas/
- dhp-schemas-2.10.25
+ dhp-schemas-2.10.30
This module contains common schema classes meant to be used across the dnet-hadoop submodules
diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java b/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java
index bd893bf..1f32c33 100644
--- a/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java
+++ b/src/main/java/eu/dnetlib/dhp/schema/common/ModelConstants.java
@@ -57,6 +57,11 @@ public class ModelConstants {
public static final String DNET_RELATION_SUBRELTYPE = "dnet:relation_subRelType";
public static final String DNET_RELATION_RELCLASS = "dnet:relation_relClass";
+ 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";
+ public static final String NON_PEER_REVIEWED_CLASSID = "0002";
+
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_ACTIONSET = "sysimport:actionset";
diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java b/src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java
new file mode 100644
index 0000000..86c0d97
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java
@@ -0,0 +1,44 @@
+
+package eu.dnetlib.dhp.schema.common;
+
+import java.util.Comparator;
+
+import eu.dnetlib.dhp.schema.oaf.Qualifier;
+
+public class RefereedComparator implements Comparator {
+
+ @Override
+ public int compare(Qualifier left, Qualifier right) {
+
+ if (left == null && right == null)
+ return 0;
+ if (left == null)
+ return 1;
+ if (right == null)
+ return -1;
+
+ String lClass = left.getClassid();
+ String rClass = right.getClassid();
+
+ if (lClass.equals(rClass))
+ return 0;
+
+ if (lClass.equals(ModelConstants.PEER_REVIEWED_CLASSID))
+ return -1;
+ if (rClass.equals(ModelConstants.PEER_REVIEWED_CLASSID))
+ return 1;
+
+ if (lClass.equals(ModelConstants.NON_PEER_REVIEWED_CLASSID))
+ return -1;
+ if (rClass.equals(ModelConstants.NON_PEER_REVIEWED_CLASSID))
+ return 1;
+
+ if (lClass.equals(ModelConstants.UNKNOWN))
+ return -1;
+ if (rClass.equals(ModelConstants.UNKNOWN))
+ return 1;
+
+ // Else (but unlikely), lexicographical ordering will do.
+ return lClass.compareTo(rClass);
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java
index b0c5165..0df5572 100644
--- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Oaf.java
@@ -70,9 +70,14 @@ public abstract class Oaf implements Serializable {
}
public void mergeOAFDataInfo(Oaf o) {
-
- if (o.getDataInfo() != null && (compareTrust(this, o) < 0 || this.getDataInfo().getInvisible()))
- dataInfo = o.getDataInfo();
+ Optional.ofNullable(o)
+ .ifPresent(other -> Optional.ofNullable(other.getDataInfo())
+ .ifPresent(otherDataInfo -> Optional.ofNullable(this.getDataInfo())
+ .ifPresent(thisDataInfo -> {
+ if (compareTrust(this, other) < 0 || thisDataInfo.getInvisible()) {
+ setDataInfo(otherDataInfo);
+ }
+ })));
}
protected String extractTrust(Oaf e) {