Merge branch 'scholexplorer_incremental_index' of code-repo.d4science.org:D-Net/dhp-schemas into scholexplorer_incremental_index

This commit is contained in:
Sandro La Bruzzo 2022-03-29 11:29:29 +02:00
commit c6f9f8f391
6 changed files with 118 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.33-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

@ -108,6 +108,12 @@ public class Datasource extends OafEntity implements Serializable {
// New field for EOSC
private List<Qualifier> contentpolicies;
private Boolean consenttermsofuse;
private Boolean fulltextdownload;
private String consenttermsofusedate;
public Qualifier getDatasourcetype() {
return datasourcetype;
}
@ -444,6 +450,30 @@ public class Datasource extends OafEntity implements Serializable {
this.contentpolicies = contentpolicies;
}
public Boolean getConsenttermsofuse() {
return consenttermsofuse;
}
public void setConsenttermsofuse(Boolean consenttermsofuse) {
this.consenttermsofuse = consenttermsofuse;
}
public Boolean getFulltextdownload() {
return fulltextdownload;
}
public void setFulltextdownload(Boolean fulltextdownload) {
this.fulltextdownload = fulltextdownload;
}
public String getConsenttermsofusedate() {
return consenttermsofusedate;
}
public void setConsenttermsofusedate(String consenttermsofusedate) {
this.consenttermsofusedate = consenttermsofusedate;
}
@Override
public void mergeFrom(final OafEntity e) {
super.mergeFrom(e);

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