Merge pull request 'relation-from-odf' (#22) from relation-from-odf into master

Reviewed-on: #22
This commit is contained in:
Claudio Atzori 2022-09-27 14:23:26 +02:00
commit 47faf312e0
8 changed files with 25 additions and 7 deletions

View File

@ -4,9 +4,10 @@
| **Version** | **Changes** | **Readiness** |
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| 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> | 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 |

View File

@ -5,7 +5,7 @@
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging>
<version>3.14.1-SNAPSHOT</version>
<version>3.15.0-SNAPSHOT</version>
<licenses>
<license>

View File

@ -24,6 +24,7 @@ public class ModelConstants {
public static final String EUROPE_PUBMED_CENTRAL_ID = "10|opendoar____::8b6dd7db9af49e67306feb59a8bdc52c";
public static final String PUBMED_CENTRAL_ID = "10|opendoar____::eda80a3d5b344bc40f3bc04f65b7a357";
public static final String ARXIV_ID = "10|opendoar____::6f4922f45568161a8cdf4ad2299f6d23";
public static final String ROHUB_ID = "10|fairsharing_::1b69ebedb522700034547abc5652ffac";
public static final String OPENORGS_NAME = "OpenOrgs Database";
@ -118,7 +119,7 @@ public class ModelConstants {
public static final String COMPILES = "Compiles";
public static final String IS_COMPILED_BY = "IsCompiledBy";
public static final String DESCRIBES = "Describes";
public static final String IS_DESCRIBE_DBY = "IsDescribedBy";
public static final String IS_DESCRIBED_BY = "IsDescribedBy";
public static final String IS_METADATA_FOR = "IsMetadataFor";
public static final String IS_METADATA_OF = "IsMetadataOf";
public static final String HAS_ASSOCIATION_WITH = "HasAssociationWith";

View File

@ -125,7 +125,7 @@ public class ModelSupport {
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_RELATED_TO, IS_RELATED_TO);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_COMPILED_BY, COMPILES);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_DESCRIBE_DBY, DESCRIBES);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_DESCRIBED_BY, DESCRIBES);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_METADATA_FOR, IS_METADATA_OF);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, HAS_ASSOCIATION_WITH, HAS_ASSOCIATION_WITH);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_REQUIRED_BY, REQUIRES);

View File

@ -32,7 +32,8 @@ public class IdentifierFactory implements Serializable {
public static final int ID_PREFIX_LEN = 12;
/**
* Declares the associations PID_TYPE -> [DATASOURCE ID, NAME] considered authoritative for that PID_TYPE
* Declares the associations PID_TYPE -> [DATASOURCE ID, NAME] considered authoritative for that PID_TYPE.
* The id of the record (source_::id) will be rewritten as pidType_::id)
*/
public static final Map<PidType, HashBiMap<String, String>> PID_AUTHORITY = Maps.newHashMap();
@ -53,11 +54,17 @@ public class IdentifierFactory implements Serializable {
PID_AUTHORITY.put(PidType.arXiv, HashBiMap.create());
PID_AUTHORITY.get(PidType.arXiv).put(ARXIV_ID, "arXiv.org e-Print Archive");
PID_AUTHORITY.put(PidType.w3id, HashBiMap.create());
PID_AUTHORITY.get(PidType.w3id).put(ROHUB_ID, "ROHub");
}
/**
* Declares the associations PID_TYPE -> [DATASOURCE ID, PID SUBSTRING] considered as delegated authority for that
* PID_TYPE. Example, Zenodo is delegated to forge DOIs that contain the 'zenodo' word.
*
* If a record with the same id (same pid) comes from 2 data sources, the one coming from a delegated source wins. E.g. Zenodo records win over those from Datacite.
* See also https://code-repo.d4science.org/D-Net/dnet-hadoop/pulls/187 and the class dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/OafMapperUtils.java
*/
public static final Map<PidType, Map<String, String>> DELEGATED_PID_AUTHORITY = Maps.newHashMap();
@ -65,6 +72,8 @@ public class IdentifierFactory implements Serializable {
DELEGATED_PID_AUTHORITY.put(PidType.doi, new HashMap<>());
DELEGATED_PID_AUTHORITY.get(PidType.doi).put(ZENODO_OD_ID, "zenodo");
DELEGATED_PID_AUTHORITY.get(PidType.doi).put(ZENODO_R3_ID, "zenodo");
DELEGATED_PID_AUTHORITY.put(PidType.w3id, new HashMap<>());
DELEGATED_PID_AUTHORITY.get(PidType.w3id).put(ROHUB_ID, "ro-id");
}
/**

View File

@ -56,7 +56,7 @@ public enum PidType {
*
* Source: https://www.nlm.nih.gov/bsd/mms/medlineelements.html#pmc
*/
pmc, handle, arXiv, nct, pdb,
pmc, handle, arXiv, nct, pdb, w3id,
// Organization
openorgs, corda, corda_h2020, GRID, mag_id, urn,

View File

@ -68,12 +68,18 @@ class IdentifierFactoryTest {
verifyIdentifier("publication_5.json", defaultID, false);
}
@Test
void testCreateIdentifierForROHub() throws IOException {
verifyIdentifier(
"orp-rohub.json", "50|w3id________::afc7592914ae190a50570db90f55f9c2", true);
}
protected void verifyIdentifier(String filename, String expectedID, boolean md5) throws IOException {
final String json = IOUtils.toString(getClass().getResourceAsStream(filename));
final Publication pub = OBJECT_MAPPER.readValue(json, Publication.class);
String id = IdentifierFactory.createIdentifier(pub, md5);
System.out.println(id);
assertNotNull(id);
assertEquals(expectedID, id);
}

File diff suppressed because one or more lines are too long