Merge branch 'master' into datasource_pdf_consent

This commit is contained in:
Claudio Atzori 2022-03-29 09:37:07 +02:00
commit 44ec9a21e3
5 changed files with 88 additions and 32 deletions

View File

@ -3,7 +3,9 @@
## Changelog
| **Version** | **Changes** | **Readiness** |
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| 2.10.31 | [Minor] </br>NPE checks | beta |
| 2.10.30 | [Minor] </br>added comparator for refereed field instances | beta |
| 2.10.29 | [Merge Result] </br>merge logics changed to consider invisble in dataInfo | beta |
| 2.10.28 | [Graph Model] </br> Added APC information at the level of the result | beta |
| 2.10.27 | [Graph Model] </br> change name and id of OpenAPC datasource | beta |

View File

@ -5,7 +5,7 @@
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging>
<version>2.10.30-SNAPSHOT</version>
<version>2.10.32-SNAPSHOT</version>
<licenses>
@ -33,7 +33,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>dhp-schemas-2.10.25</tag>
<tag>dhp-schemas-2.10.30</tag>
</scm>
<description>This module contains common schema classes meant to be used across the dnet-hadoop submodules</description>

View File

@ -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";

View File

@ -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<Qualifier> {
@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);
}
}

View File

@ -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) {