delegated_authorities #11

Merged
claudio.atzori merged 2 commits from delegated_authorities into master 2022-01-21 14:42:55 +01:00
87 changed files with 3247 additions and 637 deletions
Showing only changes of commit 19c84675f8 - Show all commits

View File

@ -2,15 +2,27 @@
## Changelog ## Changelog
| **Version** | **Changes** | **Readiness** | | **Version** | **Changes** | **Readiness** |
|---|---|---| |--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| 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` | beta | | 2.10.25 | [Graph model]</br>implements enrichment on Result specializing in the method mergefrom. | beta |
| 2.6.14 | [Scholexplorer]<br>1. Added model classes for Scholexplorer, package `eu.dnetlib.dhp.schema.sx` | production | | 2.10.24 | [Graph model]</br>added utility method and constants for checking weather is an OafEntity represents an enrichment. | beta |
| 2.6.13 | 1. `Result.mergeFrom` handles field `dateOfAcceptance` | 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 | beta |
| 2.5.12 | 1. delegating the date parsing to https://github.com/sisyphsu/dateparser | 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 | beta |
| 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.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.4.8 | 1. added constant for ORCID datasource name | 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.4.7 | refactoring | production | | 2.8.20 | [Graph model]<br>added constants declaring the values used for hierarchical relationships among the organizations IsParentOf / IsChildOf | production |
| 2.3.6 | [Aggregation]<br>1. introduced MetadataStoreManager (MdSM) model classes| 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.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.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.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.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 |

47
pom.xml
View File

@ -5,7 +5,7 @@
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId> <artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.7.15-SNAPSHOT</version> <version>2.10.26-SNAPSHOT</version>
<licenses> <licenses>
<license> <license>
@ -20,7 +20,7 @@
<issueManagement> <issueManagement>
<system>Redmine</system> <system>Redmine</system>
<url>https://issue.openaire.research-infrastructures.eu/projects/openaire</url> <url>https://support.openaire.eu/projects/openaire</url>
</issueManagement> </issueManagement>
<ciManagement> <ciManagement>
@ -32,7 +32,7 @@
<connection>scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git</connection> <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> <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> <url>https://code-repo.d4science.org/D-Net/dhp-schemas/</url>
<tag>HEAD</tag> <tag>dhp-schemas-2.10.25</tag>
</scm> </scm>
<description>This module contains common schema classes meant to be used across the dnet-hadoop submodules</description> <description>This module contains common schema classes meant to be used across the dnet-hadoop submodules</description>
@ -137,7 +137,23 @@
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version> <version>3.0.0</version>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${dhp.jackson.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
@ -229,6 +245,19 @@
<scalaVersion>${scala.version}</scalaVersion> <scalaVersion>${scala.version}</scalaVersion>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>eu.dnetlib.dhp.schema.dump.ExecCreateSchemas</mainClass>
<arguments>
<argument>eu.dnetlib.dhp.schema.dump.oaf.GraphResult;eu.dnetlib.dhp.schema.dump.oaf.graph.Organization;eu.dnetlib.dhp.schema.dump.oaf.graph.Project</argument>
</arguments>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
@ -360,6 +389,17 @@
<groupId>javax.persistence</groupId> <groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId> <artifactId>javax.persistence-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator</artifactId>
<version>${jsonschemagenerator.version}</version>
<!-- <scope>test</scope>-->
</dependency>
<dependency>
<groupId>com.github.imifou</groupId>
<artifactId>jsonschema-module-addon</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies> </dependencies>
@ -377,6 +417,7 @@
<scala.version>2.11.12</scala.version> <scala.version>2.11.12</scala.version>
<junit-jupiter.version>5.6.1</junit-jupiter.version> <junit-jupiter.version>5.6.1</junit-jupiter.version>
<mockito-core.version>3.3.3</mockito-core.version> <mockito-core.version>3.3.3</mockito-core.version>
<jsonschemagenerator.version>4.13.0</jsonschemagenerator.version>
</properties> </properties>

View File

@ -4,7 +4,6 @@ package eu.dnetlib.dhp.schema.action;
import java.io.IOException; import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@ -12,10 +11,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.Oaf; import eu.dnetlib.dhp.schema.oaf.Oaf;
public class AtomicActionDeserializer extends JsonDeserializer { public class AtomicActionDeserializer<T extends Oaf> extends JsonDeserializer<AtomicAction<T>> {
@Override @Override
public Object deserialize(JsonParser jp, DeserializationContext ctxt) @SuppressWarnings("unchecked")
public AtomicAction<T> deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException { throws IOException {
JsonNode node = jp.getCodec().readTree(jp); JsonNode node = jp.getCodec().readTree(jp);
String classTag = node.get("clazz").asText(); String classTag = node.get("clazz").asText();
@ -23,8 +23,9 @@ public class AtomicActionDeserializer extends JsonDeserializer {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
final Class<?> clazz = Class.forName(classTag); final Class<T> clazz = (Class<T>) Class.forName(classTag);
return new AtomicAction(clazz, (Oaf) mapper.readValue(payload.toString(), clazz)); final T oaf = mapper.readValue(payload.toString(), clazz);
return new AtomicAction(clazz, oaf);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IOException(e); throw new IOException(e);
} }

View File

@ -3,7 +3,6 @@ package eu.dnetlib.dhp.schema.common;
import java.util.Comparator; import java.util.Comparator;
import eu.dnetlib.dhp.schema.oaf.AccessRight;
import eu.dnetlib.dhp.schema.oaf.Qualifier; import eu.dnetlib.dhp.schema.oaf.Qualifier;
public class AccessRightComparator<T extends Qualifier> implements Comparator<T> { public class AccessRightComparator<T extends Qualifier> implements Comparator<T> {

View File

@ -8,6 +8,8 @@ import eu.dnetlib.dhp.schema.oaf.Qualifier;
public class ModelConstants { public class ModelConstants {
private ModelConstants() {}
public static final String ORCID = "orcid"; public static final String ORCID = "orcid";
public static final String ORCID_PENDING = "orcid_pending"; public static final String ORCID_PENDING = "orcid_pending";
public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID"; public static final String ORCID_CLASSNAME = "Open Researcher and Contributor ID";
@ -25,6 +27,9 @@ public class ModelConstants {
public static final String OPENORGS_NAME = "OpenOrgs Database"; public static final String OPENORGS_NAME = "OpenOrgs Database";
public static final String OPENOCITATIONS_NAME = "OpenCitations";
public static final String OPENOCITATIONS_ID = "10|openaire____::c06df618c5de1c786535ccf3f8b7b059";
// VOCABULARY VALUE // VOCABULARY VALUE
public static final String ACCESS_RIGHT_OPEN = "OPEN"; public static final String ACCESS_RIGHT_OPEN = "OPEN";
public static final String ACCESS_RIGHT_EMBARGO = "EMBARGO"; public static final String ACCESS_RIGHT_EMBARGO = "EMBARGO";
@ -45,6 +50,9 @@ public class ModelConstants {
public static final String DNET_REVIEW_LEVELS = "dnet:review_levels"; public static final String DNET_REVIEW_LEVELS = "dnet:review_levels";
public static final String DNET_PROGRAMMING_LANGUAGES = "dnet:programming_languages"; public static final String DNET_PROGRAMMING_LANGUAGES = "dnet:programming_languages";
public static final String DNET_EXTERNAL_REFERENCE_TYPE = "dnet:externalReference_typologies"; public static final String DNET_EXTERNAL_REFERENCE_TYPE = "dnet:externalReference_typologies";
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 SYSIMPORT_CROSSWALK_REPOSITORY = "sysimport:crosswalk:repository"; 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_CROSSWALK_ENTITYREGISTRY = "sysimport:crosswalk:entityregistry";
@ -55,6 +63,8 @@ public class ModelConstants {
public static final String HARVESTED = "Harvested"; public static final String HARVESTED = "Harvested";
public static final String PROVENANCE_DEDUP = "sysimport:dedup"; public static final String PROVENANCE_DEDUP = "sysimport:dedup";
public static final String PROVENANCE_ENRICH = "sysimport:enrich";
public static final Qualifier PROVENANCE_ACTION_SET_QUALIFIER = qualifier( public static final Qualifier PROVENANCE_ACTION_SET_QUALIFIER = qualifier(
SYSIMPORT_ACTIONSET, SYSIMPORT_ACTIONSET, DNET_PROVENANCE_ACTIONS, DNET_PROVENANCE_ACTIONS); SYSIMPORT_ACTIONSET, SYSIMPORT_ACTIONSET, DNET_PROVENANCE_ACTIONS, DNET_PROVENANCE_ACTIONS);
@ -81,7 +91,7 @@ public class ModelConstants {
public static final String RELATIONSHIP = "relationship"; // subreltype public static final String RELATIONSHIP = "relationship"; // subreltype
public static final String IS_RELATED_TO = "isRelatedTo"; public static final String IS_RELATED_TO = "IsRelatedTo";
public static final String IS_IDENTICAL_TO = "IsIdenticalTo"; public static final String IS_IDENTICAL_TO = "IsIdenticalTo";
public static final String REFERENCES = "References"; public static final String REFERENCES = "References";
@ -94,6 +104,15 @@ public class ModelConstants {
public static final String IS_DERIVED_FROM = "IsDerivedFrom"; public static final String IS_DERIVED_FROM = "IsDerivedFrom";
public static final String COMPILES = "Compiles"; public static final String COMPILES = "Compiles";
public static final String IS_COMPILED_BY = "IsCompiledBy"; 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_METADATA_FOR = "IsMetadataFor";
public static final String IS_METADATA_OF = "IsMetadataOf";
public static final String HAS_ASSOCIATION_WITH = "HasAssociationWith";
public static final String IS_REQUIRED_BY = "IsRequiredBy";
public static final String REQUIRES = "Requires";
public static final String CITATION = "citation"; // subreltype public static final String CITATION = "citation"; // subreltype
public static final String CITES = "Cites"; public static final String CITES = "Cites";
@ -134,6 +153,8 @@ public class ModelConstants {
public static final String HAS_AUTHOR_INSTITUTION = "hasAuthorInstitution"; public static final String HAS_AUTHOR_INSTITUTION = "hasAuthorInstitution";
public static final String ORG_ORG_RELTYPE = "organizationOrganization"; // relType public static final String ORG_ORG_RELTYPE = "organizationOrganization"; // relType
public static final String IS_PARENT_OF = "IsParentOf";
public static final String IS_CHILD_OF = "IsChildOf";
public static final String DEDUP = "dedup"; // subreltype public static final String DEDUP = "dedup"; // subreltype
public static final String MERGES = "merges"; public static final String MERGES = "merges";
@ -141,6 +162,8 @@ public class ModelConstants {
public static final String SIMILARITY = "similarity"; // subreltype public static final String SIMILARITY = "similarity"; // subreltype
public static final String IS_SIMILAR_TO = "isSimilarTo"; public static final String IS_SIMILAR_TO = "isSimilarTo";
public static final String IS_AMONG_TOP_N_SIMILAR_DOCS = "IsAmongTopNSimilarDocuments";
public static final String HAS_AMONG_TOP_N_SIMILAR_DOCS = "HasAmongTopNSimilarDocuments";
public static final String IS_DIFFERENT_FROM = "isDifferentFrom"; public static final String IS_DIFFERENT_FROM = "isDifferentFrom";

View File

@ -2,18 +2,20 @@
package eu.dnetlib.dhp.schema.common; package eu.dnetlib.dhp.schema.common;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static eu.dnetlib.dhp.schema.common.ModelConstants.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.ParseException; import java.text.ParseException;
import java.time.format.DateTimeParseException; import java.util.Date;
import java.util.*; import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import com.github.sisyphsu.dateparser.DateParserUtils; import com.github.sisyphsu.dateparser.DateParserUtils;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -97,211 +99,104 @@ public class ModelSupport {
public static final Map<String, RelationInverse> relationInverseMap = Maps.newHashMap(); public static final Map<String, RelationInverse> relationInverseMap = Maps.newHashMap();
static { static {
relationInverseMap set(relationInverseMap, PROJECT_ORGANIZATION, PARTICIPATION, IS_PARTICIPANT, HAS_PARTICIPANT);
.put(
"personResult_authorship_isAuthorOf", new RelationInverse()
.setRelation("isAuthorOf")
.setInverse("hasAuthor")
.setRelType("personResult")
.setSubReltype("authorship"));
relationInverseMap
.put(
"personResult_authorship_hasAuthor", new RelationInverse()
.setInverse("isAuthorOf")
.setRelation("hasAuthor")
.setRelType("personResult")
.setSubReltype("authorship"));
relationInverseMap
.put(
"projectOrganization_participation_isParticipant", new RelationInverse()
.setRelation(ModelConstants.IS_PARTICIPANT)
.setInverse(ModelConstants.HAS_PARTICIPANT)
.setRelType(ModelConstants.PROJECT_ORGANIZATION)
.setSubReltype(ModelConstants.PARTICIPATION));
relationInverseMap
.put(
"projectOrganization_participation_hasParticipant", new RelationInverse()
.setInverse(ModelConstants.IS_PARTICIPANT)
.setRelation(ModelConstants.HAS_PARTICIPANT)
.setRelType(ModelConstants.PROJECT_ORGANIZATION)
.setSubReltype(ModelConstants.PARTICIPATION));
relationInverseMap
.put(
"resultOrganization_affiliation_hasAuthorInstitution", new RelationInverse()
.setRelation(ModelConstants.HAS_AUTHOR_INSTITUTION)
.setInverse(ModelConstants.IS_AUTHOR_INSTITUTION_OF)
.setRelType(ModelConstants.RESULT_ORGANIZATION)
.setSubReltype(ModelConstants.AFFILIATION));
relationInverseMap
.put(
"resultOrganization_affiliation_isAuthorInstitutionOf", new RelationInverse()
.setInverse(ModelConstants.HAS_AUTHOR_INSTITUTION)
.setRelation(ModelConstants.IS_AUTHOR_INSTITUTION_OF)
.setRelType(ModelConstants.RESULT_ORGANIZATION)
.setSubReltype(ModelConstants.AFFILIATION));
relationInverseMap
.put(
"organizationOrganization_dedup_merges", new RelationInverse()
.setRelation(ModelConstants.MERGES)
.setInverse(ModelConstants.IS_MERGED_IN)
.setRelType(ModelConstants.ORG_ORG_RELTYPE)
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"organizationOrganization_dedup_isMergedIn", new RelationInverse()
.setInverse(ModelConstants.MERGES)
.setRelation(ModelConstants.IS_MERGED_IN)
.setRelType(ModelConstants.ORG_ORG_RELTYPE)
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"organizationOrganization_dedupSimilarity_isSimilarTo", new RelationInverse()
.setInverse(ModelConstants.IS_SIMILAR_TO)
.setRelation(ModelConstants.IS_SIMILAR_TO)
.setRelType(ModelConstants.ORG_ORG_RELTYPE)
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap set(relationInverseMap, RESULT_ORGANIZATION, AFFILIATION, IS_AUTHOR_INSTITUTION_OF, HAS_AUTHOR_INSTITUTION);
.put(
"resultProject_outcome_isProducedBy", new RelationInverse()
.setRelation(ModelConstants.IS_PRODUCED_BY)
.setInverse(ModelConstants.PRODUCES)
.setRelType(ModelConstants.RESULT_PROJECT)
.setSubReltype(ModelConstants.OUTCOME));
relationInverseMap
.put(
"resultProject_outcome_produces", new RelationInverse()
.setInverse(ModelConstants.IS_PRODUCED_BY)
.setRelation(ModelConstants.PRODUCES)
.setRelType(ModelConstants.RESULT_PROJECT)
.setSubReltype(ModelConstants.OUTCOME));
relationInverseMap
.put(
"projectPerson_contactPerson_isContact", new RelationInverse()
.setRelation("isContact")
.setInverse("hasContact")
.setRelType("projectPerson")
.setSubReltype("contactPerson"));
relationInverseMap
.put(
"projectPerson_contactPerson_hasContact", new RelationInverse()
.setInverse("isContact")
.setRelation("hasContact")
.setRelType("personPerson")
.setSubReltype("coAuthorship"));
relationInverseMap
.put(
"personPerson_coAuthorship_isCoauthorOf", new RelationInverse()
.setInverse("isCoAuthorOf")
.setRelation("isCoAuthorOf")
.setRelType("personPerson")
.setSubReltype("coAuthorship"));
relationInverseMap
.put(
"personPerson_dedup_merges", new RelationInverse()
.setInverse(ModelConstants.IS_MERGED_IN)
.setRelation(ModelConstants.MERGES)
.setRelType("personPerson")
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"personPerson_dedup_isMergedIn", new RelationInverse()
.setInverse(ModelConstants.MERGES)
.setRelation(ModelConstants.IS_MERGED_IN)
.setRelType("personPerson")
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"personPerson_dedupSimilarity_isSimilarTo", new RelationInverse()
.setInverse(ModelConstants.IS_SIMILAR_TO)
.setRelation(ModelConstants.IS_SIMILAR_TO)
.setRelType("personPerson")
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"datasourceOrganization_provision_isProvidedBy", new RelationInverse()
.setInverse(ModelConstants.PROVIDES)
.setRelation(ModelConstants.IS_PROVIDED_BY)
.setRelType(ModelConstants.DATASOURCE_ORGANIZATION)
.setSubReltype(ModelConstants.PROVISION));
relationInverseMap
.put(
"datasourceOrganization_provision_provides", new RelationInverse()
.setInverse(ModelConstants.IS_PROVIDED_BY)
.setRelation(ModelConstants.PROVIDES)
.setRelType(ModelConstants.DATASOURCE_ORGANIZATION)
.setSubReltype(ModelConstants.PROVISION));
relationInverseMap
.put(
"resultResult_similarity_hasAmongTopNSimilarDocuments", new RelationInverse()
.setInverse("isAmongTopNSimilarDocuments")
.setRelation("hasAmongTopNSimilarDocuments")
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.SIMILARITY));
relationInverseMap
.put(
"resultResult_similarity_isAmongTopNSimilarDocuments", new RelationInverse()
.setInverse("hasAmongTopNSimilarDocuments")
.setRelation("isAmongTopNSimilarDocuments")
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.SIMILARITY));
relationInverseMap
.put(
"resultResult_relationship_isRelatedTo", new RelationInverse()
.setInverse(ModelConstants.IS_RELATED_TO)
.setRelation(ModelConstants.IS_RELATED_TO)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.RELATIONSHIP));
relationInverseMap
.put(
"resultResult_supplement_isSupplementTo", new RelationInverse()
.setInverse(ModelConstants.IS_SUPPLEMENTED_BY)
.setRelation(ModelConstants.IS_SUPPLEMENT_TO)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.SUPPLEMENT));
relationInverseMap
.put(
"resultResult_supplement_isSupplementedBy", new RelationInverse()
.setInverse(ModelConstants.IS_SUPPLEMENT_TO)
.setRelation(ModelConstants.IS_SUPPLEMENTED_BY)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.SUPPLEMENT));
relationInverseMap
.put(
"resultResult_part_isPartOf", new RelationInverse()
.setInverse(ModelConstants.HAS_PART)
.setRelation(ModelConstants.IS_PART_OF)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.PART));
relationInverseMap
.put(
"resultResult_part_hasPart", new RelationInverse()
.setInverse(ModelConstants.IS_PART_OF)
.setRelation(ModelConstants.HAS_PART)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.PART));
relationInverseMap
.put(
"resultResult_dedup_merges", new RelationInverse()
.setInverse(ModelConstants.IS_MERGED_IN)
.setRelation(ModelConstants.MERGES)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"resultResult_dedup_isMergedIn", new RelationInverse()
.setInverse(ModelConstants.MERGES)
.setRelation(ModelConstants.IS_MERGED_IN)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.DEDUP));
relationInverseMap
.put(
"resultResult_dedupSimilarity_isSimilarTo", new RelationInverse()
.setInverse(ModelConstants.IS_SIMILAR_TO)
.setRelation(ModelConstants.IS_SIMILAR_TO)
.setRelType(ModelConstants.RESULT_RESULT)
.setSubReltype(ModelConstants.DEDUP));
set(relationInverseMap, ORG_ORG_RELTYPE, DEDUP, IS_MERGED_IN, MERGES);
set(relationInverseMap, ORG_ORG_RELTYPE, DEDUP, IS_SIMILAR_TO, IS_SIMILAR_TO);
set(relationInverseMap, RESULT_PROJECT, OUTCOME, IS_PRODUCED_BY, PRODUCES);
set(relationInverseMap, DATASOURCE_ORGANIZATION, PROVISION, IS_PROVIDED_BY, PROVIDES);
set(relationInverseMap, RESULT_RESULT, SIMILARITY, IS_AMONG_TOP_N_SIMILAR_DOCS, HAS_AMONG_TOP_N_SIMILAR_DOCS);
set(relationInverseMap, RESULT_RESULT, SUPPLEMENT, IS_SUPPLEMENT_TO, IS_SUPPLEMENTED_BY);
set(relationInverseMap, RESULT_RESULT, PART, IS_PART_OF, HAS_PART);
set(relationInverseMap, RESULT_RESULT, DEDUP, IS_MERGED_IN, MERGES);
set(relationInverseMap, RESULT_RESULT, DEDUP, IS_SIMILAR_TO, IS_SIMILAR_TO);
set(relationInverseMap, RESULT_RESULT, CITATION, IS_CITED_BY, CITES);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_IDENTICAL_TO, IS_IDENTICAL_TO);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_REFERENCED_BY, REFERENCES);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_CONTINUED_BY, CONTINUES);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_DOCUMENTED_BY, DOCUMENTS);
set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_DERIVED_FROM, IS_SOURCE_OF);
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_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);
set(relationInverseMap, RESULT_RESULT, VERSION, IS_PREVIOUS_VERSION_OF, IS_NEW_VERSION_OF);
set(relationInverseMap, RESULT_RESULT, VERSION, IS_VARIANT_FORM_OF, IS_ORIGINAL_FORM_OF);
set(relationInverseMap, RESULT_RESULT, VERSION, IS_OBSOLETED_BY, OBSOLETES);
set(relationInverseMap, RESULT_RESULT, VERSION, IS_VERSION_OF, HAS_VERSION);
set(relationInverseMap, RESULT_RESULT, REVIEW, IS_REVIEWED_BY, REVIEWS);
}
private static void set(Map<String, RelationInverse> relationInverseMap, String relType, String subRelType, String relClass, String inverseRelClass) {
relationInverseMap
.put(
rel(relType, subRelType, relClass), new RelationInverse()
.setInverseRelClass(inverseRelClass)
.setRelClass(relClass)
.setRelType(relType)
.setSubReltype(subRelType));
if (!relClass.equals(inverseRelClass)) {
relationInverseMap
.put(
rel(relType, subRelType, inverseRelClass), new RelationInverse()
.setInverseRelClass(relClass)
.setRelClass(inverseRelClass)
.setRelType(relType)
.setSubReltype(subRelType));
}
}
/**
* Helper method: lookup relation inverse, given the direct relation encoding (case insensitive)
* @param encoding
* @return the relation inverse descriptor, throws @IllegalArgumentException when not found.
*/
public static RelationInverse findInverse(String encoding) {
return ModelSupport.relationInverseMap
.entrySet()
.stream()
.filter(r -> encoding.equalsIgnoreCase(r.getKey()))
.findFirst()
.map(r -> r.getValue())
.orElseThrow(() -> new IllegalArgumentException("invalid relationship: " + encoding));
}
/**
* Helper method: fina a relation filtering by a relation name
* @param relationName
* @return
*/
public static RelationInverse findRelation(final String relationName) {
return relationInverseMap.values()
.stream()
.filter(r -> relationName.equalsIgnoreCase(r.getRelClass()))
.findFirst()
.orElse(null);
}
/**
* Helper method: combines the relation attributes
* @param relType
* @param subRelType
* @param relClass
* @return
*/
public static String rel(String relType, String subRelType, String relClass) {
return String.format("%s_%s_%s", relType, subRelType, relClass);
} }
private static final String schemeTemplate = "dnet:%s_%s_relations"; private static final String schemeTemplate = "dnet:%s_%s_relations";

View File

@ -2,8 +2,8 @@
package eu.dnetlib.dhp.schema.common; package eu.dnetlib.dhp.schema.common;
public class RelationInverse { public class RelationInverse {
private String relation; private String relClass;
private String inverse; private String inverseRelClass;
private String relType; private String relType;
private String subReltype; private String subReltype;
@ -25,21 +25,21 @@ public class RelationInverse {
return this; return this;
} }
public String getRelation() { public String getRelClass() {
return relation; return relClass;
} }
public RelationInverse setRelation(String relation) { public RelationInverse setRelClass(String relClass) {
this.relation = relation; this.relClass = relClass;
return this; return this;
} }
public String getInverse() { public String getInverseRelClass() {
return inverse; return inverseRelClass;
} }
public RelationInverse setInverse(String inverse) { public RelationInverse setInverseRelClass(String inverseRelClass) {
this.inverse = inverse; this.inverseRelClass = inverseRelClass;
return this; return this;
} }

View File

@ -0,0 +1,75 @@
package eu.dnetlib.dhp.schema.dump;
import java.io.*;
import java.lang.reflect.Type;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.github.imifou.jsonschema.module.addon.AddonModule;
import com.github.victools.jsonschema.generator.*;
import eu.dnetlib.dhp.schema.dump.oaf.community.CommunityResult;
import eu.dnetlib.dhp.schema.dump.oaf.graph.*;
public class ExecCreateSchemas {
final static String DIRECTORY = "/eu/dnetlib/dhp/schema/oaf/dump/jsonschemas/";
SchemaGenerator generator;
private void init(){
AddonModule module = new AddonModule();
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(
new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT),
SchemaVersion.DRAFT_7,
OptionPreset.PLAIN_JSON)
.with(module)
.with(Option.SCHEMA_VERSION_INDICATOR)
.without(Option.NONPUBLIC_NONSTATIC_FIELDS_WITHOUT_GETTERS);
SchemaGeneratorConfig config = configBuilder.build();
generator = new SchemaGenerator(config);
}
private void generate(Type targetType, String directory, String filename) throws IOException {
JsonNode jsonSchema = generator.generateSchema(targetType);
String dir = Paths.get(Paths.get(getClass().getResource("/").getPath()).toAbsolutePath() + directory).toString();
if(!Files.exists(Paths.get(dir))){
Files.createDirectories(Paths.get(dir));
}
if(!Files.exists(Paths.get(dir + "/" + filename))) {
Files.createFile(Paths.get(dir + "/" + filename));
}
File f = new File(dir + "/" + filename);
try(PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(f)))) {
writer.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(jsonSchema));
}
}
public static void main(String[] args) throws IOException {
ExecCreateSchemas ecs = new ExecCreateSchemas();
ecs.init();
ecs.generate(GraphResult.class, DIRECTORY , "result_schema.json");
ecs.generate(ResearchCommunity.class, DIRECTORY , "community_infrastructure_schema.json");
ecs.generate(Datasource.class, DIRECTORY , "datasource_schema.json");
ecs.generate(Project.class, DIRECTORY , "project_schema.json");
ecs.generate(Relation.class, DIRECTORY , "relation_schema.json");
ecs.generate(Organization.class, DIRECTORY , "organization_schema.json");
ecs.generate(CommunityResult.class, DIRECTORY , "community_result_schema.json");
}
}

View File

@ -2,24 +2,15 @@
package eu.dnetlib.dhp.schema.dump.oaf; package eu.dnetlib.dhp.schema.dump.oaf;
/** /**
* AccessRight. Used to represent the result access rights. It extends the eu.dnet.lib.dhp.schema.dump.oaf.Qualifier * AccessRight. Used to represent the result access rights. It extends the eu.dnet.lib.dhp.schema.dump.oaf.BestAccessRight
* element with a parameter scheme of type String to store the scheme. Values for this element are found against the * element with value for the openaccess route
* COAR access right scheme. The classid of the element accessright in eu.dnetlib.dhp.schema.oaf.Result is used to get
* the COAR corresponding code whose value will be used to set the code parameter. The COAR label corresponding to the
* COAR code will be used to set the label parameter. The scheme value will always be the one referring to the COAR
* access right scheme
*/ */
public class AccessRight extends Qualifier { public class AccessRight extends BestAccessRight {
private String scheme;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) { private OpenAccessRoute openAccessRoute ;
this.scheme = scheme;
}
public static AccessRight newInstance(String code, String label, String scheme) { public static AccessRight newInstance(String code, String label, String scheme) {
AccessRight ar = new AccessRight(); AccessRight ar = new AccessRight();
@ -28,4 +19,12 @@ public class AccessRight extends Qualifier {
ar.setScheme(scheme); ar.setScheme(scheme);
return ar; return ar;
} }
public OpenAccessRoute getOpenAccessRoute() {
return openAccessRoute;
}
public void setOpenAccessRoute(OpenAccessRoute openAccessRoute) {
this.openAccessRoute = openAccessRoute;
}
} }

View File

@ -0,0 +1,40 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class AlternateIdentifier implements Serializable {
@JsonSchema(description="The scheme of the identifier. It can be a persistent identifier (i.e. doi). If it is present in the alternate identifiers " +
"it means it has not been forged by an authority for that pid. For example we collect metadata from an institutional repository that provides " +
"as identifier for the result also the doi")
private String scheme;
@JsonSchema(description="The value expressed in the scheme")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static AlternateIdentifier newInstance(String scheme, String value) {
AlternateIdentifier cf = new AlternateIdentifier();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -2,7 +2,8 @@
package eu.dnetlib.dhp.schema.dump.oaf; package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* Used to represent the generic author of the result. It has six parameters: - name of type String to store the given * Used to represent the generic author of the result. It has six parameters: - name of type String to store the given
@ -28,7 +29,8 @@ public class Author implements Serializable {
private Integer rank; private Integer rank;
private Pid pid; @JsonSchema(description="The author's persistent identifiers")
private AuthorPid pid;
public String getFullname() { public String getFullname() {
return fullname; return fullname;
@ -62,11 +64,11 @@ public class Author implements Serializable {
this.rank = rank; this.rank = rank;
} }
public Pid getPid() { public AuthorPid getPid() {
return pid; return pid;
} }
public void setPid(Pid pid) { public void setPid(AuthorPid pid) {
this.pid = pid; this.pid = pid;
} }

View File

@ -0,0 +1,54 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/**
* To represent the generic persistent identifier. It has two parameters:
* - id of type
* eu.dnetlib.dhp.schema.dump.oaf.AuthorPidSchemeValue to store the scheme and value of the Persistent Identifier.
* - provenance of type eu.dnetlib.dhp.schema.dump.oaf.Provenance to store the provenance and trust of the information
*/
public class AuthorPid implements Serializable {
private AuthorPidSchemeValue id;
@JsonSchema(description="The reason why the pid was associated to the author")
private Provenance provenance;
public AuthorPidSchemeValue getId() {
return id;
}
public void setId(AuthorPidSchemeValue pid) {
this.id = pid;
}
public Provenance getProvenance() {
return provenance;
}
public void setProvenance(Provenance provenance) {
this.provenance = provenance;
}
public static AuthorPid newInstance(AuthorPidSchemeValue pid, Provenance provenance) {
AuthorPid p = new AuthorPid();
p.id = pid;
p.provenance = provenance;
return p;
}
public static AuthorPid newInstance(AuthorPidSchemeValue pid) {
AuthorPid p = new AuthorPid();
p.id = pid;
return p;
}
}

View File

@ -0,0 +1,39 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class AuthorPidSchemeValue implements Serializable {
@JsonSchema(description="The author's pid scheme. OpenAIRE currently supports 'ORCID'")
private String scheme;
@JsonSchema(description="The author's pid value in that scheme (i.e. 0000-1111-2222-3333)")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static AuthorPidSchemeValue newInstance(String scheme, String value) {
AuthorPidSchemeValue cf = new AuthorPidSchemeValue();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -0,0 +1,59 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/**
* BestAccessRight. Used to represent the result best access rights. Values for this element are found against the
* COAR access right scheme. The classid of the element accessright in eu.dnetlib.dhp.schema.oaf.Result is used to get
* the COAR corresponding code whose value will be used to set the code parameter. The COAR label corresponding to the
* COAR code will be used to set the label parameter. The scheme value will always be the one referring to the COAR
* access right scheme
*/
public class BestAccessRight implements Serializable {
@JsonSchema(description="COAR access mode code: http://vocabularies.coar-repositories.org/documentation/access_rights/")
private String code; // the classid in the Qualifier
@JsonSchema(description="Label for the access mode")
private String label; // the classname in the Qualifier
@JsonSchema(description="Scheme of reference for access right code. Always set to COAR access rights vocabulary: http://vocabularies.coar-repositories.org/documentation/access_rights/")
private String scheme;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static BestAccessRight newInstance(String code, String label, String scheme) {
BestAccessRight ar = new BestAccessRight();
ar.code = code ;
ar.label = label;
ar.scheme = scheme;
return ar;
}
}

View File

@ -2,7 +2,8 @@
package eu.dnetlib.dhp.schema.dump.oaf; package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To store information about the conference or journal where the result has been presented or published. It contains * To store information about the conference or journal where the result has been presented or published. It contains
@ -23,6 +24,7 @@ import java.util.Objects;
*/ */
public class Container implements Serializable { public class Container implements Serializable {
@JsonSchema(description="Name of the journal or conference")
private String name; private String name;
private String issnPrinted; private String issnPrinted;
@ -31,14 +33,19 @@ public class Container implements Serializable {
private String issnLinking; private String issnLinking;
@JsonSchema(description="End page")
private String ep; private String ep;
@JsonSchema(description="Journal issue number")
private String iss; private String iss;
@JsonSchema(description="Start page")
private String sp; private String sp;
@JsonSchema(description = "Volume")
private String vol; private String vol;
@JsonSchema(description="Edition of the journal or conference proceeding")
private String edition; private String edition;
private String conferenceplace; private String conferenceplace;

View File

@ -1,38 +0,0 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
/**
* To represent the information described by a scheme and a value in that scheme (i.e. pid). It has two parameters: -
* scheme of type String to store the scheme - value of type String to store the value in that scheme
*/
public class ControlledField implements Serializable {
private String scheme;
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static ControlledField newInstance(String scheme, String value) {
ControlledField cf = new ControlledField();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -1,8 +1,12 @@
package eu.dnetlib.dhp.schema.dump.oaf; package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* Represents the country associated to this result. It extends eu.dnetlib.dhp.schema.dump.oaf.Qualifier with a * Represents the country associated to the generic entity. It extends eu.dnetlib.dhp.schema.dump.oaf.Qualifier with a
* provenance parameter of type eu.dnetlib.dhp.schema.dumo.oaf.Provenance. The country in not mapped if its value in the * provenance parameter of type eu.dnetlib.dhp.schema.dumo.oaf.Provenance. The country in not mapped if its value in the
* result reprensented in the internal format is Unknown. The value for this element correspond to: - code corresponds * result reprensented in the internal format is Unknown. The value for this element correspond to: - code corresponds
* to the classid of eu.dnetlib.dhp.schema.oaf.Country - label corresponds to the classname of * to the classid of eu.dnetlib.dhp.schema.oaf.Country - label corresponds to the classname of
@ -10,28 +14,36 @@ package eu.dnetlib.dhp.schema.dump.oaf;
* dumped is not null. In this case : - provenance corresponds to dataInfo.provenanceaction.classid (to be modified with * dumped is not null. In this case : - provenance corresponds to dataInfo.provenanceaction.classid (to be modified with
* datainfo.provenanceaction.classname) - trust corresponds to dataInfo.trust * datainfo.provenanceaction.classname) - trust corresponds to dataInfo.trust
*/ */
public class Country extends Qualifier { public class Country implements Serializable {
@JsonSchema(description="ISO 3166-1 alpha-2 country code (i.e. IT)")
private String code; // the classid in the Qualifier
private Provenance provenance; @JsonSchema(description="The label for that code (i.e. Italy)")
private String label; // the classname in the Qualifier
public Provenance getProvenance() { public String getCode() {
return provenance; return code;
} }
public void setProvenance(Provenance provenance) { public void setCode(String code) {
this.provenance = provenance; this.code = code;
} }
public static Country newInstance(String code, String label, Provenance provenance) { public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static Country newInstance(String code, String label) {
Country c = new Country(); Country c = new Country();
c.setProvenance(provenance);
c.setCode(code); c.setCode(code);
c.setLabel(label); c.setLabel(label);
return c; return c;
} }
public static Country newInstance(String code, String label, String provenance, String trust) {
return newInstance(code, label, Provenance.newInstance(provenance, trust));
}
} }

View File

@ -3,11 +3,17 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class Funder implements Serializable { public class Funder implements Serializable {
@JsonSchema(description = "The short name of the funder (EC)")
private String shortName; private String shortName;
@JsonSchema(description = "The name of the funder (European Commission)")
private String name; private String name;
@JsonSchema(description = "Geographical jurisdiction (e.g. for European Commission is EU, for Croatian Science Foundation is HR)")
private String jurisdiction; private String jurisdiction;
public String getJurisdiction() { public String getJurisdiction() {

View File

@ -4,6 +4,11 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* Represents the manifestations (i.e. different versions) of the result. For example: the pre-print and the published * Represents the manifestations (i.e. different versions) of the result. For example: the pre-print and the published
* versions are two manifestations of the same research result. It has the following parameters: - license of type * versions are two manifestations of the same research result. It has the following parameters: - license of type
@ -12,28 +17,48 @@ import java.util.List;
* type of type String to store the type of the instance as defined in the corresponding dnet vocabulary * type of type String to store the type of the instance as defined in the corresponding dnet vocabulary
* (dnet:pubication_resource). It corresponds to the instancetype.classname of the instance to be mapped - url of type * (dnet:pubication_resource). It corresponds to the instancetype.classname of the instance to be mapped - url of type
* List<String> list of locations where the instance is accessible. It corresponds to url of the instance to be dumped - * List<String> list of locations where the instance is accessible. It corresponds to url of the instance to be dumped -
* publicationdate of type String to store the publication date of the instance ;// dateofacceptance; * publicationdate of type String to store the publication date of the instance ;// dateofacceptance; - refereed of type
* - refereed of type
* String to store information abour the review status of the instance. Possible values are 'Unknown', * String to store information abour the review status of the instance. Possible values are 'Unknown',
* 'nonPeerReviewed', 'peerReviewed'. It corresponds to refereed.classname of the instance to be dumped * 'nonPeerReviewed', 'peerReviewed'. It corresponds to refereed.classname of the instance to be dumped
* - articleprocessingcharge of type APC to store the article processing charges possibly associated to the instance * - articleprocessingcharge of type APC to store the article processing charges possibly associated to the instance
* -pid of type List<ControlledField> that is the list of pids associated to the result coming from authoritative sources for that pid
* -alternateIdentifier of type List<ControlledField> that is the list of pids associated to the result coming from NON authoritative
* sources for that pid
* -measure list<KeyValue> to represent the measure computed for this instance (for example the Bip!Finder ones). It corresponds to measures in the model
*/ */
public class Instance implements Serializable { public class Instance implements Serializable {
@JsonSchema(description = "Measures computed for this instance, for example Bip!Finder ones")
private List<Measure> measures;
private List<ResultPid> pid;
@JsonSchema(description = "All the identifiers other than pids forged by an authorithy for the pid type (i.e. Crossref for DOIs")
private List<AlternateIdentifier> alternateIdentifier;
private String license; private String license;
@JsonSchema(description = "The accessRights for this materialization of the result")
private AccessRight accessright; private AccessRight accessright;
@JsonSchema(description = "The specific sub-type of this instance (see https://api.openaire.eu/vocabularies/dnet:result_typologies following the links)")
private String type; private String type;
@JsonSchema(description = "URLs to the instance. They may link to the actual full-text or to the landing page at the hosting source. ")
private List<String> url; private List<String> url;
private String publicationdate;// dateofacceptance; @JsonSchema(description = "The money spent to make this book or article available in Open Access. Source for this information is the OpenAPC initiative.")
private APC articleprocessingcharge; private APC articleprocessingcharge;
@JsonSchema(description = "Date of the research product")
private String publicationdate;// dateofacceptance;
@JsonSchema(description = "If this instance has been peer-reviewed or not. Allowed values are peerReviewed, " +
"nonPeerReviewed, UNKNOWN (as defined in https://api.openaire.eu/vocabularies/dnet:review_levels)")
private String refereed; // peer-review status private String refereed; // peer-review status
public String getLicense() { public String getLicense() {
return license; return license;
} }
@ -89,4 +114,31 @@ public class Instance implements Serializable {
public void setArticleprocessingcharge(APC articleprocessingcharge) { public void setArticleprocessingcharge(APC articleprocessingcharge) {
this.articleprocessingcharge = articleprocessingcharge; this.articleprocessingcharge = articleprocessingcharge;
} }
public List<ResultPid> getPid() {
return pid;
}
public void setPid(List<ResultPid> pid) {
this.pid = pid;
}
public List<AlternateIdentifier> getAlternateIdentifier() {
return alternateIdentifier;
}
public void setAlternateIdentifier(List<AlternateIdentifier> alternateIdentifier) {
this.alternateIdentifier = alternateIdentifier;
}
public List<Measure> getMeasures() {
return measures;
}
public void setMeasures(List<Measure> measures) {
this.measures = measures;
}
} }

View File

@ -1,48 +0,0 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* To represent the information described by a key and a value. It has two parameters: - key to store the key (generally
* the OpenAIRE id for some entity) - value to store the value (generally the OpenAIRE name for the key)
*/
public class KeyValue implements Serializable {
private String key;
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static KeyValue newInstance(String key, String value) {
KeyValue inst = new KeyValue();
inst.key = key;
inst.value = value;
return inst;
}
@JsonIgnore
public boolean isBlank() {
return StringUtils.isBlank(key) && StringUtils.isBlank(value);
}
}

View File

@ -0,0 +1,37 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class Language implements Serializable {
@JsonSchema(description="alpha-3/ISO 639-2 code of the language")
private String code; // the classid in the Qualifier
@JsonSchema(description="Language label in English")
private String label; // the classname in the Qualifier
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static Language newInstance(String code, String value) {
Language qualifier = new Language();
qualifier.setCode(code);
qualifier.setLabel(value);
return qualifier;
}
}

View File

@ -0,0 +1,45 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class Measure implements Serializable {
@JsonSchema(description = "The measure (i.e. popularity)")
private String key;
@JsonSchema(description = "The value for that measure")
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static Measure newInstance(String key, String value) {
Measure inst = new Measure();
inst.key = key;
inst.value = value;
return inst;
}
@JsonIgnore
public boolean isBlank() {
return StringUtils.isBlank(key) && StringUtils.isBlank(value);
}
}

View File

@ -0,0 +1,13 @@
package eu.dnetlib.dhp.schema.dump.oaf;
/**
* This Enum models the OpenAccess status, currently including only the values from Unpaywall
*
* https://support.unpaywall.org/support/solutions/articles/44001777288-what-do-the-types-of-oa-status-green-gold-hybrid-and-bronze-mean-
*/
public enum OpenAccessRoute {
gold, green, hybrid, bronze
}

View File

@ -1,45 +0,0 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
/**
* To represent the generic persistent identifier. It has two parameters: - id of type
* eu.dnetlib.dhp.schema.dump.oaf.ControlledField to store the scheme and value of the Persistent Identifier. -
* provenance of type eu.dnetlib.dhp.schema.dump.oaf.Provenance to store the provenance and trust of the information
*/
public class Pid implements Serializable {
private ControlledField id;
private Provenance provenance;
public ControlledField getId() {
return id;
}
public void setId(ControlledField pid) {
this.id = pid;
}
public Provenance getProvenance() {
return provenance;
}
public void setProvenance(Provenance provenance) {
this.provenance = provenance;
}
public static Pid newInstance(ControlledField pid, Provenance provenance) {
Pid p = new Pid();
p.id = pid;
p.provenance = provenance;
return p;
}
public static Pid newInstance(ControlledField pid) {
Pid p = new Pid();
p.id = pid;
return p;
}
}

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* This class to store the common information about the project that will be dumped for community and for the whole * This class to store the common information about the project that will be dumped for community and for the whole
* graph - private String id to store the id of the project (OpenAIRE id) - private String code to store the grant * graph - private String id to store the id of the project (OpenAIRE id) - private String code to store the grant
@ -10,9 +12,13 @@ import java.io.Serializable;
* the tile of the project * the tile of the project
*/ */
public class Project implements Serializable { public class Project implements Serializable {
@JsonSchema(description = "The OpenAIRE id for the project")
protected String id;// OpenAIRE id protected String id;// OpenAIRE id
@JsonSchema(description = "The grant agreement number")
protected String code; protected String code;
@JsonSchema(description = "The acronym of the project")
protected String acronym; protected String acronym;
protected String title; protected String title;

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* Indicates the process that produced (or provided) the information, and the trust associated to the information. It * Indicates the process that produced (or provided) the information, and the trust associated to the information. It
* has two parameters: - provenance of type String to store the provenance of the information, - trust of type String to * has two parameters: - provenance of type String to store the provenance of the information, - trust of type String to

View File

@ -1,42 +0,0 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* To represent the information described by a code and a value It has two parameters: - code to store the code
* (generally the classid of the eu.dnetlib.dhp.schema.oaf.Qualifier element) - label to store the label (generally the
* classname of the eu.dnetlib.dhp.schema.oaf.Qualifier element
*/
public class Qualifier implements Serializable {
private String code; // the classid in the Qualifier
private String label; // the classname in the Qualifier
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public static Qualifier newInstance(String code, String value) {
Qualifier qualifier = new Qualifier();
qualifier.setCode(code);
qualifier.setLabel(value);
return qualifier;
}
}

View File

@ -4,17 +4,21 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.dump.oaf.community.Project; import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To represent the dumped result. It will be extended in the dump for Research Communities - Research * To represent the dumped result. It will be extended in the dump for Research Communities - Research
* Initiative/Infrastructures. It has the following parameters: - author of type * Initiative/Infrastructures. It has the following parameters:
* - author of type
* List<eu.dnetlib.dhpschema.dump.oaf.Author> to describe the authors of a result. For each author in the result * List<eu.dnetlib.dhpschema.dump.oaf.Author> to describe the authors of a result. For each author in the result
* represented in the internal model one author in the esternal model is produced. - type of type String to represent * represented in the internal model one author in the esternal model is produced.
* - type of type String to represent
* the category of the result. Possible values are publication, dataset, software, other. It corresponds to * the category of the result. Possible values are publication, dataset, software, other. It corresponds to
* resulttype.classname of the dumped result - language of type eu.dnetlib.dhp.schema.dump.oaf.Qualifier to store * resulttype.classname of the dumped result
* - language of type eu.dnetlib.dhp.schema.dump.oaf.Language to store
* information about the language of the result. It is dumped as - code corresponds to language.classid - value * information about the language of the result. It is dumped as - code corresponds to language.classid - value
* corresponds to language.classname - country of type List<eu.dnetlib.dhp.schema.dump.oaf.Country> to store the country * corresponds to language.classname
* - country of type List<eu.dnetlib.dhp.schema.dump.oaf.Country> to store the country
* list to which the result is associated. For each country in the result respresented in the internal model one country * list to which the result is associated. For each country in the result respresented in the internal model one country
* in the external model is produces - subjects of type List<eu.dnetlib.dhp.dump.oaf.Subject> to store the subjects for * in the external model is produces - subjects of type List<eu.dnetlib.dhp.dump.oaf.Subject> to store the subjects for
* the result. For each subject in the result represented in the internal model one subject in the external model is * the result. For each subject in the result represented in the internal model one subject in the external model is
@ -62,73 +66,101 @@ import eu.dnetlib.dhp.schema.dump.oaf.community.Project;
* to store information about the time OpenAIRE collected the record. It corresponds to dateofcollection of the result * to store information about the time OpenAIRE collected the record. It corresponds to dateofcollection of the result
* represented in the internal model - lasteupdatetimestamp of type String to store the timestamp of the last update of * represented in the internal model - lasteupdatetimestamp of type String to store the timestamp of the last update of
* the record. It corresponds to lastupdatetimestamp of the resord represented in the internal model * the record. It corresponds to lastupdatetimestamp of the resord represented in the internal model
*
*/ */
public class Result implements Serializable { public class Result implements Serializable {
private List<Author> author; private List<Author> author;
// resulttype allows subclassing results into publications | datasets | software // resulttype allows subclassing results into publications | datasets | software
@JsonSchema(description = "Type of the result: one of 'publication', 'dataset', 'software', 'other' (see also https://api.openaire.eu/vocabularies/dnet:result_typologies)")
private String type; // resulttype private String type; // resulttype
// common fields // common fields
private Qualifier language; private Language language;
private List<Country> country; @JsonSchema(description="The list of countries associated to this result")
private List<ResultCountry> country;
@JsonSchema(description="Keywords associated to the result")
private List<Subject> subjects; private List<Subject> subjects;
@JsonSchema(description = "A name or title by which a scientific result is known. May be the title of a publication, of a dataset or the name of a piece of software.")
private String maintitle; private String maintitle;
@JsonSchema(description = "Explanatory or alternative name by which a scientific result is known.")
private String subtitle; private String subtitle;
private List<String> description; private List<String> description;
@JsonSchema(description = "Main date of the research product: typically the publication or issued date. In case of a research result with different versions with different dates, the date of the result is selected as the most frequent well-formatted date. If not available, then the most recent and complete date among those that are well-formatted. For statistics, the year is extracted and the result is counted only among the result of that year. Example: Pre-print date: 2019-02-03, Article date provided by repository: 2020-02, Article date provided by Crossref: 2020, OpenAIRE will set as date 2019-02-03, because its the most recent among the complete and well-formed dates. If then the repository updates the metadata and set a complete date (e.g. 2020-02-12), then this will be the new date for the result because it becomes the most recent most complete date. However, if OpenAIRE then collects the pre-print from another repository with date 2019-02-03, then this will be the “winning date” because it becomes the most frequent well-formatted date.")
private String publicationdate; // dateofacceptance; private String publicationdate; // dateofacceptance;
@JsonSchema(description = "The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.")
private String publisher; private String publisher;
@JsonSchema(description = "Date when the embargo ends and this result turns Open Access")
private String embargoenddate; private String embargoenddate;
@JsonSchema(description = "See definition of Dublin Core field dc:source")
private List<String> source; private List<String> source;
private List<String> format; private List<String> format;
@JsonSchema(description="Contributors for the result")
private List<String> contributor; private List<String> contributor;
private List<String> coverage; private List<String> coverage;
private AccessRight bestaccessright; @JsonSchema(description="The openest of the access rights of this result.")
private BestAccessRight bestaccessright;
@JsonSchema(description="Container has information about the conference or journal where the result has been presented or published")
private Container container;// Journal private Container container;// Journal
@JsonSchema(description = "Only for results with type 'software': URL to the software documentation")
private List<String> documentationUrl; // software private List<String> documentationUrl; // software
@JsonSchema(description="Only for results with type 'software': the URL to the repository with the source code")
private String codeRepositoryUrl; // software private String codeRepositoryUrl; // software
@JsonSchema(description = "Only for results with type 'software': the programming language")
private String programmingLanguage; // software private String programmingLanguage; // software
@JsonSchema(description="Only for results with type 'software': Information on the person responsible for providing further information regarding the resource")
private List<String> contactperson; // orp private List<String> contactperson; // orp
@JsonSchema(description="Only for results with type 'software': Information on the group responsible for providing further information regarding the resource")
private List<String> contactgroup; // orp private List<String> contactgroup; // orp
@JsonSchema(description = "Only for results with type 'other': tool useful for the interpretation and/or re-used of the research product")
private List<String> tool; // orp private List<String> tool; // orp
@JsonSchema(description = "Only for results with type 'dataset': the declared size of the dataset")
private String size; // dataset private String size; // dataset
@JsonSchema(description = "Version of the result")
private String version; // dataset private String version; // dataset
@JsonSchema(description = "Geolocation information")
private List<GeoLocation> geolocation; // dataset private List<GeoLocation> geolocation; // dataset
@JsonSchema(description = "The OpenAIRE identifiers for this result")
private String id; private String id;
@JsonSchema(description = "Identifiers of the record at the original sources")
private List<String> originalId; private List<String> originalId;
private List<ControlledField> pid; @JsonSchema(description = "Persistent identifiers of the result")
private List<ResultPid> pid;
@JsonSchema(description="When OpenAIRE collected the record the last time")
private String dateofcollection; private String dateofcollection;
@JsonSchema(description = "Timestamp of last update of the record in OpenAIRE")
private Long lastupdatetimestamp; private Long lastupdatetimestamp;
public Long getLastupdatetimestamp() { public Long getLastupdatetimestamp() {
return lastupdatetimestamp; return lastupdatetimestamp;
} }
@ -153,11 +185,11 @@ public class Result implements Serializable {
this.originalId = originalId; this.originalId = originalId;
} }
public List<ControlledField> getPid() { public List<ResultPid> getPid() {
return pid; return pid;
} }
public void setPid(List<ControlledField> pid) { public void setPid(List<ResultPid> pid) {
this.pid = pid; this.pid = pid;
} }
@ -193,19 +225,19 @@ public class Result implements Serializable {
this.author = author; this.author = author;
} }
public Qualifier getLanguage() { public Language getLanguage() {
return language; return language;
} }
public void setLanguage(Qualifier language) { public void setLanguage(Language language) {
this.language = language; this.language = language;
} }
public List<Country> getCountry() { public List<ResultCountry> getCountry() {
return country; return country;
} }
public void setCountry(List<Country> country) { public void setCountry(List<ResultCountry> country) {
this.country = country; this.country = country;
} }
@ -297,11 +329,11 @@ public class Result implements Serializable {
this.coverage = coverage; this.coverage = coverage;
} }
public AccessRight getBestaccessright() { public BestAccessRight getBestaccessright() {
return bestaccessright; return bestaccessright;
} }
public void setBestaccessright(AccessRight bestaccessright) { public void setBestaccessright(BestAccessRight bestaccessright) {
this.bestaccessright = bestaccessright; this.bestaccessright = bestaccessright;
} }
@ -376,4 +408,6 @@ public class Result implements Serializable {
public void setGeolocation(List<GeoLocation> geolocation) { public void setGeolocation(List<GeoLocation> geolocation) {
this.geolocation = geolocation; this.geolocation = geolocation;
} }
} }

View File

@ -0,0 +1,40 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/**
* Represents the country associated to the generic result. It extends eu.dnetlib.dhp.schema.dump.oaf.Country with a
* provenance parameter of type eu.dnetlib.dhp.schema.dumo.oaf.Provenance. The country is not mapped if its value in the
* result reprensented in the internal format is Unknown. The value for this element correspond to:
* - code corresponds to the classid of eu.dnetlib.dhp.schema.oaf.Country
* - label corresponds to the classname of eu.dnetlib.dhp.schema.oaf.Country
* - provenance set only if the dataInfo associated to the Country of the result to be dumped is not null. In this case:
* - provenance corresponds to dataInfo.provenanceaction.classid (to be modified with datainfo.provenanceaction.classname)
* - trust corresponds to dataInfo.trust
*/
public class ResultCountry extends Country {
@JsonSchema(description="Why this result is associated to the country.")
private Provenance provenance;
public Provenance getProvenance() {
return provenance;
}
public void setProvenance(Provenance provenance) {
this.provenance = provenance;
}
public static ResultCountry newInstance(String code, String label, Provenance provenance) {
ResultCountry c = new ResultCountry();
c.setProvenance(provenance);
c.setCode(code);
c.setLabel(label);
return c;
}
public static ResultCountry newInstance(String code, String label, String provenance, String trust) {
return newInstance(code, label, Provenance.newInstance(provenance, trust));
}
}

View File

@ -0,0 +1,41 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class ResultPid implements Serializable {
@JsonSchema(description="The scheme of the persistent identifier for the result (i.e. doi). " +
"If the pid is here it means the information for the pid has been collected from an authority for " +
"that pid type (i.e. Crossref/Datacite for doi). The set of authoritative pid is: doi when collected from Crossref or Datacite " +
"pmid when collected from EuroPubmed, arxiv when collected from arXiv, handle from the repositories")
private String scheme;
@JsonSchema(description="The value expressed in the scheme (i.e. 10.1000/182)")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static ResultPid newInstance(String scheme, String value) {
ResultPid cf = new ResultPid();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -3,23 +3,29 @@ package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To represent keywords associated to the result. It has two parameters: - subject of type * To represent keywords associated to the result. It has two parameters:
* eu.dnetlib.dhp.schema.dump.oaf.ControlledField to describe the subject. It mapped as: - schema it corresponds to * - subject of type eu.dnetlib.dhp.schema.dump.oaf.SubjectSchemeValue to describe the subject. It mapped as:
* qualifier.classid of the dumped subject - value it corresponds to the subject value - provenance of type * - schema it corresponds to qualifier.classid of the dumped subject
* eu.dnetlib.dhp.schema.dump.oaf.Provenance to represent the provenance of the subject. It is dumped only if dataInfo * - value it corresponds to the subject value
* is not null. In this case: - provenance corresponds to dataInfo.provenanceaction.classname - trust corresponds to * - provenance of type eu.dnetlib.dhp.schema.dump.oaf.Provenance to represent the provenance of the subject. It is dumped only if dataInfo
* dataInfo.trust * is not null. In this case:
* - provenance corresponds to dataInfo.provenanceaction.classname
* - trust corresponds to dataInfo.trust
*/ */
public class Subject implements Serializable { public class Subject implements Serializable {
private ControlledField subject; private SubjectSchemeValue subject;
@JsonSchema(description = "Why this subject is associated to the result")
private Provenance provenance; private Provenance provenance;
public ControlledField getSubject() { public SubjectSchemeValue getSubject() {
return subject; return subject;
} }
public void setSubject(ControlledField subject) { public void setSubject(SubjectSchemeValue subject) {
this.subject = subject; this.subject = subject;
} }

View File

@ -0,0 +1,39 @@
package eu.dnetlib.dhp.schema.dump.oaf;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class SubjectSchemeValue implements Serializable {
@JsonSchema(description="OpenAIRE subject classification scheme (https://api.openaire.eu/vocabularies/dnet:subject_classification_typologies).")
private String scheme;
@JsonSchema(description="The value for the subject in the selected scheme. When the scheme is 'keyword', it means that the subject is free-text (i.e. not a term from a controlled vocabulary).")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static SubjectSchemeValue newInstance(String scheme, String value) {
SubjectSchemeValue cf = new SubjectSchemeValue();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -0,0 +1,46 @@
package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class CfHbKeyValue implements Serializable {
@JsonSchema(description = "the OpenAIRE identifier of the data source")
private String key;
@JsonSchema(description = "the name of the data source")
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static CfHbKeyValue newInstance(String key, String value) {
CfHbKeyValue inst = new CfHbKeyValue();
inst.key = key;
inst.value = value;
return inst;
}
@JsonIgnore
public boolean isBlank() {
return StringUtils.isBlank(key) && StringUtils.isBlank(value);
}
}

View File

@ -1,8 +1,9 @@
package eu.dnetlib.dhp.schema.dump.oaf.community; package eu.dnetlib.dhp.schema.dump.oaf.community;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Instance; import eu.dnetlib.dhp.schema.dump.oaf.Instance;
import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
/** /**
* It extends eu.dnetlib.dhp.dump.oaf.Instance with values related to the community dump. In the Result dump this * It extends eu.dnetlib.dhp.dump.oaf.Instance with values related to the community dump. In the Result dump this
@ -15,22 +16,25 @@ import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
* collectedfrom.key - value corresponds to collectedfrom.value * collectedfrom.key - value corresponds to collectedfrom.value
*/ */
public class CommunityInstance extends Instance { public class CommunityInstance extends Instance {
private KeyValue hostedby; @JsonSchema(description = "Information about the source from which the instance can be viewed or downloaded.")
private KeyValue collectedfrom; private CfHbKeyValue hostedby;
public KeyValue getHostedby() { @JsonSchema(description = "Information about the source from which the record has been collected")
private CfHbKeyValue collectedfrom;
public CfHbKeyValue getHostedby() {
return hostedby; return hostedby;
} }
public void setHostedby(KeyValue hostedby) { public void setHostedby(CfHbKeyValue hostedby) {
this.hostedby = hostedby; this.hostedby = hostedby;
} }
public KeyValue getCollectedfrom() { public CfHbKeyValue getCollectedfrom() {
return collectedfrom; return collectedfrom;
} }
public void setCollectedfrom(KeyValue collectedfrom) { public void setCollectedfrom(CfHbKeyValue collectedfrom) {
this.collectedfrom = collectedfrom; this.collectedfrom = collectedfrom;
} }
} }

View File

@ -3,7 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.dump.oaf.KeyValue; import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Result; import eu.dnetlib.dhp.schema.dump.oaf.Result;
/** /**
@ -20,12 +21,16 @@ import eu.dnetlib.dhp.schema.dump.oaf.Result;
*/ */
public class CommunityResult extends Result { public class CommunityResult extends Result {
@JsonSchema(description = "List of projects (i.e. grants) that (co-)funded the production ofn the research results")
private List<Project> projects; private List<Project> projects;
@JsonSchema(description = "Reference to a relevant research infrastructure, initiative or community (RI/RC) among those collaborating with OpenAIRE. Please see https://connect.openaire.eu")
private List<Context> context; private List<Context> context;
protected List<KeyValue> collectedfrom; @JsonSchema(description = "Information about the sources from which the record has been collected")
protected List<CfHbKeyValue> collectedfrom;
@JsonSchema(description = "Each instance is one specific materialisation or version of the result. For example, you can have one result with three instance: one is the pre-print, one is the post-print, one is te published version")
private List<CommunityInstance> instance; private List<CommunityInstance> instance;
public List<CommunityInstance> getInstance() { public List<CommunityInstance> getInstance() {
@ -36,11 +41,11 @@ public class CommunityResult extends Result {
this.instance = instance; this.instance = instance;
} }
public List<KeyValue> getCollectedfrom() { public List<CfHbKeyValue> getCollectedfrom() {
return collectedfrom; return collectedfrom;
} }
public void setCollectedfrom(List<KeyValue> collectedfrom) { public void setCollectedfrom(List<CfHbKeyValue> collectedfrom) {
this.collectedfrom = collectedfrom; this.collectedfrom = collectedfrom;
} }
@ -61,3 +66,5 @@ public class CommunityResult extends Result {
} }
} }

View File

@ -3,9 +3,12 @@ package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
import eu.dnetlib.dhp.schema.dump.oaf.Qualifier;
/** /**
* Reference to a relevant research infrastructure, initiative or community (RI/RC) among those collaborating with * Reference to a relevant research infrastructure, initiative or community (RI/RC) among those collaborating with
@ -19,7 +22,14 @@ import eu.dnetlib.dhp.schema.dump.oaf.Qualifier;
* instantiated if the element datainfo.provenanceaction is not null. In this case - provenance corresponds to * instantiated if the element datainfo.provenanceaction is not null. In this case - provenance corresponds to
* dataInfo.provenanceaction.classname - trust corresponds to dataInfo.trust * dataInfo.provenanceaction.classname - trust corresponds to dataInfo.trust
*/ */
public class Context extends Qualifier { public class Context {
@JsonSchema(description="Code identifying the RI/RC")
private String code;
@JsonSchema(description="Label of the RI/RC")
private String label;
@JsonSchema(description = "Why this result is associated to the RI/RC.")
private List<Provenance> provenance; private List<Provenance> provenance;
public List<Provenance> getProvenance() { public List<Provenance> getProvenance() {
@ -30,11 +40,32 @@ public class Context extends Qualifier {
this.provenance = provenance; this.provenance = provenance;
} }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override @Override
public int hashCode() { public int hashCode() {
String provenance = ""; final String p = Optional.ofNullable(getProvenance())
this.provenance.forEach(p -> provenance.concat(p.toString())); .map(prov -> prov.stream()
return Objects.hash(getCode(), getLabel(), provenance); .map(Provenance::toString)
.collect(Collectors.joining()))
.orElse("");
return Objects.hash(getCode(), getLabel(), p);
} }
} }

View File

@ -1,7 +1,7 @@
package eu.dnetlib.dhp.schema.dump.oaf.community; package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.io.Serializable; import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To store information about the funder funding the project related to the result. It has the following parameters: - * To store information about the funder funding the project related to the result. It has the following parameters: -
@ -11,6 +11,7 @@ import java.io.Serializable;
*/ */
public class Funder extends eu.dnetlib.dhp.schema.dump.oaf.Funder { public class Funder extends eu.dnetlib.dhp.schema.dump.oaf.Funder {
@JsonSchema(description = "Stream of funding (e.g. for European Commission can be H2020 or FP7)")
private String fundingStream; private String fundingStream;
public String getFundingStream() { public String getFundingStream() {

View File

@ -1,7 +1,7 @@
package eu.dnetlib.dhp.schema.dump.oaf.community; package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.io.Serializable; import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
@ -15,10 +15,21 @@ import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
*/ */
public class Project extends eu.dnetlib.dhp.schema.dump.oaf.Project { public class Project extends eu.dnetlib.dhp.schema.dump.oaf.Project {
@JsonSchema(description = "Information about the funder funding the project")
private Funder funder; private Funder funder;
private Provenance provenance; private Provenance provenance;
private Validated validated;
public void setValidated(Validated validated){
this.validated = validated;
}
public Validated getValidated(){
return validated;
}
public Provenance getProvenance() { public Provenance getProvenance() {
return provenance; return provenance;
} }

View File

@ -0,0 +1,39 @@
package eu.dnetlib.dhp.schema.dump.oaf.community;
import java.io.Serializable;
/**
* To store information about the funder funding the project related to the result. It has the following parameters: -
* shortName of type String to store the funder short name (e.c. AKA). - name of type String to store the funder name
* (e.c. Akademy of Finland) - fundingStream of type String to store the funding stream - jurisdiction of type String to
* store the jurisdiction of the funder
*/
public class Validated implements Serializable {
private String validationDate;
private Boolean validatedByFunder;
public void setValidationDate(String validationDate){
this.validationDate = validationDate;
}
public String getValidationDate(){
return validationDate;
}
public void setValidatedByFunder(Boolean validated){
this.validatedByFunder = validated;
}
public Boolean getValidatedByFunder(){
return validatedByFunder;
}
public static Validated newInstance(Boolean validated, String validationDate){
Validated v = new Validated();
v.validatedByFunder = validated;
v.validationDate = validationDate;
return v;
}
}

View File

@ -4,9 +4,9 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Container; import eu.dnetlib.dhp.schema.dump.oaf.Container;
import eu.dnetlib.dhp.schema.dump.oaf.ControlledField;
import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
/** /**
* To store information about the datasource OpenAIRE collects information from. It contains the following parameters: - * To store information about the datasource OpenAIRE collects information from. It contains the following parameters: -
@ -34,70 +34,91 @@ import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
* datasource. It corresponds to description.value of the datasource represented in the internal model * datasource. It corresponds to description.value of the datasource represented in the internal model
*/ */
public class Datasource implements Serializable { public class Datasource implements Serializable {
@JsonSchema(description = "The OpenAIRE id of the data source")
private String id; // string private String id; // string
@JsonSchema(description = "Original identifiers for the datasource")
private List<String> originalId; // list string private List<String> originalId; // list string
private List<ControlledField> pid; // list<String> @JsonSchema(description = "Persistent identifiers of the datasource")
private List<DatasourcePid> pid; // list<String>
private ControlledField datasourcetype; // value @JsonSchema(description = "The type of the datasource. See https://api.openaire.eu/vocabularies/dnet:datasource_typologies")
private DatasourceSchemeValue datasourcetype; // value
@JsonSchema(description = "OpenAIRE guidelines the data source comply with. See also https://guidelines.openaire.eu.")
private String openairecompatibility; // value private String openairecompatibility; // value
@JsonSchema(description = "The official name of the datasource")
private String officialname; // string private String officialname; // string
@JsonSchema(description = "The English name of the datasource")
private String englishname; // string private String englishname; // string
private String websiteurl; // string private String websiteurl; // string
private String logourl; // string private String logourl; // string
@JsonSchema(description = "The date of last validation against the OpenAIRE guidelines for the datasource records")
private String dateofvalidation; // string private String dateofvalidation; // string
private String description; // description private String description; // description
@JsonSchema(description = "List of subjects associated to the datasource")
private List<String> subjects; // List<String> private List<String> subjects; // List<String>
// opendoar specific fields (od*) // opendoar specific fields (od*)
@JsonSchema(description = "The languages present in the data source's content, as defined by OpenDOAR.")
private List<String> languages; // odlanguages List<String> private List<String> languages; // odlanguages List<String>
@JsonSchema(description = "Types of content in the data source, as defined by OpenDOAR")
private List<String> contenttypes; // odcontent types List<String> private List<String> contenttypes; // odcontent types List<String>
// re3data fields // re3data fields
@JsonSchema(description = "Releasing date of the data source, as defined by re3data.org")
private String releasestartdate; // string private String releasestartdate; // string
@JsonSchema(description = "Date when the data source went offline or stopped ingesting new research data. As defined by re3data.org")
private String releaseenddate; // string private String releaseenddate; // string
@JsonSchema(description = "The URL of a mission statement describing the designated community of the data source. As defined by re3data.org")
private String missionstatementurl; // string private String missionstatementurl; // string
// {open, restricted or closed} @JsonSchema(description = "Type of access to the data source, as defined by re3data.org. Possible values: " +
"{open, restricted, closed}")
private String accessrights; // databaseaccesstype string private String accessrights; // databaseaccesstype string
// {open, restricted or closed} // {open, restricted or closed}
@JsonSchema(description = "Type of data upload. As defined by re3data.org: one of {open, restricted,closed}")
private String uploadrights; // datauploadtype string private String uploadrights; // datauploadtype string
// {feeRequired, registration, other} @JsonSchema(description = "Access restrinctions to the data source, as defined by re3data.org. One of {feeRequired, registration, other}")
private String databaseaccessrestriction; // string private String databaseaccessrestriction; // string
// {feeRequired, registration, other} @JsonSchema(description = "Upload restrictions applied by the datasource, as defined by re3data.org. One of {feeRequired, registration, other}")
private String datauploadrestriction; // string private String datauploadrestriction; // string
@JsonSchema(description = "As defined by redata.org: 'yes' if the data source supports versioning, 'no' otherwise.")
private Boolean versioning; // boolean private Boolean versioning; // boolean
@JsonSchema(description = "The URL of the data source providing information on how to cite its items. As defined by re3data.org.")
private String citationguidelineurl; // string private String citationguidelineurl; // string
// {yes, no, uknown} // {yes, no, uknown}
@JsonSchema(description = "The persistent identifier system that is used by the data source. As defined by re3data.org")
private String pidsystems; // string private String pidsystems; // string
@JsonSchema(description = "The certificate, seal or standard the data source complies with. As defined by re3data.org.")
private String certificates; // string private String certificates; // string
private List<Object> policies; // @JsonSchema(description = "Policies of the data source, as defined in OpenDOAR.")
private List<String> policies; //
@JsonSchema(description = "Information about the journal, if this data source is of type Journal.")
private Container journal; // issn etc del Journal private Container journal; // issn etc del Journal
public String getId() { public String getId() {
return id; return id;
} }
@ -114,19 +135,19 @@ public class Datasource implements Serializable {
this.originalId = originalId; this.originalId = originalId;
} }
public List<ControlledField> getPid() { public List<DatasourcePid> getPid() {
return pid; return pid;
} }
public void setPid(List<ControlledField> pid) { public void setPid(List<DatasourcePid> pid) {
this.pid = pid; this.pid = pid;
} }
public ControlledField getDatasourcetype() { public DatasourceSchemeValue getDatasourcetype() {
return datasourcetype; return datasourcetype;
} }
public void setDatasourcetype(ControlledField datasourcetype) { public void setDatasourcetype(DatasourceSchemeValue datasourcetype) {
this.datasourcetype = datasourcetype; this.datasourcetype = datasourcetype;
} }
@ -298,11 +319,11 @@ public class Datasource implements Serializable {
this.certificates = certificates; this.certificates = certificates;
} }
public List<Object> getPolicies() { public List<String> getPolicies() {
return policies; return policies;
} }
public void setPolicies(List<Object> policiesr3) { public void setPolicies(List<String> policiesr3) {
this.policies = policiesr3; this.policies = policiesr3;
} }
@ -314,3 +335,5 @@ public class Datasource implements Serializable {
this.journal = journal; this.journal = journal;
} }
} }

View File

@ -0,0 +1,40 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public class DatasourcePid implements Serializable {
@JsonSchema(description="The scheme used to express the value ")
private String scheme;
@JsonSchema(description="The value expressed in the scheme ")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static DatasourcePid newInstance(String scheme, String value) {
DatasourcePid cf = new DatasourcePid();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -0,0 +1,39 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public //TODO change the DatasourceSchemaValue to DatasourceKeyValue. The scheme is always the dnet one. What we show here is the entry in the scheme (the key) and its understandable value
class DatasourceSchemeValue implements Serializable {
@JsonSchema(description="The scheme used to express the value (i.e. pubsrepository::journal)")
private String scheme;
@JsonSchema(description="The value expressed in the scheme (Journal)")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static DatasourceSchemeValue newInstance(String scheme, String value) {
DatasourceSchemeValue cf = new DatasourceSchemeValue();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -1,7 +1,7 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph; package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To store information about the funder funding the project related to the result. It extends * To store information about the funder funding the project related to the result. It extends
@ -10,6 +10,7 @@ import java.io.Serializable;
*/ */
public class Funder extends eu.dnetlib.dhp.schema.dump.oaf.Funder { public class Funder extends eu.dnetlib.dhp.schema.dump.oaf.Funder {
@JsonSchema(description = "Description of the funding stream")
private Fundings funding_stream; private Fundings funding_stream;
public Fundings getFunding_stream() { public Fundings getFunding_stream() {

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To store inforamtion about the funding stream. It has two parameters: - private String id to store the id of the * To store inforamtion about the funding stream. It has two parameters: - private String id to store the id of the
* fundings stream. The id is created by appending the shortname of the funder to the name of each level in the xml * fundings stream. The id is created by appending the shortname of the funder to the name of each level in the xml
@ -14,6 +16,7 @@ import java.io.Serializable;
*/ */
public class Fundings implements Serializable { public class Fundings implements Serializable {
@JsonSchema(description = "Id of the funding stream")
private String id; private String id;
private String description; private String description;

View File

@ -2,7 +2,8 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph; package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.Optional;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To describe the funded amount. It has the following parameters: - private String currency to store the currency of * To describe the funded amount. It has the following parameters: - private String currency to store the currency of
@ -10,8 +11,13 @@ import java.util.Optional;
* funded amount by the funder * funded amount by the funder
*/ */
public class Granted implements Serializable { public class Granted implements Serializable {
@JsonSchema(description = "The currency of the granted amount (e.g. EUR)")
private String currency; private String currency;
@JsonSchema(description = "The total cost of the project")
private float totalcost; private float totalcost;
@JsonSchema(description = "The funded amount")
private float fundedamount; private float fundedamount;
public String getCurrency() { public String getCurrency() {

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.util.List; import java.util.List;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Instance; import eu.dnetlib.dhp.schema.dump.oaf.Instance;
import eu.dnetlib.dhp.schema.dump.oaf.Result; import eu.dnetlib.dhp.schema.dump.oaf.Result;
@ -12,6 +14,7 @@ import eu.dnetlib.dhp.schema.dump.oaf.Result;
* the same parameter in the result represented in the internal model * the same parameter in the result represented in the internal model
*/ */
public class GraphResult extends Result { public class GraphResult extends Result {
@JsonSchema(description = "Each instance is one specific materialisation or version of the result. For example, you can have one result with three instance: one is the pre-print, one is the post-print, one is te published version")
private List<Instance> instance; private List<Instance> instance;
public List<Instance> getInstance() { public List<Instance> getInstance() {

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To represent the generic node in a relation. It has the following parameters: - private String id the openaire id of * To represent the generic node in a relation. It has the following parameters: - private String id the openaire id of
* the entity in the relation - private String type the type of the entity in the relation. Consider the generic * the entity in the relation - private String type the type of the entity in the relation. Consider the generic

View File

@ -4,28 +4,36 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.dump.oaf.ControlledField; import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Country; import eu.dnetlib.dhp.schema.dump.oaf.Country;
import eu.dnetlib.dhp.schema.dump.oaf.KeyValue;
import eu.dnetlib.dhp.schema.dump.oaf.Qualifier;
import eu.dnetlib.dhp.schema.dump.oaf.community.Project;
/** /**
* To represent the generic organizaiton. It has the following parameters: - private String legalshortname to store the * To represent the generic organizaiton. It has the following parameters:
* legalshortname of the organizaiton - private String legalname to store the legal name of the organization - private * - private String legalshortname to store the legalshortname of the organizaiton
* String websiteurl to store the websiteurl of the organization - private List<String> alternativenames to store the * - private String legalname to store the legal name of the organization
* alternative names of the organization - private Qualifier country to store the country of the organization - private * - private String websiteurl to store the websiteurl of the organization
* String id to store the id of the organization - private List<ControlledField> pid to store the list of pids for the * - private List<String> alternativenames to store the alternative names of the organization
* organization * - private Country country to store the country of the organization
* - private String id to store the openaire id of the organization
* - private List<OrganizationPid> pid to store the list of pids for the organization
*/ */
public class Organization implements Serializable { public class Organization implements Serializable {
private String legalshortname; private String legalshortname;
private String legalname; private String legalname;
private String websiteurl; private String websiteurl;
@JsonSchema(description="Alternative names that identify the organisation")
private List<String> alternativenames; private List<String> alternativenames;
private Qualifier country;
@JsonSchema(description="The organisation country")
private Country country;
@JsonSchema(description="The OpenAIRE id for the organisation")
private String id; private String id;
private List<ControlledField> pid;
@JsonSchema(description="Persistent identifiers for the organisation i.e. isni 0000000090326370")
private List<OrganizationPid> pid;
public String getLegalshortname() { public String getLegalshortname() {
return legalshortname; return legalshortname;
@ -59,11 +67,11 @@ public class Organization implements Serializable {
this.alternativenames = alternativenames; this.alternativenames = alternativenames;
} }
public Qualifier getCountry() { public Country getCountry() {
return country; return country;
} }
public void setCountry(Qualifier country) { public void setCountry(Country country) {
this.country = country; this.country = country;
} }
@ -75,12 +83,15 @@ public class Organization implements Serializable {
this.id = id; this.id = id;
} }
public List<ControlledField> getPid() { public List<OrganizationPid> getPid() {
return pid; return pid;
} }
public void setPid(List<ControlledField> pid) { public void setPid(List<OrganizationPid> pid) {
this.pid = pid; this.pid = pid;
} }
} }

View File

@ -0,0 +1,42 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
public
class OrganizationPid implements Serializable {
@JsonSchema(description="The scheme of the identifier (i.e. isni)")
private String scheme;
@JsonSchema(description="The value in the schema (i.e. 0000000090326370)")
private String value;
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static OrganizationPid newInstance(String scheme, String value) {
OrganizationPid cf = new OrganizationPid();
cf.setScheme(scheme);
cf.setValue(value);
return cf;
}
}

View File

@ -3,12 +3,17 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To store information about the ec programme for the project. It has the following parameters: - private String code * To store information about the ec programme for the project. It has the following parameters: - private String code
* to store the code of the programme - private String description to store the description of the programme * to store the code of the programme - private String description to store the description of the programme
*/ */
public class Programme implements Serializable { public class Programme implements Serializable {
@JsonSchema(description = "The code of the programme")
private String code; private String code;
@JsonSchema(description = "The description of the programme")
private String description; private String description;
public String getCode() { public String getCode() {

View File

@ -4,6 +4,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* This is the class representing the Project in the model used for the dumps of the whole graph. At the moment the dump * This is the class representing the Project in the model used for the dumps of the whole graph. At the moment the dump
* of the Projects differs from the other dumps because we do not create relations between Funders (Organization) and * of the Projects differs from the other dumps because we do not create relations between Funders (Organization) and
@ -41,6 +43,7 @@ public class Project implements Serializable {
private String code; private String code;
private String acronym; private String acronym;
private String title; private String title;
private String startdate; private String startdate;
private String enddate; private String enddate;
@ -54,12 +57,15 @@ public class Project implements Serializable {
private boolean openaccessmandatefordataset; private boolean openaccessmandatefordataset;
private List<String> subject; private List<String> subject;
@JsonSchema(description = "Funding information for the project")
private List<Funder> funding; private List<Funder> funding;
private String summary; private String summary;
@JsonSchema(description = "The money granted to the project")
private Granted granted; private Granted granted;
@JsonSchema(description = "The h2020 programme funding the project")
private List<Programme> h2020programme; private List<Programme> h2020programme;
public String getId() { public String getId() {

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To represent the semantics of the generic relation between two entities. It has the following parameters: - private * To represent the semantics of the generic relation between two entities. It has the following parameters: - private
* String name to store the semantics of the relation (i.e. isAuthorInstitutionOf). It corresponds to the relclass * String name to store the semantics of the relation (i.e. isAuthorInstitutionOf). It corresponds to the relclass

View File

@ -4,6 +4,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
/** /**
@ -13,11 +15,24 @@ import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
* provenance of the relation * provenance of the relation
*/ */
public class Relation implements Serializable { public class Relation implements Serializable {
@JsonSchema(description = "The node source in the relation")
private Node source; private Node source;
@JsonSchema(description = "The node target in the relation")
private Node target; private Node target;
@JsonSchema(description = "To represent the semantics of a relation between two entities")
private RelType reltype; private RelType reltype;
@JsonSchema(description = "The reason why OpenAIRE holds the relation ")
private Provenance provenance; private Provenance provenance;
@JsonSchema(description = "True if the relation is related to a project and it has been collected from an authoritative source (i.e. the funder)")
private boolean validated;
@JsonSchema(description = "The date when the relation was collected from OpenAIRE")
private String validationDate;
public Node getSource() { public Node getSource() {
return source; return source;
} }
@ -50,6 +65,23 @@ public class Relation implements Serializable {
this.provenance = provenance; this.provenance = provenance;
} }
public void setValidated(boolean validate){
this.validated = validate;
}
public boolean getValidated(){
return validated;
}
public void setValidationDate(String validationDate){
this.validationDate = validationDate;
}
public String getValidationDate(){
return validationDate;
}
@Override @Override
public int hashCode() { public int hashCode() {

View File

@ -3,11 +3,14 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.util.List; import java.util.List;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To represent RC entities. It extends eu.dnetlib.dhp.dump.oaf.grap.ResearchInitiative by adding the parameter subject * To represent RC entities. It extends eu.dnetlib.dhp.dump.oaf.grap.ResearchInitiative by adding the parameter subject
* to store the list of subjects related to the community * to store the list of subjects related to the community
*/ */
public class ResearchCommunity extends ResearchInitiative { public class ResearchCommunity extends ResearchInitiative {
@JsonSchema(description = "Only for research communities: the list of the subjects associated to the research community")
private List<String> subject; private List<String> subject;
public List<String> getSubject() { public List<String> getSubject() {

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
/** /**
* To represent entity of type RC/RI. It has the following parameters, which are mostly derived by the profile * To represent entity of type RC/RI. It has the following parameters, which are mostly derived by the profile
* - private * - private
@ -18,11 +20,22 @@ import java.io.Serializable;
* zenodo_community to store the zenodo community associated to the context (main zenodo community) * zenodo_community to store the zenodo community associated to the context (main zenodo community)
*/ */
public class ResearchInitiative implements Serializable { public class ResearchInitiative implements Serializable {
@JsonSchema(description = "The OpenAIRE id for the community/research infrastructure")
private String id; // openaireId private String id; // openaireId
private String originalId; // context id
@JsonSchema(description = "The acronym of the community")
private String acronym; // context id
@JsonSchema(description = "The long name of the community")
private String name; // context name private String name; // context name
@JsonSchema(description = "One of {Research Community, Research infrastructure}")
private String type; // context type: research initiative or research community private String type; // context type: research initiative or research community
@JsonSchema(description = "Description of the research community/research infrastructure")
private String description; private String description;
@JsonSchema(description = "The URL of the Zenodo community associated to the Research community/Research infrastructure")
private String zenodo_community; private String zenodo_community;
public String getZenodo_community() { public String getZenodo_community() {
@ -57,12 +70,12 @@ public class ResearchInitiative implements Serializable {
this.name = label; this.name = label;
} }
public String getOriginalId() { public String getAcronym() {
return originalId; return acronym;
} }
public void setOriginalId(String originalId) { public void setAcronym(String acronym) {
this.originalId = originalId; this.acronym = acronym;
} }
public String getDescription() { public String getDescription() {

View File

@ -18,6 +18,7 @@ public class AccessRight extends Qualifier {
this.openAccessRoute = openAccessRoute; this.openAccessRoute = openAccessRoute;
} }
@Override
public String toComparableString() { public String toComparableString() {
String s = super.toComparableString(); String s = super.toComparableString();
return Optional return Optional

View File

@ -6,8 +6,15 @@ import java.util.List;
public class Datasource extends OafEntity implements Serializable { public class Datasource extends OafEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1019089598408414496L;
private Qualifier datasourcetype; private Qualifier datasourcetype;
private Qualifier datasourcetypeui;
private Qualifier openairecompatibility; private Qualifier openairecompatibility;
private Field<String> officialname; private Field<String> officialname;
@ -83,19 +90,45 @@ public class Datasource extends OafEntity implements Serializable {
private Journal journal; private Journal journal;
// New field for EOSC
private List<String> providedentitytypes;
// New field for EOSC
private List<String> providedproducttypes;
// New field for EOSC
private Qualifier jurisdiction;
// New field for EOSC
private Boolean thematic;
// New field for EOSC
private Boolean knowledgegraph;
// New field for EOSC
private List<Qualifier> contentpolicies;
public Qualifier getDatasourcetype() { public Qualifier getDatasourcetype() {
return datasourcetype; return datasourcetype;
} }
public void setDatasourcetype(Qualifier datasourcetype) { public void setDatasourcetype(final Qualifier datasourcetype) {
this.datasourcetype = datasourcetype; this.datasourcetype = datasourcetype;
} }
public Qualifier getDatasourcetypeui() {
return datasourcetypeui;
}
public void setDatasourcetypeui(final Qualifier datasourcetypeui) {
this.datasourcetypeui = datasourcetypeui;
}
public Qualifier getOpenairecompatibility() { public Qualifier getOpenairecompatibility() {
return openairecompatibility; return openairecompatibility;
} }
public void setOpenairecompatibility(Qualifier openairecompatibility) { public void setOpenairecompatibility(final Qualifier openairecompatibility) {
this.openairecompatibility = openairecompatibility; this.openairecompatibility = openairecompatibility;
} }
@ -103,7 +136,7 @@ public class Datasource extends OafEntity implements Serializable {
return officialname; return officialname;
} }
public void setOfficialname(Field<String> officialname) { public void setOfficialname(final Field<String> officialname) {
this.officialname = officialname; this.officialname = officialname;
} }
@ -111,7 +144,7 @@ public class Datasource extends OafEntity implements Serializable {
return englishname; return englishname;
} }
public void setEnglishname(Field<String> englishname) { public void setEnglishname(final Field<String> englishname) {
this.englishname = englishname; this.englishname = englishname;
} }
@ -119,7 +152,7 @@ public class Datasource extends OafEntity implements Serializable {
return websiteurl; return websiteurl;
} }
public void setWebsiteurl(Field<String> websiteurl) { public void setWebsiteurl(final Field<String> websiteurl) {
this.websiteurl = websiteurl; this.websiteurl = websiteurl;
} }
@ -127,7 +160,7 @@ public class Datasource extends OafEntity implements Serializable {
return logourl; return logourl;
} }
public void setLogourl(Field<String> logourl) { public void setLogourl(final Field<String> logourl) {
this.logourl = logourl; this.logourl = logourl;
} }
@ -135,7 +168,7 @@ public class Datasource extends OafEntity implements Serializable {
return contactemail; return contactemail;
} }
public void setContactemail(Field<String> contactemail) { public void setContactemail(final Field<String> contactemail) {
this.contactemail = contactemail; this.contactemail = contactemail;
} }
@ -143,7 +176,7 @@ public class Datasource extends OafEntity implements Serializable {
return namespaceprefix; return namespaceprefix;
} }
public void setNamespaceprefix(Field<String> namespaceprefix) { public void setNamespaceprefix(final Field<String> namespaceprefix) {
this.namespaceprefix = namespaceprefix; this.namespaceprefix = namespaceprefix;
} }
@ -151,7 +184,7 @@ public class Datasource extends OafEntity implements Serializable {
return latitude; return latitude;
} }
public void setLatitude(Field<String> latitude) { public void setLatitude(final Field<String> latitude) {
this.latitude = latitude; this.latitude = latitude;
} }
@ -159,7 +192,7 @@ public class Datasource extends OafEntity implements Serializable {
return longitude; return longitude;
} }
public void setLongitude(Field<String> longitude) { public void setLongitude(final Field<String> longitude) {
this.longitude = longitude; this.longitude = longitude;
} }
@ -167,7 +200,7 @@ public class Datasource extends OafEntity implements Serializable {
return dateofvalidation; return dateofvalidation;
} }
public void setDateofvalidation(Field<String> dateofvalidation) { public void setDateofvalidation(final Field<String> dateofvalidation) {
this.dateofvalidation = dateofvalidation; this.dateofvalidation = dateofvalidation;
} }
@ -175,7 +208,7 @@ public class Datasource extends OafEntity implements Serializable {
return description; return description;
} }
public void setDescription(Field<String> description) { public void setDescription(final Field<String> description) {
this.description = description; this.description = description;
} }
@ -183,7 +216,7 @@ public class Datasource extends OafEntity implements Serializable {
return subjects; return subjects;
} }
public void setSubjects(List<StructuredProperty> subjects) { public void setSubjects(final List<StructuredProperty> subjects) {
this.subjects = subjects; this.subjects = subjects;
} }
@ -191,7 +224,7 @@ public class Datasource extends OafEntity implements Serializable {
return odnumberofitems; return odnumberofitems;
} }
public void setOdnumberofitems(Field<String> odnumberofitems) { public void setOdnumberofitems(final Field<String> odnumberofitems) {
this.odnumberofitems = odnumberofitems; this.odnumberofitems = odnumberofitems;
} }
@ -199,7 +232,7 @@ public class Datasource extends OafEntity implements Serializable {
return odnumberofitemsdate; return odnumberofitemsdate;
} }
public void setOdnumberofitemsdate(Field<String> odnumberofitemsdate) { public void setOdnumberofitemsdate(final Field<String> odnumberofitemsdate) {
this.odnumberofitemsdate = odnumberofitemsdate; this.odnumberofitemsdate = odnumberofitemsdate;
} }
@ -207,7 +240,7 @@ public class Datasource extends OafEntity implements Serializable {
return odpolicies; return odpolicies;
} }
public void setOdpolicies(Field<String> odpolicies) { public void setOdpolicies(final Field<String> odpolicies) {
this.odpolicies = odpolicies; this.odpolicies = odpolicies;
} }
@ -215,7 +248,7 @@ public class Datasource extends OafEntity implements Serializable {
return odlanguages; return odlanguages;
} }
public void setOdlanguages(List<Field<String>> odlanguages) { public void setOdlanguages(final List<Field<String>> odlanguages) {
this.odlanguages = odlanguages; this.odlanguages = odlanguages;
} }
@ -223,7 +256,7 @@ public class Datasource extends OafEntity implements Serializable {
return odcontenttypes; return odcontenttypes;
} }
public void setOdcontenttypes(List<Field<String>> odcontenttypes) { public void setOdcontenttypes(final List<Field<String>> odcontenttypes) {
this.odcontenttypes = odcontenttypes; this.odcontenttypes = odcontenttypes;
} }
@ -231,7 +264,7 @@ public class Datasource extends OafEntity implements Serializable {
return accessinfopackage; return accessinfopackage;
} }
public void setAccessinfopackage(List<Field<String>> accessinfopackage) { public void setAccessinfopackage(final List<Field<String>> accessinfopackage) {
this.accessinfopackage = accessinfopackage; this.accessinfopackage = accessinfopackage;
} }
@ -239,7 +272,7 @@ public class Datasource extends OafEntity implements Serializable {
return releasestartdate; return releasestartdate;
} }
public void setReleasestartdate(Field<String> releasestartdate) { public void setReleasestartdate(final Field<String> releasestartdate) {
this.releasestartdate = releasestartdate; this.releasestartdate = releasestartdate;
} }
@ -247,7 +280,7 @@ public class Datasource extends OafEntity implements Serializable {
return releaseenddate; return releaseenddate;
} }
public void setReleaseenddate(Field<String> releaseenddate) { public void setReleaseenddate(final Field<String> releaseenddate) {
this.releaseenddate = releaseenddate; this.releaseenddate = releaseenddate;
} }
@ -255,7 +288,7 @@ public class Datasource extends OafEntity implements Serializable {
return missionstatementurl; return missionstatementurl;
} }
public void setMissionstatementurl(Field<String> missionstatementurl) { public void setMissionstatementurl(final Field<String> missionstatementurl) {
this.missionstatementurl = missionstatementurl; this.missionstatementurl = missionstatementurl;
} }
@ -263,7 +296,7 @@ public class Datasource extends OafEntity implements Serializable {
return dataprovider; return dataprovider;
} }
public void setDataprovider(Field<Boolean> dataprovider) { public void setDataprovider(final Field<Boolean> dataprovider) {
this.dataprovider = dataprovider; this.dataprovider = dataprovider;
} }
@ -271,7 +304,7 @@ public class Datasource extends OafEntity implements Serializable {
return serviceprovider; return serviceprovider;
} }
public void setServiceprovider(Field<Boolean> serviceprovider) { public void setServiceprovider(final Field<Boolean> serviceprovider) {
this.serviceprovider = serviceprovider; this.serviceprovider = serviceprovider;
} }
@ -279,7 +312,7 @@ public class Datasource extends OafEntity implements Serializable {
return databaseaccesstype; return databaseaccesstype;
} }
public void setDatabaseaccesstype(Field<String> databaseaccesstype) { public void setDatabaseaccesstype(final Field<String> databaseaccesstype) {
this.databaseaccesstype = databaseaccesstype; this.databaseaccesstype = databaseaccesstype;
} }
@ -287,7 +320,7 @@ public class Datasource extends OafEntity implements Serializable {
return datauploadtype; return datauploadtype;
} }
public void setDatauploadtype(Field<String> datauploadtype) { public void setDatauploadtype(final Field<String> datauploadtype) {
this.datauploadtype = datauploadtype; this.datauploadtype = datauploadtype;
} }
@ -295,7 +328,7 @@ public class Datasource extends OafEntity implements Serializable {
return databaseaccessrestriction; return databaseaccessrestriction;
} }
public void setDatabaseaccessrestriction(Field<String> databaseaccessrestriction) { public void setDatabaseaccessrestriction(final Field<String> databaseaccessrestriction) {
this.databaseaccessrestriction = databaseaccessrestriction; this.databaseaccessrestriction = databaseaccessrestriction;
} }
@ -303,7 +336,7 @@ public class Datasource extends OafEntity implements Serializable {
return datauploadrestriction; return datauploadrestriction;
} }
public void setDatauploadrestriction(Field<String> datauploadrestriction) { public void setDatauploadrestriction(final Field<String> datauploadrestriction) {
this.datauploadrestriction = datauploadrestriction; this.datauploadrestriction = datauploadrestriction;
} }
@ -311,7 +344,7 @@ public class Datasource extends OafEntity implements Serializable {
return versioning; return versioning;
} }
public void setVersioning(Field<Boolean> versioning) { public void setVersioning(final Field<Boolean> versioning) {
this.versioning = versioning; this.versioning = versioning;
} }
@ -319,7 +352,7 @@ public class Datasource extends OafEntity implements Serializable {
return citationguidelineurl; return citationguidelineurl;
} }
public void setCitationguidelineurl(Field<String> citationguidelineurl) { public void setCitationguidelineurl(final Field<String> citationguidelineurl) {
this.citationguidelineurl = citationguidelineurl; this.citationguidelineurl = citationguidelineurl;
} }
@ -327,7 +360,7 @@ public class Datasource extends OafEntity implements Serializable {
return qualitymanagementkind; return qualitymanagementkind;
} }
public void setQualitymanagementkind(Field<String> qualitymanagementkind) { public void setQualitymanagementkind(final Field<String> qualitymanagementkind) {
this.qualitymanagementkind = qualitymanagementkind; this.qualitymanagementkind = qualitymanagementkind;
} }
@ -335,7 +368,7 @@ public class Datasource extends OafEntity implements Serializable {
return pidsystems; return pidsystems;
} }
public void setPidsystems(Field<String> pidsystems) { public void setPidsystems(final Field<String> pidsystems) {
this.pidsystems = pidsystems; this.pidsystems = pidsystems;
} }
@ -343,7 +376,7 @@ public class Datasource extends OafEntity implements Serializable {
return certificates; return certificates;
} }
public void setCertificates(Field<String> certificates) { public void setCertificates(final Field<String> certificates) {
this.certificates = certificates; this.certificates = certificates;
} }
@ -351,7 +384,7 @@ public class Datasource extends OafEntity implements Serializable {
return policies; return policies;
} }
public void setPolicies(List<KeyValue> policies) { public void setPolicies(final List<KeyValue> policies) {
this.policies = policies; this.policies = policies;
} }
@ -359,23 +392,72 @@ public class Datasource extends OafEntity implements Serializable {
return journal; return journal;
} }
public void setJournal(Journal journal) { public void setJournal(final Journal journal) {
this.journal = journal; this.journal = journal;
} }
public List<String> getProvidedentitytypes() {
return providedentitytypes;
}
public void setProvidedentitytypes(final List<String> providedentitytypes) {
this.providedentitytypes = providedentitytypes;
}
public List<String> getProvidedproducttypes() {
return providedproducttypes;
}
public void setProvidedproducttypes(final List<String> providedproducttypes) {
this.providedproducttypes = providedproducttypes;
}
public Qualifier getJurisdiction() {
return jurisdiction;
}
public void setJurisdiction(final Qualifier jurisdiction) {
this.jurisdiction = jurisdiction;
}
public Boolean getThematic() {
return thematic;
}
public void setThematic(final Boolean thematic) {
this.thematic = thematic;
}
public Boolean getKnowledgegraph() {
return knowledgegraph;
}
public void setKnowledgegraph(final Boolean knowledgegraph) {
this.knowledgegraph = knowledgegraph;
}
public List<Qualifier> getContentpolicies() {
return contentpolicies;
}
public void setContentpolicies(final List<Qualifier> contentpolicies) {
this.contentpolicies = contentpolicies;
}
@Override @Override
public void mergeFrom(OafEntity e) { public void mergeFrom(final OafEntity e) {
super.mergeFrom(e); super.mergeFrom(e);
if (!Datasource.class.isAssignableFrom(e.getClass())) { if (!Datasource.class.isAssignableFrom(e.getClass())) { return; }
return;
}
Datasource d = (Datasource) e; final Datasource d = (Datasource) e;
datasourcetype = d.getDatasourcetype() != null && compareTrust(this, e) < 0 datasourcetype = d.getDatasourcetype() != null && compareTrust(this, e) < 0
? d.getDatasourcetype() ? d.getDatasourcetype()
: datasourcetype; : datasourcetype;
datasourcetypeui = d.getDatasourcetypeui() != null && compareTrust(this, e) < 0
? d.getDatasourcetypeui()
: datasourcetypeui;
openairecompatibility = d.getOpenairecompatibility() != null && compareTrust(this, e) < 0 openairecompatibility = d.getOpenairecompatibility() != null && compareTrust(this, e) < 0
? d.getOpenairecompatibility() ? d.getOpenairecompatibility()
: openairecompatibility; : openairecompatibility;
@ -467,6 +549,25 @@ public class Datasource extends OafEntity implements Serializable {
journal = d.getJournal() != null && compareTrust(this, e) < 0 ? d.getJournal() : journal; journal = d.getJournal() != null && compareTrust(this, e) < 0 ? d.getJournal() : journal;
providedentitytypes = mergeLists(providedentitytypes, d.getProvidedentitytypes());;
providedproducttypes = mergeLists(providedproducttypes, d.getProvidedproducttypes());;
jurisdiction = d.getJurisdiction() != null && compareTrust(this, e) < 0
? d.getJurisdiction()
: jurisdiction;
thematic = d.getThematic() != null && compareTrust(this, e) < 0
? d.getThematic()
: thematic;
knowledgegraph = d.getKnowledgegraph() != null && compareTrust(this, e) < 0
? d.getKnowledgegraph()
: knowledgegraph;
contentpolicies = mergeLists(contentpolicies, d.getContentpolicies());;
mergeOAFDataInfo(e); mergeOAFDataInfo(e);
} }
} }

View File

@ -37,6 +37,8 @@ public class Instance implements Serializable {
private Qualifier refereed; // peer-review status private Qualifier refereed; // peer-review status
private List<Measure> measures;
public Field<String> getLicense() { public Field<String> getLicense() {
return license; return license;
} }
@ -141,6 +143,14 @@ public class Instance implements Serializable {
this.refereed = refereed; this.refereed = refereed;
} }
public List<Measure> getMeasures() {
return measures;
}
public void setMeasures(List<Measure> measures) {
this.measures = measures;
}
public String toComparableString() { public String toComparableString() {
return String return String
.format( .format(

View File

@ -1,6 +1,7 @@
package eu.dnetlib.dhp.schema.oaf; package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List; import java.util.List;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -8,7 +9,7 @@ import com.google.common.base.Objects;
/** /**
* Represent a measure, must be further described by a system available resource providing name and descriptions. * Represent a measure, must be further described by a system available resource providing name and descriptions.
*/ */
public class Measure { public class Measure implements Serializable {
/** /**
* Unique measure identifier. * Unique measure identifier.
@ -16,7 +17,7 @@ public class Measure {
private String id; private String id;
/** /**
* List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value, plus * List of units associated with this measure. KeyValue provides a pair to store the label (key) and the value, plus
* common provenance information. * common provenance information.
*/ */
private List<KeyValue> unit; private List<KeyValue> unit;

View File

@ -96,7 +96,8 @@ public abstract class OafEntity extends Oaf implements Serializable {
oaiprovenance = e.getOaiprovenance(); oaiprovenance = e.getOaiprovenance();
} }
protected <T> List<T> mergeLists(final List<T>... lists) { @SafeVarargs
protected final <T> List<T> mergeLists(final List<T>... lists) {
return Arrays return Arrays
.stream(lists) .stream(lists)

View File

@ -1,11 +1,11 @@
package eu.dnetlib.dhp.schema.oaf; package eu.dnetlib.dhp.schema.oaf;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
public class Project extends OafEntity implements Serializable { public class Project extends OafEntity implements Serializable {
private Field<String> websiteurl; private Field<String> websiteurl;
@ -348,10 +348,6 @@ public class Project extends OafEntity implements Serializable {
: contactemail; : contactemail;
summary = p.getSummary() != null && compareTrust(this, e) < 0 ? p.getSummary() : summary; summary = p.getSummary() != null && compareTrust(this, e) < 0 ? p.getSummary() : summary;
currency = p.getCurrency() != null && compareTrust(this, e) < 0 ? p.getCurrency() : currency; currency = p.getCurrency() != null && compareTrust(this, e) < 0 ? p.getCurrency() : currency;
// totalcost = p.getTotalcost() != null && compareTrust(this, e) < 0 ? p.getTotalcost() : totalcost;
// fundedamount = p.getFundedamount() != null && compareTrust(this, e) < 0
// ? p.getFundedamount()
// : fundedamount;
if (p.getH2020topiccode() != null && StringUtils.isEmpty(h2020topiccode)){ if (p.getH2020topiccode() != null && StringUtils.isEmpty(h2020topiccode)){
h2020topiccode = p.getH2020topiccode(); h2020topiccode = p.getH2020topiccode();

View File

@ -4,9 +4,9 @@ package eu.dnetlib.dhp.schema.oaf;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.ArrayList;
import java.util.stream.Collectors; import java.util.List;
import java.util.stream.Stream; import java.util.Objects;
import eu.dnetlib.dhp.schema.common.ModelSupport; import eu.dnetlib.dhp.schema.common.ModelSupport;

View File

@ -2,237 +2,707 @@
package eu.dnetlib.dhp.schema.oaf; package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable; import java.io.Serializable;
import java.util.Comparator; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.common.AccessRightComparator; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
import eu.dnetlib.dhp.schema.common.ModelConstants;
import eu.dnetlib.dhp.schema.oaf.utils.CleaningFunctions;
/**
* The type Result.
*/
public class Result extends OafEntity implements Serializable { public class Result extends OafEntity implements Serializable {
/**
* The Measures.
*/
private List<Measure> measures; private List<Measure> measures;
/**
* The Author.
*/
private List<Author> author; private List<Author> author;
// resulttype allows subclassing results into publications | datasets | software /**
* The Resulttype.
*/
// resulttype allows subclassing results into publications | datasets | software
private Qualifier resulttype; private Qualifier resulttype;
// common fields /**
* The Language.
*/
// common fields
private Qualifier language; private Qualifier language;
/**
* The Country.
*/
private List<Country> country; private List<Country> country;
/**
* The Subject.
*/
private List<StructuredProperty> subject; private List<StructuredProperty> subject;
/**
* The Title.
*/
private List<StructuredProperty> title; private List<StructuredProperty> title;
/**
* The Relevantdate.
*/
private List<StructuredProperty> relevantdate; private List<StructuredProperty> relevantdate;
/**
* The Description.
*/
private List<Field<String>> description; private List<Field<String>> description;
/**
* The Dateofacceptance.
*/
private Field<String> dateofacceptance; private Field<String> dateofacceptance;
/**
* The Publisher.
*/
private Field<String> publisher; private Field<String> publisher;
/**
* The Embargoenddate.
*/
private Field<String> embargoenddate; private Field<String> embargoenddate;
/**
* The Source.
*/
private List<Field<String>> source; private List<Field<String>> source;
/**
* The Fulltext.
*/
private List<Field<String>> fulltext; // remove candidate private List<Field<String>> fulltext; // remove candidate
/**
* The Format.
*/
private List<Field<String>> format; private List<Field<String>> format;
/**
* The Contributor.
*/
private List<Field<String>> contributor; private List<Field<String>> contributor;
/**
* The Resourcetype.
*/
private Qualifier resourcetype; private Qualifier resourcetype;
/**
* The Coverage.
*/
private List<Field<String>> coverage; private List<Field<String>> coverage;
/**
* The Bestaccessright.
*/
private Qualifier bestaccessright; private Qualifier bestaccessright;
/**
* The Context.
*/
private List<Context> context; private List<Context> context;
/**
* The External reference.
*/
private List<ExternalReference> externalReference; private List<ExternalReference> externalReference;
/**
* The Instance.
*/
private List<Instance> instance; private List<Instance> instance;
/**
* Gets measures.
*
* @return the measures
*/
public List<Measure> getMeasures() { public List<Measure> getMeasures() {
return measures; return measures;
} }
/**
* Sets measures.
*
* @param measures the measures
*/
public void setMeasures(List<Measure> measures) { public void setMeasures(List<Measure> measures) {
this.measures = measures; this.measures = measures;
} }
/**
* Gets author.
*
* @return the author
*/
public List<Author> getAuthor() { public List<Author> getAuthor() {
return author; return author;
} }
/**
* Sets author.
*
* @param author the author
*/
public void setAuthor(List<Author> author) { public void setAuthor(List<Author> author) {
this.author = author; this.author = author;
} }
/**
* Gets resulttype.
*
* @return the resulttype
*/
public Qualifier getResulttype() { public Qualifier getResulttype() {
return resulttype; return resulttype;
} }
/**
* Sets resulttype.
*
* @param resulttype the resulttype
*/
public void setResulttype(Qualifier resulttype) { public void setResulttype(Qualifier resulttype) {
this.resulttype = resulttype; this.resulttype = resulttype;
} }
/**
* Gets language.
*
* @return the language
*/
public Qualifier getLanguage() { public Qualifier getLanguage() {
return language; return language;
} }
/**
* Sets language.
*
* @param language the language
*/
public void setLanguage(Qualifier language) { public void setLanguage(Qualifier language) {
this.language = language; this.language = language;
} }
/**
* Gets country.
*
* @return the country
*/
public List<Country> getCountry() { public List<Country> getCountry() {
return country; return country;
} }
/**
* Sets country.
*
* @param country the country
*/
public void setCountry(List<Country> country) { public void setCountry(List<Country> country) {
this.country = country; this.country = country;
} }
/**
* Gets subject.
*
* @return the subject
*/
public List<StructuredProperty> getSubject() { public List<StructuredProperty> getSubject() {
return subject; return subject;
} }
/**
* Sets subject.
*
* @param subject the subject
*/
public void setSubject(List<StructuredProperty> subject) { public void setSubject(List<StructuredProperty> subject) {
this.subject = subject; this.subject = subject;
} }
/**
* Gets title.
*
* @return the title
*/
public List<StructuredProperty> getTitle() { public List<StructuredProperty> getTitle() {
return title; return title;
} }
/**
* Sets title.
*
* @param title the title
*/
public void setTitle(List<StructuredProperty> title) { public void setTitle(List<StructuredProperty> title) {
this.title = title; this.title = title;
} }
/**
* Gets relevantdate.
*
* @return the relevantdate
*/
public List<StructuredProperty> getRelevantdate() { public List<StructuredProperty> getRelevantdate() {
return relevantdate; return relevantdate;
} }
/**
* Sets relevantdate.
*
* @param relevantdate the relevantdate
*/
public void setRelevantdate(List<StructuredProperty> relevantdate) { public void setRelevantdate(List<StructuredProperty> relevantdate) {
this.relevantdate = relevantdate; this.relevantdate = relevantdate;
} }
/**
* Gets description.
*
* @return the description
*/
public List<Field<String>> getDescription() { public List<Field<String>> getDescription() {
return description; return description;
} }
/**
* Sets description.
*
* @param description the description
*/
public void setDescription(List<Field<String>> description) { public void setDescription(List<Field<String>> description) {
this.description = description; this.description = description;
} }
/**
* Gets dateofacceptance.
*
* @return the dateofacceptance
*/
public Field<String> getDateofacceptance() { public Field<String> getDateofacceptance() {
return dateofacceptance; return dateofacceptance;
} }
/**
* Sets dateofacceptance.
*
* @param dateofacceptance the dateofacceptance
*/
public void setDateofacceptance(Field<String> dateofacceptance) { public void setDateofacceptance(Field<String> dateofacceptance) {
this.dateofacceptance = dateofacceptance; this.dateofacceptance = dateofacceptance;
} }
/**
* Gets publisher.
*
* @return the publisher
*/
public Field<String> getPublisher() { public Field<String> getPublisher() {
return publisher; return publisher;
} }
/**
* Sets publisher.
*
* @param publisher the publisher
*/
public void setPublisher(Field<String> publisher) { public void setPublisher(Field<String> publisher) {
this.publisher = publisher; this.publisher = publisher;
} }
/**
* Gets embargoenddate.
*
* @return the embargoenddate
*/
public Field<String> getEmbargoenddate() { public Field<String> getEmbargoenddate() {
return embargoenddate; return embargoenddate;
} }
/**
* Sets embargoenddate.
*
* @param embargoenddate the embargoenddate
*/
public void setEmbargoenddate(Field<String> embargoenddate) { public void setEmbargoenddate(Field<String> embargoenddate) {
this.embargoenddate = embargoenddate; this.embargoenddate = embargoenddate;
} }
/**
* Gets source.
*
* @return the source
*/
public List<Field<String>> getSource() { public List<Field<String>> getSource() {
return source; return source;
} }
/**
* Sets source.
*
* @param source the source
*/
public void setSource(List<Field<String>> source) { public void setSource(List<Field<String>> source) {
this.source = source; this.source = source;
} }
/**
* Gets fulltext.
*
* @return the fulltext
*/
public List<Field<String>> getFulltext() { public List<Field<String>> getFulltext() {
return fulltext; return fulltext;
} }
/**
* Sets fulltext.
*
* @param fulltext the fulltext
*/
public void setFulltext(List<Field<String>> fulltext) { public void setFulltext(List<Field<String>> fulltext) {
this.fulltext = fulltext; this.fulltext = fulltext;
} }
/**
* Gets format.
*
* @return the format
*/
public List<Field<String>> getFormat() { public List<Field<String>> getFormat() {
return format; return format;
} }
/**
* Sets format.
*
* @param format the format
*/
public void setFormat(List<Field<String>> format) { public void setFormat(List<Field<String>> format) {
this.format = format; this.format = format;
} }
/**
* Gets contributor.
*
* @return the contributor
*/
public List<Field<String>> getContributor() { public List<Field<String>> getContributor() {
return contributor; return contributor;
} }
/**
* Sets contributor.
*
* @param contributor the contributor
*/
public void setContributor(List<Field<String>> contributor) { public void setContributor(List<Field<String>> contributor) {
this.contributor = contributor; this.contributor = contributor;
} }
/**
* Gets resourcetype.
*
* @return the resourcetype
*/
public Qualifier getResourcetype() { public Qualifier getResourcetype() {
return resourcetype; return resourcetype;
} }
/**
* Sets resourcetype.
*
* @param resourcetype the resourcetype
*/
public void setResourcetype(Qualifier resourcetype) { public void setResourcetype(Qualifier resourcetype) {
this.resourcetype = resourcetype; this.resourcetype = resourcetype;
} }
/**
* Gets coverage.
*
* @return the coverage
*/
public List<Field<String>> getCoverage() { public List<Field<String>> getCoverage() {
return coverage; return coverage;
} }
/**
* Sets coverage.
*
* @param coverage the coverage
*/
public void setCoverage(List<Field<String>> coverage) { public void setCoverage(List<Field<String>> coverage) {
this.coverage = coverage; this.coverage = coverage;
} }
/**
* Gets bestaccessright.
*
* @return the bestaccessright
*/
public Qualifier getBestaccessright() { public Qualifier getBestaccessright() {
return bestaccessright; return bestaccessright;
} }
/**
* Sets bestaccessright.
*
* @param bestaccessright the bestaccessright
*/
public void setBestaccessright(Qualifier bestaccessright) { public void setBestaccessright(Qualifier bestaccessright) {
this.bestaccessright = bestaccessright; this.bestaccessright = bestaccessright;
} }
/**
* Gets context.
*
* @return the context
*/
public List<Context> getContext() { public List<Context> getContext() {
return context; return context;
} }
/**
* Sets context.
*
* @param context the context
*/
public void setContext(List<Context> context) { public void setContext(List<Context> context) {
this.context = context; this.context = context;
} }
/**
* Gets external reference.
*
* @return the external reference
*/
public List<ExternalReference> getExternalReference() { public List<ExternalReference> getExternalReference() {
return externalReference; return externalReference;
} }
/**
* Sets external reference.
*
* @param externalReference the external reference
*/
public void setExternalReference(List<ExternalReference> externalReference) { public void setExternalReference(List<ExternalReference> externalReference) {
this.externalReference = externalReference; this.externalReference = externalReference;
} }
/**
* Gets instance.
*
* @return the instance
*/
public List<Instance> getInstance() { public List<Instance> getInstance() {
return instance; return instance;
} }
/**
* Sets instance.
*
* @param instance the instance
*/
public void setInstance(List<Instance> instance) { public void setInstance(List<Instance> instance) {
this.instance = instance; this.instance = instance;
} }
/**
* Is an enrichment boolean.
*
* @param e the e
* @return the boolean
*/
public static boolean isAnEnrichment(OafEntity e) {
return e.getDataInfo()!= null &&
e.getDataInfo().getProvenanceaction()!= null
&& ModelConstants.PROVENANCE_ENRICH.equalsIgnoreCase(e.getDataInfo().getProvenanceaction().getClassid());
}
/**
* Normalize pid string.
*
* @param pid the pid
* @return the string
*/
private static String extractKeyFromPid(final StructuredProperty pid) {
if (pid == null)
return null;
final StructuredProperty normalizedPid = CleaningFunctions.normalizePidValue(pid);
return String.format("%s::%s", normalizedPid.getQualifier().getClassid(), normalizedPid.getValue());
}
/**
* Valid pid boolean.
*
* @param p the p
* @return the boolean
*/
private static boolean validPid(final StructuredProperty p) {
return p.getValue()!= null && p.getQualifier()!= null && p.getQualifier().getClassid()!=null;
}
/**
* This method converts the list of instance enrichments
* into a Map where the key is the normalized identifier
* and the value is the instance itself
*
* @param ri the list of enrichment instances
* @return the result map
*/
public static Map<String, Instance> toInstanceMap(final List<Instance> ri) {
return ri
.stream()
.filter(i -> i.getPid() != null || i.getAlternateIdentifier() != null)
.flatMap(i -> {
final List<Pair<String, Instance>> result = new ArrayList<>();
if (i.getPid() != null)
i.getPid().stream().filter(Result::validPid).forEach(p -> result.add(new ImmutablePair<>(extractKeyFromPid(p), i)));
if (i.getAlternateIdentifier() != null)
i.getAlternateIdentifier().stream().filter(Result::validPid).forEach(p -> result.add(new ImmutablePair<>(extractKeyFromPid(p), i)));
return result.stream();
}).collect(Collectors.toMap(
Pair::getLeft,
Pair::getRight,
(a, b) -> a
));
}
/**
* This utility method finds the list of enrichment instances
* that match one or more PIDs in the input list
*
* @param pids the list of PIDs
* @param enrichments the List of enrichment instances having the same pid
* @return the list
*/
private static List<Instance> findEnrichmentsByPID(final List<StructuredProperty> pids, final Map<String,Instance> enrichments) {
if (pids == null || enrichments == null)
return null;
return pids
.stream()
.map(Result::extractKeyFromPid)
.map(enrichments::get)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
/**
* This method apply enrichment on a single instance
* The enrichment consists of replacing values on
* single attribute only if in the current instance is missing
* The only repeatable field enriched is measures
*
* @param currentInstance the current instance
* @param enrichment the enrichment instance
*/
private static void applyEnrichment(final Instance currentInstance, final Instance enrichment) {
if (currentInstance == null || enrichment == null)
return;
//ENRICH accessright
if (enrichment.getAccessright()!=null && currentInstance.getAccessright() == null)
currentInstance.setAccessright(enrichment.getAccessright());
//ENRICH license
if (enrichment.getLicense()!=null && currentInstance.getLicense() == null)
currentInstance.setLicense(enrichment.getLicense());
//ENRICH instanceType
if (enrichment.getInstancetype()!=null && currentInstance.getInstancetype() == null)
currentInstance.setInstancetype(enrichment.getInstancetype());
//ENRICH hostedby
if (enrichment.getHostedby()!=null && currentInstance.getHostedby() == null)
currentInstance.setHostedby(enrichment.getHostedby());
//ENRICH distributionlocation
if (enrichment.getDistributionlocation()!=null && currentInstance.getDistributionlocation() == null)
currentInstance.setDistributionlocation(enrichment.getDistributionlocation());
//ENRICH collectedfrom
if (enrichment.getCollectedfrom()!=null && currentInstance.getCollectedfrom() == null)
currentInstance.setCollectedfrom(enrichment.getCollectedfrom());
//ENRICH dateofacceptance
if (enrichment.getDateofacceptance()!=null && currentInstance.getDateofacceptance() == null)
currentInstance.setDateofacceptance(enrichment.getDateofacceptance());
//ENRICH processingchargeamount
if (enrichment.getProcessingchargeamount()!=null && currentInstance.getProcessingchargeamount() == null)
currentInstance.setProcessingchargeamount(enrichment.getProcessingchargeamount());
//ENRICH refereed
if (enrichment.getRefereed()!=null && currentInstance.getRefereed() == null)
currentInstance.setRefereed(enrichment.getRefereed());
//ENRICH measures
if (enrichment.getMeasures()!=null)
if (currentInstance.getMeasures() == null)
currentInstance.setMeasures(enrichment.getMeasures());
else
enrichment.getMeasures().forEach(currentInstance.getMeasures()::add);
}
/**
* This main method apply the enrichment of the instances
*
* @param toEnrichInstances the instances that could be enriched
* @param enrichmentInstances the enrichment instances
* @return list of instances possibly enriched
*/
private static List<Instance> enrichInstances(final List<Instance> toEnrichInstances,final List<Instance> enrichmentInstances) {
final List<Instance> enrichmentResult = new ArrayList<>();
if (toEnrichInstances == null) {
return enrichmentResult;
}
if (enrichmentInstances == null) {
return enrichmentResult;
}
Map<String, Instance> ri = toInstanceMap(enrichmentInstances);
toEnrichInstances.forEach(i -> {
final List<Instance> e = findEnrichmentsByPID(i.getPid(), ri);
if (e!= null && e.size()> 0) {
e.forEach(enr -> applyEnrichment(i, enr));
} else {
final List<Instance> a = findEnrichmentsByPID(i.getAlternateIdentifier(), ri);
if (a!= null && a.size()> 0) {
a.forEach(enr -> applyEnrichment(i, enr));
}
}
enrichmentResult.add(i);
});
return enrichmentResult;
}
@Override @Override
public void mergeFrom(OafEntity e) { public void mergeFrom(OafEntity e) {
super.mergeFrom(e); super.mergeFrom(e);
@ -245,7 +715,15 @@ public class Result extends OafEntity implements Serializable {
measures = mergeLists(measures, r.getMeasures()); measures = mergeLists(measures, r.getMeasures());
instance = mergeLists(instance, r.getInstance()); if( !isAnEnrichment(this) && !isAnEnrichment(e))
instance = mergeLists(instance, r.getInstance());
else {
final List<Instance> enrichmentInstances = isAnEnrichment(this) ? instance : r.getInstance();
final List<Instance> enrichedInstances= isAnEnrichment(this) ? r.getInstance(): instance;
if (isAnEnrichment(this))
setDataInfo(e.getDataInfo());
instance = enrichInstances(enrichedInstances,enrichmentInstances);
}
if (r.getBestaccessright() != null if (r.getBestaccessright() != null
&& new AccessRightComparator().compare(r.getBestaccessright(), bestaccessright) < 0) && new AccessRightComparator().compare(r.getBestaccessright(), bestaccessright) < 0)
@ -325,6 +803,13 @@ public class Result extends OafEntity implements Serializable {
externalReference = mergeLists(externalReference, r.getExternalReference()); externalReference = mergeLists(externalReference, r.getExternalReference());
} }
/**
* Longest lists list.
*
* @param a the a
* @param b the b
* @return the list
*/
private List<Field<String>> longestLists(List<Field<String>> a, List<Field<String>> b) { private List<Field<String>> longestLists(List<Field<String>> a, List<Field<String>> b) {
if (a == null || b == null) if (a == null || b == null)
return a == null ? b : a; return a == null ? b : a;
@ -346,13 +831,19 @@ public class Result extends OafEntity implements Serializable {
return a.size() > b.size() ? a : b; return a.size() > b.size() ? a : b;
} }
/**
* Gets main title.
*
* @param titles the titles
* @return the main title
*/
private StructuredProperty getMainTitle(List<StructuredProperty> titles) { private StructuredProperty getMainTitle(List<StructuredProperty> titles) {
// need to check if the list of titles contains more than 1 main title? (in that case, we should chose which // need to check if the list of titles contains more than 1 main title? (in that case, we should chose which
// main title select in the list) // main title select in the list)
for (StructuredProperty title : titles) { for (StructuredProperty t : titles) {
if (title.getQualifier() != null && title.getQualifier().getClassid() != null) if (t.getQualifier() != null && t.getQualifier().getClassid() != null)
if (title.getQualifier().getClassid().equals("main title")) if (t.getQualifier().getClassid().equals("main title"))
return title; return t;
} }
return null; return null;
} }

View File

@ -8,8 +8,6 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Joiner;
public class StructuredProperty implements Serializable { public class StructuredProperty implements Serializable {
private String value; private String value;

View File

@ -12,7 +12,7 @@ import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
public class CleaningFunctions { public class CleaningFunctions {
public static final String DOI_PREFIX_REGEX = "(^10\\.|\\/10.)"; public static final String DOI_PREFIX_REGEX = "(^10\\.|\\/10\\.)";
public static final String DOI_PREFIX = "10."; public static final String DOI_PREFIX = "10.";
public static final Set<String> PID_BLACKLIST = new HashSet<>(); public static final Set<String> PID_BLACKLIST = new HashSet<>();
@ -22,6 +22,8 @@ public class CleaningFunctions {
PID_BLACKLIST.add("na"); PID_BLACKLIST.add("na");
} }
public CleaningFunctions() {}
/** /**
* Utility method that filter PID values on a per-type basis. * Utility method that filter PID values on a per-type basis.
* @param s the PID whose value will be checked. * @param s the PID whose value will be checked.

View File

@ -127,7 +127,7 @@ public class IdentifierFactory implements Serializable {
return pids return pids
.values() .values()
.stream() .stream()
.flatMap(s -> s.stream()) .flatMap(Set::stream)
.min(new PidComparator<>(entity)) .min(new PidComparator<>(entity))
.map( .map(
min -> Optional min -> Optional
@ -147,8 +147,7 @@ public class IdentifierFactory implements Serializable {
if (entity instanceof Result) { if (entity instanceof Result) {
return Optional return Optional
.ofNullable(((Result) entity).getInstance()) .ofNullable(((Result) entity).getInstance())
.map( .map(IdentifierFactory::mapPids)
instance -> mapPids(instance))
.orElse(new HashMap<>()); .orElse(new HashMap<>());
} else { } else {
return entity return entity
@ -254,7 +253,6 @@ public class IdentifierFactory implements Serializable {
md.update(s.getBytes(StandardCharsets.UTF_8)); md.update(s.getBytes(StandardCharsets.UTF_8));
return new String(Hex.encodeHex(md.digest())); return new String(Hex.encodeHex(md.digest()));
} catch (final Exception e) { } catch (final Exception e) {
System.err.println("Error creating id");
return null; return null;
} }
} }

View File

@ -3,6 +3,8 @@ package eu.dnetlib.dhp.schema.oaf.utils;
public class ModelHardLimits { public class ModelHardLimits {
private ModelHardLimits() {}
public static final String LAYOUT = "index"; public static final String LAYOUT = "index";
public static final String INTERPRETATION = "openaire"; public static final String INTERPRETATION = "openaire";
public static final String SEPARATOR = "-"; public static final String SEPARATOR = "-";

View File

@ -34,4 +34,6 @@ public class PidBlacklistProvider {
.orElse(new HashSet<>()); .orElse(new HashSet<>());
} }
private PidBlacklistProvider() {}
} }

View File

@ -9,6 +9,7 @@ import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.common.ModelConstants; import eu.dnetlib.dhp.schema.common.ModelConstants;
import eu.dnetlib.dhp.schema.oaf.KeyValue;
import eu.dnetlib.dhp.schema.oaf.Result; import eu.dnetlib.dhp.schema.oaf.Result;
public class ResultTypeComparator implements Comparator<Result> { public class ResultTypeComparator implements Comparator<Result> {
@ -69,7 +70,7 @@ public class ResultTypeComparator implements Comparator<Result> {
.map( .map(
cf -> cf cf -> cf
.stream() .stream()
.map(c -> c.getKey()) .map(KeyValue::getKey)
.collect(Collectors.toCollection(HashSet::new))) .collect(Collectors.toCollection(HashSet::new)))
.orElse(new HashSet<>()); .orElse(new HashSet<>());
} }

View File

@ -3,12 +3,9 @@ package eu.dnetlib.dhp.schema.orcid;
import java.io.Serializable; import java.io.Serializable;
import eu.dnetlib.dhp.schema.orcid.AuthorData;
/** /**
* This class models the data related to a contributor, that are retrieved from an orcid publication * This class models the data related to a contributor, that are retrieved from an orcid publication
*/ */
public class Contributor extends AuthorData implements Serializable { public class Contributor extends AuthorData implements Serializable {
private String sequence; private String sequence;
private String role; private String role;

View File

@ -4,11 +4,6 @@ package eu.dnetlib.dhp.schema.orcid;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import eu.dnetlib.dhp.schema.orcid.Contributor;
import eu.dnetlib.dhp.schema.orcid.ExternalId;
import eu.dnetlib.dhp.schema.orcid.OrcidData;
import eu.dnetlib.dhp.schema.orcid.PublicationDate;
/** /**
* This class models the data that are retrieved from orcid publication * This class models the data that are retrieved from orcid publication
*/ */

View File

@ -0,0 +1,35 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"acronym": {
"type": "string",
"description": "The acronym of the community"
},
"description": {
"type": "string",
"description": "Description of the research community/research infrastructure"
},
"id": {
"type": "string",
"description": "OpenAIRE id of the research community/research infrastructure"
},
"name": {
"type": "string",
"description": "The long name of the community"
},
"subject": {
"description": "Only for research communities: the list of the subjects associated to the research community",
"type": "array",
"items": {"type": "string"}
},
"type": {
"type": "string",
"description": "One of {Research Community, Research infrastructure}"
},
"zenodo_community": {
"type": "string",
"description": "The URL of the Zenodo community associated to the Research community/Research infrastructure"
}
}
}

View File

@ -0,0 +1,192 @@
{
"$schema":"http://json-schema.org/draft-07/schema#",
"definitions": {
"ControlledField": {
"type": "object",
"properties": {
"scheme": {
"type": "string"
},
"value": {
"type": "string"
}
},
"description": "To represent the information described by a scheme and a value in that scheme (i.e. pid)"
}
},
"type":"object",
"properties": {
"accessrights": {
"type": "string",
"description": "Type of access to the data source, as defined by re3data.org. Possible values: {open, restricted, closed}"
},
"certificates": {
"type": "string",
"description": "The certificate, seal or standard the data source complies with. As defined by re3data.org."
},
"citationguidelineurl": {
"type": "string",
"description":"The URL of the data source providing information on how to cite its items. As defined by re3data.org."
},
"contenttypes": {
"description": "Types of content in the data source, as defined by OpenDOAR",
"type": "array",
"items": {
"type": "string"
}
},
"databaseaccessrestriction": {
"type": "string",
"description": "Access restrinctions to the data source, as defined by re3data.org. One of {feeRequired, registration, other}"
},
"datasourcetype": {
"allOf": [
{
"$ref": "#/definitions/ControlledField"
},
{
"description": "The type of the datasource. See https://api.openaire.eu/vocabularies/dnet:datasource_typologies"
}
]
},
"datauploadrestriction": {
"type": "string",
"description": "Upload restrictions applied by the datasource, as defined by re3data.org. One of {feeRequired, registration, other}"
},
"dateofvalidation": {
"type": "string",
"description": "The date of last validation against the OpenAIRE guidelines for the datasource records"
},
"description": {
"type": "string"
},
"englishname": {
"type": "string",
"description": "The English name of the datasource"
},
"id": {
"type": "string",
"description": "The OpenAIRE id of the data source"
},
"journal": {
"type": "object",
"properties": {
"conferencedate": {
"type": "string"
},
"conferenceplace": {
"type": "string"
},
"edition": {
"type": "string"
},
"ep": {
"type": "string",
"description": "End page"
},
"iss": {
"type": "string",
"description": "Issue number"
},
"issnLinking": {
"type": "string"
},
"issnOnline": {
"type": "string"
},
"issnPrinted": {
"type": "string"
},
"name": {
"type": "string"
},
"sp": {
"type": "string",
"description": "Start page"
},
"vol": {
"type": "string",
"description": "Volume"
}
},
"description": "Information about the journal, if this data source is of type Journal."
},
"languages": {
"description": "The languages present in the data source's content, as defined by OpenDOAR.",
"type": "array",
"items": {
"type": "string"
}
},
"logourl": {
"type": "string"
},
"missionstatementurl": {
"type": "string",
"description":"The URL of a mission statement describing the designated community of the data source. As defined by re3data.org"
},
"officialname": {
"type": "string",
"description": "The official name of the datasource"
},
"openairecompatibility": {
"type": "string",
"description": "OpenAIRE guidelines the data source comply with. See also https://guidelines.openaire.eu."
},
"originalId": {
"description": "Original identifiers for the datasource"
"type": "array",
"items": {
"type": "string"
}
},
"pid": {
"description": "Persistent identifiers of the datasource",
"type": "array",
"items": {
"allOf": [
{
"$ref": "#/definitions/ControlledField"
}
]
}
},
"pidsystems": {
"type": "string",
"description": "The persistent identifier system that is used by the data source. As defined by re3data.org"
},
"policies": {
"description": "Policies of the data source, as defined in OpenDOAR.",
"type": "array",
"items": {
"type": "string"
}
},
"releaseenddate": {
"type": "string",
"description": "Date when the data source went offline or stopped ingesting new research data. As defined by re3data.org"
},
"releasestartdate": {
"type": "string",
"description": "Releasing date of the data source, as defined by re3data.org"
},
"subjects": {
"description": "List of subjects associated to the datasource",
"type": "array",
"items": {
"type": "string"
}
},
"uploadrights": {
"type": "string",
"description": "Type of data upload. As defined by re3data.org: one of {open, restricted,closed}"
},
"versioning": {
"type": "boolean",
"description": "As defined by redata.org: 'yes' if the data source supports versioning, 'no' otherwise."
},
"websiteurl": {
"type": "string"
}
}
}

View File

@ -0,0 +1,57 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"alternativenames": {
"description": "Alternative names that identify the organisation",
"type": "array",
"items": {
"type": "string"
}
},
"country": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The organisation country code"
},
"label": {
"type": "string",
"description": "The organisation country label"
}
},
"description": "The country of the organisation"
},
"id": {
"type": "string",
"description": "The OpenAIRE id for the organisation"
},
"legalname": {
"type": "string"
},
"legalshortname": {
"type": "string"
},
"pid": {
"description": "Persistent identifiers for the organisation i.e. isni 0000000090326370",
"type": "array",
"items": {
"type": "object",
"properties": {
"scheme": {
"type": "string",
"description": "The scheme of the identifier (i.e. isni)"
},
"value": {
"type": "string",
"description": "the value in the schema (i.e. 0000000090326370)"
}
}
}
},
"websiteurl": {
"type": "string"
}
}
}

View File

@ -0,0 +1,119 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"acronym": {
"type": "string"
},
"callidentifier": {
"type": "string"
},
"code": {
"type": "string",
"description": "The grant agreement number"
},
"enddate": {
"type": "string"
},
"funding": {
"description": "Funding information for the project",
"type": "array",
"items": {
"type": "object",
"properties": {
"funding_stream": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "Description of the funding stream"
},
"id": {
"type": "string",
"description": "Id of the funding stream"
}
}
},
"jurisdiction": {
"type": "string",
"description": "The jurisdiction of the funder (i.e. EU)"
},
"name": {
"type": "string",
"description": "The name of the funder (European Commission)"
},
"shortName": {
"type": "string",
"description": "The short name of the funder (EC)"
}
}
}
},
"granted": {
"type": "object",
"properties": {
"currency": {
"type": "string",
"description": "The currency of the granted amount (e.g. EUR)"
},
"fundedamount": {
"type": "number",
"description": "The funded amount"
},
"totalcost": {
"type": "number",
"description": "The total cost of the project"
}
},
"description": "The money granted to the project"
},
"h2020programme": {
"description": "The h2020 programme funding the project",
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The code of the programme"
},
"description": {
"type": "string",
"description": "The description of the programme"
}
}
}
},
"id": {
"type": "string",
"description": "OpenAIRE id for the project"
},
"keywords": {
"type": "string"
},
"openaccessmandatefordataset": {
"type": "boolean"
},
"openaccessmandateforpublications": {
"type": "boolean"
},
"startdate": {
"type": "string"
},
"subject": {
"type": "array",
"items": {
"type": "string"
}
},
"summary": {
"type": "string"
},
"title": {
"type": "string"
},
"websiteurl": {
"type": "string"
}
}
}

View File

@ -0,0 +1,68 @@
{
"$schema":"http://json-schema.org/draft-07/schema#",
"definitions": {
"Node": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The OpenAIRE id of the entity"
},
"type": {
"type": "string",
"description": "The type of the entity (i.e. organisation)"
}
}
}
},
"type":"object",
"properties": {
"provenance": {
"type": "object",
"properties": {
"provenance": {
"type": "string",
"description": "The reason why OpenAIRE holds the relation "
},
"trust": {
"type": "string",
"description": "The trust of the relation in the range of [0,1]. Where greater the number, more the trust. Harvested relationships have typically a high trust (0.9). The trust of inferred relationship is calculated by the inference algorithm that generated them, as described in https://graph.openaire.eu/about#architecture (Enrichment --> Mining)"
}
}
},
"reltype": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The semantics of the relation (i.e. isAuthorInstitutionOf). "
},
"type": {
"type": "string",
"description": "the type of the relation (i.e. affiliation)"
}
},
"description": "To represent the semantics of a relation between two entities"
},
"source": {
"allOf": [
{"$ref": "#/definitions/Node"},
{"description": "The node source in the relation"}
]
},
"target": {
"allOf": [
{"$ref": "#/definitions/Node"},
{"description": "The node target in the relation"}
]
},
"validated":{
"type":"boolean",
"description":"True if the relation is related to a project and it has been collected from an authoritative source (i.e. the funder)"
},
"validationDate":{
"type":"string",
"description":"The date when the relation was collected from OpenAIRE"
}
}
}

View File

@ -0,0 +1,448 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"ControlledField": {
"type": "object",
"properties": {
"scheme": {
"type": "string"
},
"value": {
"type": "string"
}
},
"description": "To represent the information described by a scheme and a value in that scheme (i.e. pid)"
},
"Provenance": {
"type": "object",
"properties": {
"provenance": {
"type": "string",
"description": "The process that produced/provided the information"
},
"trust": {
"type": "string"
}
},
"description": "Indicates the process that produced (or provided) the information, and the trust associated to the information"
}
},
"type": "object",
"properties": {
"author": {
"type": "array",
"items": {
"type": "object",
"properties": {
"fullname": {
"type": "string"
},
"name": {
"type": "string"
},
"pid": {
"type": "object",
"properties": {
"id": {
"allOf": [
{"$ref": "#/definitions/ControlledField"},
{"description": "The author's id and scheme. OpenAIRE currently supports 'ORCID'"}
]
},
"provenance": {
"allOf": [
{"$ref": "#/definitions/Provenance"},
{"description": "Provenance of author's pid"}
]
}
}
},
"rank": {
"type": "integer"
},
"surname": {
"type": "string"
}
}
}
},
"bestaccessright":{
"type":"object",
"properties":{
"code": {
"type": "string",
"description": "COAR access mode code: http://vocabularies.coar-repositories.org/documentation/access_rights/"
},
"label": {
"type": "string",
"description": "Label for the access mode"
},
"scheme": {
"type": "string",
"description": "Scheme of reference for access right code. Always set to COAR access rights vocabulary: http://vocabularies.coar-repositories.org/documentation/access_rights/"
}
}
},
"codeRepositoryUrl": {
"type": "string",
"description": "Only for results with type 'software': the URL to the repository with the source code"
},
"contactgroup": {
"description": "Only for results with type 'software': Information on the group responsible for providing further information regarding the resource",
"type": "array",
"items": {
"type": "string"
}
},
"contactperson": {
"description": "Only for results with type 'software': Information on the person responsible for providing further information regarding the resource",
"type": "array",
"items": {
"type": "string"
}
},
"container": {
"type": "object",
"properties": {
"conferencedate": {
"type": "string"
},
"conferenceplace": {
"type": "string"
},
"edition": {
"type": "string",
"description": "Edition of the journal or conference proceeding"
},
"ep": {
"type": "string",
"description": "End page"
},
"iss": {
"type": "string",
"description": "Journal issue"
},
"issnLinking": {
"type": "string"
},
"issnOnline": {
"type": "string"
},
"issnPrinted": {
"type": "string"
},
"name": {
"type": "string",
"description": "Name of the journal or conference"
},
"sp": {
"type": "string",
"description": "start page"
},
"vol": {
"type": "string"
}
},
"description": "Container has information about the conference or journal where the result has been presented or published"
},
"contributor": {
"type": "array",
"items": {
"type": "string",
"description": "Contributors for the result"
}
},
"country": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "ISO 3166-1 alpha-2 country code"
},
"label": {
"type": "string"
},
"provenance": {
"allOf": [
{"$ref": "#/definitions/Provenance"},
{"description": "Why this result is associated to the country."}
]
}
}
}
},
"coverage": {
"type": "array",
"items": {
"type": "string"
}
},
"dateofcollection": {
"type": "string",
"description": "When OpenAIRE collected the record the last time"
},
"description": {
"type": "array",
"items": {
"type": "string"
}
},
"documentationUrl": {
"description": "Only for results with type 'software': URL to the software documentation",
"type": "array",
"items": {
"type": "string"
}
},
"embargoenddate": {
"type": "string",
"description": "Date when the embargo ends and this result turns Open Access"
},
"format": {
"type": "array",
"items": {
"type": "string"
}
},
"geolocation": {
"description": "Geolocation information",
"type": "array",
"items": {
"type": "object",
"properties": {
"box": {
"type": "string"
},
"place": {
"type": "string"
},
"point": {
"type": "string"
}
}
}
},
"id": {
"type": "string",
"description": "OpenAIRE Identifier"
},
"instance":{
"description":"Each instance is one specific materialisation or version of the result. For example, you can have one result with three instance: one is the pre-print, one is the post-print, one is te published version",
"type":"array",
"items":{
"type":"object",
"properties":{
"accessright":{
"type":"object",
"properties":{
"code": {
"type": "string",
"description": "COAR access mode code: http://vocabularies.coar-repositories.org/documentation/access_rights/"
},
"label": {
"type": "string",
"description": "Label for the access mode"
},
"openAccessRoute":{
"type":"string",
"enum":[
"gold",
"green",
"hybrid",
"bronze"
],
"description":"The type of OpenAccess applied to the result"
},
"scheme": {
"type": "string",
"description": "Scheme of reference for access right code. Always set to COAR access rights vocabulary: http://vocabularies.coar-repositories.org/documentation/access_rights/"
}
}
},
"alternateIdentifier":{
"type":"array",
"items":{
"allOf":[
{
"$ref":"#/definitions/ControlledField"
},
{
"description":"All the identifiers other than pids forged by an authorithy for the pid type (i.e. Crossref for DOIs"
}
]
}
},
"articleprocessingcharge":{
"description": "The money spent to make this book or article available in Open Access. Source for this information is the OpenAPC initiative.",
"type":"object",
"properties":{
"amount":{
"type":"string"
},
"currency":{
"type":"string"
}
}
},
"license":{
"type":"string"
},
"measures":{
"type":"array",
"items":{
"type":"object",
"properties":{
"key":{
"type":"string",
"description":"The measure"
},
"value":{
"type":"string",
"description":"The value for the measure"
}
},
"description":"Measures computed for this instance, for example Bip!Finder ones"
}
},
"pid":{
"description":"The set of persistent identifiers associated to this instance that have been collected from an authority for the pid type (i.e. Crossref/Datacite for doi)",
"type":"array",
"items":{
"allOf":[
{
"$ref":"#/definitions/ControlledField"
},
{
"description":"The persistent identifier associated to the result"
}
]
}
},
"publicationdate":{
"type":"string",
"description": "Date of the research product"
},
"refereed":{
"description": "If this instance has been peer-reviewed or not. Allowed values are peerReviewed, nonPeerReviewed, UNKNOWN (as defined in https://api.openaire.eu/vocabularies/dnet:review_levels)",
"type":"string"
},
"type":{
"type":"string",
"description":"The specific sub-type of this instance (see https://api.openaire.eu/vocabularies/dnet:result_typologies following the links)"
},
"url":{
"description":"URLs to the instance. They may link to the actual full-text or to the landing page at the hosting source. ",
"type":"array",
"items":{
"type":"string"
}
}
}
}
},
"language": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "alpha-3/ISO 639-2 code of the language"
},
"label": {
"type": "string",
"description": "Language label in English"
}
}
},
"lastupdatetimestamp": {
"type": "integer",
"description": "Timestamp of last update of the record in OpenAIRE"
},
"maintitle": {
"type": "string",
"descriptio": "A name or title by which a scientific result is known. May be the title of a publication, of a dataset or the name of a piece of software."
},
"subtitle": {
"type": "string",
"descriptio": "Explanatory or alternative name by which a scientific result is known."
},
"originalId": {
"description": "Identifiers of the record at the original sources",
"type": "array",
"items": {
"type": "string"
}
},
"pid": {
"description": "Persistent identifiers of the result",
"type": "array",
"items": {
"allOf": [
{"$ref": "#/definitions/ControlledField"},
{"description": "scheme: list of available schemes are at https://api.openaire.eu/vocabularies/dnet:pid_types, value: the PID of the result. Note: the result will have a pid associated only if it was collected from an authority for that pid type. For example a doi will be among the pids for one result if the result metadata were collected from Crossref or Datacite. In all the other cases, the doi will be present among the alteranteIdentifiers for the result "}
]
}
},
"programmingLanguage": {
"type": "string",
"description": "Only for results with type 'software': the programming language"
},
"publicationdate": {
"type": "string",
"description": "Main date of the research product: typically the publication or issued date. In case of a research result with different versions with different dates, the date of the result is selected as the most frequent well-formatted date. If not available, then the most recent and complete date among those that are well-formatted. For statistics, the year is extracted and the result is counted only among the result of that year. Example: Pre-print date: 2019-02-03, Article date provided by repository: 2020-02, Article date provided by Crossref: 2020, OpenAIRE will set as date 2019-02-03, because its the most recent among the complete and well-formed dates. If then the repository updates the metadata and set a complete date (e.g. 2020-02-12), then this will be the new date for the result because it becomes the most recent most complete date. However, if OpenAIRE then collects the pre-print from another repository with date 2019-02-03, then this will be the “winning date” because it becomes the most frequent well-formatted date."
},
"publisher": {
"type": "string",
"description": "The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource."
},
"size": {
"type": "string",
"description": "Only for results with type 'dataset': the declared size of the dataset"
},
"source": {
"description": "See definition of Dublin Core field dc:source",
"type": "array",
"items": {
"type": "string"
}
},
"subjects": {
"description": "Keywords associated to the result",
"type": "array",
"items": {
"type": "object",
"properties": {
"provenance": {
"allOf": [
{"$ref": "#/definitions/Provenance"},
{"description": "Why this subject is associated to the result"}
]
},
"subject": {
"allOf": [
{"$ref": "#/definitions/ControlledField"},
{"description": "OpenAIRE subject classification scheme (https://api.openaire.eu/vocabularies/dnet:subject_classification_typologies) and value. When the scheme is 'keyword', it means that the subject is free-text (i.e. not a term from a controlled vocabulary)."}
]
}
}
}
},
"tool": {
"description": "Only for results with type 'other': tool useful for the interpretation and/or re-used of the research product",
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string",
"description": "Type of the result: one of 'publication', 'dataset', 'software', 'other' (see also https://api.openaire.eu/vocabularies/dnet:result_typologies)"
},
"version": {
"type": "string",
"description": "Version of the result"
}
}
}

View File

@ -0,0 +1,9 @@
-- Table to extend the datasource properties according to the eosc model
CREATE TABLE dsm_datasources_eosc(
id varchar(255) references dsm_datasources(id),
jurisdiction text,
thematic boolean,
knowledge_graph boolean,
content_policies text[],
_dnet_resource_identifier_ varchar(2048) default ((('temp_'::text || md5((clock_timestamp())::text)) || '_'::text) || md5((random())::text))
);

View File

@ -14,10 +14,11 @@ import eu.dnetlib.dhp.schema.common.ModelConstants;
import eu.dnetlib.dhp.schema.oaf.Relation; import eu.dnetlib.dhp.schema.oaf.Relation;
/** @author claudio.atzori */ /** @author claudio.atzori */
public class AtomicActionTest { class AtomicActionTest {
@Test @Test
public void serializationTest() throws IOException { @SuppressWarnings("unchecked")
void serializationTest() throws IOException {
Relation rel = new Relation(); Relation rel = new Relation();
rel.setSource("1"); rel.setSource("1");

View File

@ -1,8 +1,9 @@
package eu.dnetlib.dhp.schema.common; package eu.dnetlib.dhp.schema.common;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -17,7 +18,7 @@ public class ModelSupportTest {
class IsSubClass { class IsSubClass {
@Test @Test
public void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() { void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() {
// when // when
Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class); Boolean result = ModelSupport.isSubClass(Relation.class, OafEntity.class);
@ -26,7 +27,7 @@ public class ModelSupportTest {
} }
@Test @Test
public void shouldReturnTrueWhenSubClassExtendsSuperClass() { void shouldReturnTrueWhenSubClassExtendsSuperClass() {
// when // when
Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class); Boolean result = ModelSupport.isSubClass(Result.class, OafEntity.class);
@ -34,4 +35,19 @@ public class ModelSupportTest {
assertTrue(result); assertTrue(result);
} }
} }
@Nested
class InverseRelation {
@Test
void findRelations() throws IOException {
assertNotNull(ModelSupport.findRelation("isMetadataFor"));
assertNotNull(ModelSupport.findRelation("ismetadatafor"));
assertNotNull(ModelSupport.findRelation("ISMETADATAFOR"));
assertNotNull(ModelSupport.findRelation("isRelatedTo"));
}
}
} }

View File

@ -12,13 +12,13 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
public class MeasureTest { class MeasureTest {
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL); .setSerializationInclusion(JsonInclude.Include.NON_NULL);
@Test @Test
public void testMeasureSerialization() throws IOException { void testMeasureSerialization() throws IOException {
Measure popularity = new Measure(); Measure popularity = new Measure();
popularity.setId("popularity"); popularity.setId("popularity");

View File

@ -3,24 +3,44 @@ package eu.dnetlib.dhp.schema.oaf;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class MergeTest { import com.fasterxml.jackson.databind.ObjectMapper;
/**
* The type Merge test.
*/
class MergeTest {
/**
* The Oaf.
*/
OafEntity oaf; OafEntity oaf;
/**
* Sets up.
*/
@BeforeEach @BeforeEach
public void setUp() { public void setUp() {
oaf = new Publication(); oaf = new Publication();
} }
/**
* Merge lists test.
*/
@Test @Test
public void mergeListsTest() { @SuppressWarnings("unchecked")
void mergeListsTest() {
// string list merge test // string list merge test
List<String> a = Arrays.asList("a", "b", "c", "e"); List<String> a = Arrays.asList("a", "b", "c", "e");
@ -34,8 +54,11 @@ public class MergeTest {
System.out.println("merge result 3 = " + oaf.mergeLists(c, c)); System.out.println("merge result 3 = " + oaf.mergeLists(c, c));
} }
/**
* Merge publication collected from test.
*/
@Test @Test
public void mergePublicationCollectedFromTest() { void mergePublicationCollectedFromTest() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -49,8 +72,120 @@ public class MergeTest {
assertEquals(3, a.getCollectedfrom().size()); assertEquals(3, a.getCollectedfrom().size());
} }
/**
* Load resource result list.
*
* @param <T> the type parameter
* @param path the path
* @param clazz the clazz
* @return the list
* @throws Exception the exception
*/
private <T extends Result> List<Result> loadResourceResult(final String path, final Class<T> clazz ) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final InputStream str = Objects.requireNonNull(getClass().getResourceAsStream(path));
// LOAD test publications
return IOUtils.readLines(str).stream().map(s -> {
try {
return mapper.readValue(s, clazz);
} catch (IOException e) {
return null;
}
}).filter(Objects::nonNull).collect(Collectors.toList());
}
/**
* Apply to any test list result the same pid of the enrichment instance
*
* @param source the source
* @param enrichment the enrichment
* @param overrideAlternateIdentifier the override alternate identifier
*/
private void updatePidIntoPublicationInstance(final List<Result> source, final List<Result>enrichment, final boolean overrideAlternateIdentifier) {
for(int i = 0 ; i< source.size(); i++) {
final Result currentPub = source.get(i);
final Result currentEnrichment = enrichment.get(i);
final Instance currentInstance = Objects.requireNonNull(currentPub.getInstance()).get(0);
if (overrideAlternateIdentifier)
currentInstance.setAlternateIdentifier(Objects.requireNonNull(currentEnrichment.getInstance()).get(0).getPid());
else
currentInstance.setPid(Objects.requireNonNull(currentEnrichment.getInstance()).get(0).getPid());
}
}
private void applyAndVerifyEnrichment(final List<Result> l1, final List<Result> l2) {
// Apply Merge and verify that enrichments works
for(int i = 0 ; i< l1.size(); i++) {
final Result currentPub = l2.get(i);
final Result currentEnrichment = l1.get(i);
currentPub.mergeFrom(currentEnrichment);
assertEquals(1, currentPub.getInstance().size());
final Instance currentInstance = Objects.requireNonNull(currentPub.getInstance()).get(0);
assertNotNull(currentInstance.getMeasures());
assertNotNull(currentPub.getTitle());
assertFalse(Result.isAnEnrichment(currentPub));
}
}
/**
* Test enrichment function.
*
* @throws Exception the exception
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_bothPresent() { void testEnrichment() throws Exception {
// 1 TEST UPDATING PID INSTANCE AND MERGE CURRENT PUBLICATION WITH ENRICHMENT
// LOAD test publications
List<Result> publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publications.json", Publication.class);
// Assert that each publication has only one instance and inside that all the measure field is empty
publications.forEach(p -> {
assertEquals(1, p.getInstance().size());
final Instance currentInstance = Objects.requireNonNull(p.getInstance()).get(0);
assertNull(currentInstance.getMeasures());
});
// LOAD test enrichments
List<Result> enrichment = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/enrichment.json", Result.class);
updatePidIntoPublicationInstance(publications, enrichment, false);
applyAndVerifyEnrichment(publications, enrichment);
// 2 TEST UPDATING ALTERNATE ID INSTANCE AND MERGE CURRENT PUBLICATION WITH ENRICHMENT
publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publications.json", Publication.class);
enrichment = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/enrichment.json", Result.class);
updatePidIntoPublicationInstance(publications, enrichment, true);
applyAndVerifyEnrichment(publications, enrichment);
// 3 TEST UPDATING PID INSTANCE AND MERGE ENRICHMENT WITH CURRENT PUBLICATION
publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publications.json", Publication.class);
enrichment = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/enrichment.json", Result.class);
updatePidIntoPublicationInstance(publications, enrichment, false);
applyAndVerifyEnrichment( enrichment, publications);
// 4 TEST UPDATING ALTERNATE ID INSTANCE AND MERGE ENRICHMENT WITH CURRENT PUBLICATION
publications = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/publications.json", Publication.class);
enrichment = loadResourceResult("/eu/dnetlib/dhp/schema/oaf/utils/enrichment.json", Result.class);
updatePidIntoPublicationInstance(publications, enrichment, true);
applyAndVerifyEnrichment( enrichment, publications);
}
/**
* Merge publication date of acceptance test both present.
*/
@Test
void mergePublicationDateOfAcceptanceTest_bothPresent() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -64,8 +199,11 @@ public class MergeTest {
assertEquals("2021-06-18", a.getDateofacceptance().getValue()); assertEquals("2021-06-18", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test both present 1.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_bothPresent_1() { void mergePublicationDateOfAcceptanceTest_bothPresent_1() {
Publication a = publication("0.8"); Publication a = publication("0.8");
Publication b = publication("0.9"); Publication b = publication("0.9");
@ -79,8 +217,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test both present 2.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_bothPresent_2() { void mergePublicationDateOfAcceptanceTest_bothPresent_2() {
Publication a = publication("0.9"); Publication a = publication("0.9");
Publication b = publication("0.8"); Publication b = publication("0.8");
@ -94,8 +235,11 @@ public class MergeTest {
assertEquals("2021-06-18", a.getDateofacceptance().getValue()); assertEquals("2021-06-18", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test left missing.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_leftMissing() { void mergePublicationDateOfAcceptanceTest_leftMissing() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -108,8 +252,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test left missing 1.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_leftMissing_1() { void mergePublicationDateOfAcceptanceTest_leftMissing_1() {
Publication a = publication("0.9"); Publication a = publication("0.9");
Publication b = publication("0.8"); Publication b = publication("0.8");
@ -122,8 +269,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test left missing 2.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_leftMissing_2() { void mergePublicationDateOfAcceptanceTest_leftMissing_2() {
Publication a = publication("0.8"); Publication a = publication("0.8");
Publication b = publication("0.9"); Publication b = publication("0.9");
@ -136,8 +286,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test right missing.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_rightMissing() { void mergePublicationDateOfAcceptanceTest_rightMissing() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -150,8 +303,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test right missing 1.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_rightMissing_1() { void mergePublicationDateOfAcceptanceTest_rightMissing_1() {
Publication a = publication("0.8"); Publication a = publication("0.8");
Publication b = publication("0.9"); Publication b = publication("0.9");
@ -164,8 +320,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication date of acceptance test right missing 2.
*/
@Test @Test
public void mergePublicationDateOfAcceptanceTest_rightMissing_2() { void mergePublicationDateOfAcceptanceTest_rightMissing_2() {
Publication a = publication("0.9"); Publication a = publication("0.9");
Publication b = publication("0.8"); Publication b = publication("0.8");
@ -178,8 +337,11 @@ public class MergeTest {
assertEquals("2021-06-19", a.getDateofacceptance().getValue()); assertEquals("2021-06-19", a.getDateofacceptance().getValue());
} }
/**
* Merge publication subject test.
*/
@Test @Test
public void mergePublicationSubjectTest() { void mergePublicationSubjectTest() {
Publication a = publication(); Publication a = publication();
Publication b = publication(); Publication b = publication();
@ -193,8 +355,11 @@ public class MergeTest {
assertEquals(3, a.getSubject().size()); assertEquals(3, a.getSubject().size());
} }
/**
* Merge relation test.
*/
@Test @Test
public void mergeRelationTest() { void mergeRelationTest() {
Relation a = createRel(null, null); Relation a = createRel(null, null);
Relation b = createRel(null, null); Relation b = createRel(null, null);
@ -234,8 +399,11 @@ public class MergeTest {
} }
/**
* Merge relation test parse exception.
*/
@Test @Test
public void mergeRelationTestParseException() { void mergeRelationTestParseException() {
assertThrows(DateTimeParseException.class, () -> { assertThrows(DateTimeParseException.class, () -> {
Relation a = createRel(true, "Once upon a time ..."); Relation a = createRel(true, "Once upon a time ...");
Relation b = createRel(true, "... in a far away land"); Relation b = createRel(true, "... in a far away land");
@ -243,6 +411,13 @@ public class MergeTest {
}); });
} }
/**
* Create rel relation.
*
* @param validated the validated
* @param validationDate the validation date
* @return the relation
*/
private Relation createRel(Boolean validated, String validationDate) { private Relation createRel(Boolean validated, String validationDate) {
Relation rel = new Relation(); Relation rel = new Relation();
rel.setSource("1"); rel.setSource("1");
@ -255,6 +430,13 @@ public class MergeTest {
return rel; return rel;
} }
/**
* Sets kv.
*
* @param key the key
* @param value the value
* @return the kv
*/
private KeyValue setKV(final String key, final String value) { private KeyValue setKV(final String key, final String value) {
KeyValue k = new KeyValue(); KeyValue k = new KeyValue();
@ -265,6 +447,14 @@ public class MergeTest {
return k; return k;
} }
/**
* Sets sp.
*
* @param value the value
* @param schema the schema
* @param classname the classname
* @return the sp
*/
private StructuredProperty setSP( private StructuredProperty setSP(
final String value, final String schema, final String classname) { final String value, final String schema, final String classname) {
StructuredProperty s = new StructuredProperty(); StructuredProperty s = new StructuredProperty();
@ -278,24 +468,48 @@ public class MergeTest {
return s; return s;
} }
/**
* Field field.
*
* @param <T> the type parameter
* @param value the value
* @return the field
*/
private <T> Field<T> field(T value) { private <T> Field<T> field(T value) {
Field<T> f = new Field<T>(); Field<T> f = new Field();
f.setValue(value); f.setValue(value);
return f; return f;
} }
/**
* Publication publication.
*
* @return the publication
*/
private Publication publication() { private Publication publication() {
Publication p = new Publication(); Publication p = new Publication();
p.setDataInfo(df("0.9")); p.setDataInfo(df("0.9"));
return p; return p;
} }
/**
* Publication publication.
*
* @param trust the trust
* @return the publication
*/
private Publication publication(String trust) { private Publication publication(String trust) {
Publication p = new Publication(); Publication p = new Publication();
p.setDataInfo(df(trust)); p.setDataInfo(df(trust));
return p; return p;
} }
/**
* Df data info.
*
* @param trust the trust
* @return the data info
*/
private DataInfo df(String trust) { private DataInfo df(String trust) {
DataInfo d = new DataInfo(); DataInfo d = new DataInfo();
d.setTrust(trust); d.setTrust(trust);

View File

@ -0,0 +1,55 @@
package eu.dnetlib.dhp.schema.oaf.dump;
import java.io.IOException;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.imifou.jsonschema.module.addon.AddonModule;
import com.github.victools.jsonschema.generator.*;
import eu.dnetlib.dhp.schema.dump.ExecCreateSchemas;
import eu.dnetlib.dhp.schema.dump.oaf.graph.*;
//@Disabled
class GenerateJsonSchema {
@Test
void generateSchema() {
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_7,
OptionPreset.PLAIN_JSON)
.with(Option.SCHEMA_VERSION_INDICATOR)
.without(Option.NONPUBLIC_NONSTATIC_FIELDS_WITHOUT_GETTERS);
configBuilder.forFields().withDescriptionResolver(field -> "Description of " + field.getDeclaredName());
SchemaGeneratorConfig config = configBuilder.build();
SchemaGenerator generator = new SchemaGenerator(config);
JsonNode jsonSchema = generator.generateSchema(GraphResult.class);
System.out.println(jsonSchema.toString());
}
@Test
void generateSchema2(){
ObjectMapper objectMapper = new ObjectMapper();
AddonModule module = new AddonModule();
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(objectMapper,SchemaVersion.DRAFT_7,OptionPreset.PLAIN_JSON)
.with(module)
.with(Option.SCHEMA_VERSION_INDICATOR)
.without(Option.NONPUBLIC_NONSTATIC_FIELDS_WITHOUT_GETTERS);
SchemaGeneratorConfig config = configBuilder.build();
SchemaGenerator generator = new SchemaGenerator(config);
JsonNode jsonSchema = generator.generateSchema(GraphResult.class);
System.out.println(jsonSchema.toString());
}
@Test
void generateJsonSchema3() throws IOException {
ExecCreateSchemas.main(new String[]{});
}
}

View File

@ -6,10 +6,10 @@ import java.util.Set;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class BlackListProviderTest { class BlackListProviderTest {
@Test @Test
public void blackListTest() { void blackListTest() {
Assertions.assertNotNull(PidBlacklistProvider.getBlacklist()); Assertions.assertNotNull(PidBlacklistProvider.getBlacklist());
Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi")); Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi"));

View File

@ -14,13 +14,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.Publication; import eu.dnetlib.dhp.schema.oaf.Publication;
public class IdentifierFactoryTest { class IdentifierFactoryTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@Test @Test
public void testCreateIdentifierForPublication() throws IOException { void testCreateIdentifierForPublication() throws IOException {
verifyIdentifier( verifyIdentifier(
"publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true); "publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true);
@ -51,7 +51,7 @@ public class IdentifierFactoryTest {
} }
@Test @Test
public void testCreateIdentifierForPublicationNoHash() throws IOException { void testCreateIdentifierForPublicationNoHash() throws IOException {
verifyIdentifier("publication_doi1.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false); verifyIdentifier("publication_doi1.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false);
verifyIdentifier("publication_doi2.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false); verifyIdentifier("publication_doi2.json", "50|doi_________::10.1016/j.cmet.2010.03.013", false);

View File

@ -0,0 +1,12 @@
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0000/ra.v2i3.114::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"4.65008652949e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0000/ra.v2i3.114"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0001/(aj).v3i6.458::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"4.01810569717e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0001/(aj).v3i6.458"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0001/1587::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.39172290649e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0001/1587"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0001/462::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"6.33235333753e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.36"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.00285265116e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0001/462"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0001/731::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"4.01810569717e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0001/731"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0001/ijllis.v9i4.2066.g2482::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"8.48190886761e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0001/ijllis.v9i4.2066.g2482"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0118/alfahim.v3i1.140::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"9.88840807598e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0118/alfahim.v3i1.140"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0166/fk2.stagefigshare.6442896.v3::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"7.28336930301e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0166/fk2.stagefigshare.6442896.v3"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0301/jttb.v2i1.64::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"7.28336930301e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0301/jttb.v2i1.64"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0809/seruni.v1i1.567::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"2.62959564033e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0809/seruni.v1i1.567"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0809/seruni.v2i1.765::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"9.40178571921e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0559872"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"3.67659957614e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0809/seruni.v2i1.765"}]}]}
{"dataInfo":{"deletedbyinference":false,"inferred":true,"invisible":false,"provenanceaction":{"classid":"sysimport:enrich","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"id":"unresolved::10.0901/jkip.v7i3.485::doi","instance":[{"measures":[{"id":"influence","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"5.91019644836e-09"}]},{"id":"popularity_alt","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"0.0"}]},{"id":"popularity","unit":[{"dataInfo":{"deletedbyinference":false,"inferenceprovenance":"update","inferred":true,"invisible":false,"provenanceaction":{"classid":"measure:bip","classname":"Inferred by OpenAIRE","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"},"trust":""},"key":"score","value":"6.26204125721e-09"}]}],"pid":[{"qualifier":{"classid":"doi","classname":"Digital Object Identifier","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"value":"10.0901/jkip.v7i3.485"}]}]}

File diff suppressed because one or more lines are too long