From 7b76611955bea833226bc77c0ff2ce06aed02766 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 1 Feb 2023 16:12:23 +0100 Subject: [PATCH] WIP: refactoring model utilities --- .../schema/common/AccessRightComparator.java | 69 --- .../dnetlib/dhp/schema/common/EntityType.java | 21 - .../dhp/schema/common/MainEntityType.java | 7 - .../dhp/schema/common/ModelSupport.java | 408 ------------------ .../dhp/schema/common/RefereedComparator.java | 44 -- .../dhp/schema/common/RelationInverse.java | 46 -- .../dhp/schema/mdstore/MetadataRecord.java | 5 +- .../eu/dnetlib/dhp/schema/oaf/Entity.java | 3 +- .../dhp/schema/oaf/EntityDataInfo.java | 1 - .../eu/dnetlib/dhp/schema/oaf/Relation.java | 25 -- .../schema/oaf/utils/CleaningFunctions.java | 74 ---- .../schema/oaf/utils/IdentifierFactory.java | 292 ------------- .../dhp/schema/oaf/utils/ModelHardLimits.java | 24 -- .../oaf/utils/OrganizationPidComparator.java | 38 -- .../dhp/schema/oaf/utils/PidBlacklist.java | 8 - .../oaf/utils/PidBlacklistProvider.java | 39 -- .../dhp/schema/oaf/utils/PidComparator.java | 48 --- .../dnetlib/dhp/schema/oaf/utils/PidType.java | 79 ---- .../schema/oaf/utils/PidValueComparator.java | 33 -- .../schema/oaf/utils/ResultPidComparator.java | 53 --- .../oaf/utils/ResultTypeComparator.java | 77 ---- .../dhp/schema/oaf/utils/pid_blacklist.json | 5 - .../dhp/schema/common/ModelSupportTest.java | 53 --- .../oaf/utils/BlackListProviderTest.java | 21 - .../oaf/utils/IdentifierFactoryTest.java | 87 ---- .../dhp/schema/oaf/utils/orp-rohub.json | 197 --------- .../dhp/schema/oaf/utils/publication_3.json | 1 - .../dhp/schema/oaf/utils/publication_4.json | 1 - .../dhp/schema/oaf/utils/publication_5.json | 1 - .../schema/oaf/utils/publication_doi1.json | 33 -- .../schema/oaf/utils/publication_doi2.json | 37 -- .../schema/oaf/utils/publication_doi3.json | 37 -- .../schema/oaf/utils/publication_doi4.json | 37 -- .../schema/oaf/utils/publication_doi5.json | 37 -- .../schema/oaf/utils/publication_openapc.json | 31 -- .../schema/oaf/utils/publication_pmc1.json | 17 - .../schema/oaf/utils/publication_pmc2.json | 21 - .../schema/oaf/utils/publication_urn1.json | 23 - 38 files changed, 3 insertions(+), 2030 deletions(-) delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/common/EntityType.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/common/MainEntityType.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/common/RelationInverse.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/OrganizationPidComparator.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklist.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidComparator.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidType.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidValueComparator.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultPidComparator.java delete mode 100644 src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java delete mode 100644 src/main/resources/eu/dnetlib/dhp/schema/oaf/utils/pid_blacklist.json delete mode 100644 src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java delete mode 100644 src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java delete mode 100644 src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_3.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_4.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_5.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi1.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi2.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi3.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi4.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi5.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_openapc.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc1.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc2.json delete mode 100644 src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_urn1.json diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java b/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java deleted file mode 100644 index f77e2af..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/common/AccessRightComparator.java +++ /dev/null @@ -1,69 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -import java.util.Comparator; - -import eu.dnetlib.dhp.schema.oaf.Qualifier; - -public class AccessRightComparator implements Comparator { - - @Override - public int compare(T left, T right) { - - if (left == null && right == null) - return 0; - if (left == null) - return 1; - if (right == null) - return -1; - - String lClass = left.getClassid(); - String rClass = right.getClassid(); - - if (lClass.equals(rClass)) - return 0; - - if (lClass.equals("OPEN SOURCE")) - return -1; - if (rClass.equals("OPEN SOURCE")) - return 1; - - if (lClass.equals("OPEN")) - return -1; - if (rClass.equals("OPEN")) - return 1; - - if (lClass.equals("6MONTHS")) - return -1; - if (rClass.equals("6MONTHS")) - return 1; - - if (lClass.equals("12MONTHS")) - return -1; - if (rClass.equals("12MONTHS")) - return 1; - - if (lClass.equals("EMBARGO")) - return -1; - if (rClass.equals("EMBARGO")) - return 1; - - if (lClass.equals("RESTRICTED")) - return -1; - if (rClass.equals("RESTRICTED")) - return 1; - - if (lClass.equals("CLOSED")) - return -1; - if (rClass.equals("CLOSED")) - return 1; - - if (lClass.equals("UNKNOWN")) - return -1; - if (rClass.equals("UNKNOWN")) - return 1; - - // Else (but unlikely), lexicographical ordering will do. - return lClass.compareTo(rClass); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/EntityType.java b/src/main/java/eu/dnetlib/dhp/schema/common/EntityType.java deleted file mode 100644 index bf92fb7..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/common/EntityType.java +++ /dev/null @@ -1,21 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -import eu.dnetlib.dhp.schema.oaf.Entity; - -/** Actual entity types in the Graph */ -public enum EntityType { - publication, dataset, otherresearchproduct, software, datasource, organization, project; - - /** - * Resolves the EntityType, given the relative class name - * - * @param clazz the given class name - * @param actual OafEntity subclass - * @return the EntityType associated to the given class - */ - public static EntityType fromClass(Class clazz) { - - return EntityType.valueOf(clazz.getSimpleName().toLowerCase()); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/MainEntityType.java b/src/main/java/eu/dnetlib/dhp/schema/common/MainEntityType.java deleted file mode 100644 index cda8ba4..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/common/MainEntityType.java +++ /dev/null @@ -1,7 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -/** Main entity types in the Graph */ -public enum MainEntityType { - result, datasource, organization, project -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java b/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java deleted file mode 100644 index e38da89..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/common/ModelSupport.java +++ /dev/null @@ -1,408 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -import static com.google.common.base.Preconditions.checkArgument; -import static eu.dnetlib.dhp.schema.common.ModelConstants.*; - -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.text.ParseException; -import java.util.Date; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Function; - -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.lang3.StringUtils; - -import com.github.sisyphsu.dateparser.DateParserUtils; -import com.google.common.collect.Maps; - -import eu.dnetlib.dhp.schema.oaf.*; - -/** Oaf model utility methods. */ -public class ModelSupport { - - /** Defines the mapping between the actual entity type and the main entity type */ - private static final Map entityMapping = Maps.newHashMap(); - - static { - entityMapping.put(EntityType.publication, MainEntityType.result); - entityMapping.put(EntityType.dataset, MainEntityType.result); - entityMapping.put(EntityType.otherresearchproduct, MainEntityType.result); - entityMapping.put(EntityType.software, MainEntityType.result); - entityMapping.put(EntityType.datasource, MainEntityType.datasource); - entityMapping.put(EntityType.organization, MainEntityType.organization); - entityMapping.put(EntityType.project, MainEntityType.project); - } - - /** - * Defines the mapping between the actual entity types and the relative classes implementing them - */ - public static final Map entityTypes = Maps.newHashMap(); - - static { - entityTypes.put(EntityType.datasource, Datasource.class); - entityTypes.put(EntityType.organization, Organization.class); - entityTypes.put(EntityType.project, Project.class); - entityTypes.put(EntityType.dataset, Dataset.class); - entityTypes.put(EntityType.otherresearchproduct, OtherResearchProduct.class); - entityTypes.put(EntityType.software, Software.class); - entityTypes.put(EntityType.publication, Publication.class); - } - - public static final Map oafTypes = Maps.newHashMap(); - - static { - oafTypes.put("datasource", Datasource.class); - oafTypes.put("organization", Organization.class); - oafTypes.put("project", Project.class); - oafTypes.put("dataset", Dataset.class); - oafTypes.put("otherresearchproduct", OtherResearchProduct.class); - oafTypes.put("software", Software.class); - oafTypes.put("publication", Publication.class); - oafTypes.put("relation", Relation.class); - } - - public static final Map idPrefixMap = Maps.newHashMap(); - - static { - idPrefixMap.put(Datasource.class, "10"); - idPrefixMap.put(Organization.class, "20"); - idPrefixMap.put(Project.class, "40"); - idPrefixMap.put(Dataset.class, "50"); - idPrefixMap.put(OtherResearchProduct.class, "50"); - idPrefixMap.put(Software.class, "50"); - idPrefixMap.put(Publication.class, "50"); - } - - public static final Map entityIdPrefix = Maps.newHashMap(); - - static { - entityIdPrefix.put("datasource", "10"); - entityIdPrefix.put("organization", "20"); - entityIdPrefix.put("project", "40"); - entityIdPrefix.put("result", "50"); - } - - public static final Map idPrefixEntity = Maps.newHashMap(); - - static { - idPrefixEntity.put("10", "datasource"); - idPrefixEntity.put("20", "organization"); - idPrefixEntity.put("40", "project"); - idPrefixEntity.put("50", "result"); - } - - public static final Map relationInverseMap = Maps.newHashMap(); - - static { - set(relationInverseMap, PROJECT_ORGANIZATION, PARTICIPATION, IS_PARTICIPANT, HAS_PARTICIPANT); - - set(relationInverseMap, RESULT_ORGANIZATION, AFFILIATION, IS_AUTHOR_INSTITUTION_OF, HAS_AUTHOR_INSTITUTION); - - 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_DESCRIBED_BY, DESCRIBES); - set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_METADATA_FOR, IS_METADATA_OF); - set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, HAS_ASSOCIATION_WITH, HAS_ASSOCIATION_WITH); - set(relationInverseMap, RESULT_RESULT, RELATIONSHIP, IS_REQUIRED_BY, REQUIRES); - - - 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 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"; - - public static final String DATE_FORMAT = "yyyy-MM-dd"; - - private ModelSupport() { - } - - public static String getIdPrefix(Class clazz) { - return idPrefixMap.get(clazz); - } - - /** - * Checks subclass-superclass relationship. - * - * @param subClazzObject Subclass object instance - * @param superClazzObject Superclass object instance - * @param Subclass type - * @param Superclass type - * @return True if X is a subclass of Y - */ - public static Boolean isSubClass( - X subClazzObject, Y superClazzObject) { - return isSubClass(subClazzObject.getClass(), superClazzObject.getClass()); - } - - /** - * Checks subclass-superclass relationship. - * - * @param subClazzObject Subclass object instance - * @param superClazz Superclass class - * @param Subclass type - * @param Superclass type - * @return True if X is a subclass of Y - */ - public static Boolean isSubClass( - X subClazzObject, Class superClazz) { - return isSubClass(subClazzObject.getClass(), superClazz); - } - - /** - * Checks subclass-superclass relationship. - * - * @param subClazz Subclass class - * @param superClazz Superclass class - * @param Subclass type - * @param Superclass type - * @return True if X is a subclass of Y - */ - public static Boolean isSubClass( - Class subClazz, Class superClazz) { - return superClazz.isAssignableFrom(subClazz); - } - - /** - * Lists all the OAF model classes - * - * @param - * @return - */ - public static Class[] getOafModelClasses() { - return new Class[] { - AccessRight.class, - Author.class, - AuthorPid.class, - Context.class, - Country.class, - DataInfo.class, - Dataset.class, - Datasource.class, - Entity.class, - EntityDataInfo.class, - EoscIfGuidelines.class, - ExternalReference.class, - ExtraInfo.class, - GeoLocation.class, - H2020Classification.class, - H2020Programme.class, - Instance.class, - Journal.class, - KeyValue.class, - License.class, - Measure.class, - OAIProvenance.class, - OpenAccessRoute.class, - Organization.class, - OriginDescription.class, - OtherResearchProduct.class, - Project.class, - Provenance.class, - Publication.class, - Publisher.class, - Qualifier.class, - Relation.class, - Result.class, - Software.class, - StructuredProperty.class, - Subject.class - }; - } - - public static String getMainType(final EntityType type) { - return entityMapping.get(type).name(); - } - - public static boolean isResult(EntityType type) { - return MainEntityType.result.name().equals(getMainType(type)); - } - - public static String getScheme(final String sourceType, final String targetType) { - return String - .format( - schemeTemplate, - entityMapping.get(EntityType.valueOf(sourceType)).name(), - entityMapping.get(EntityType.valueOf(targetType)).name()); - } - - public static String tableIdentifier(String dbName, String tableName) { - - checkArgument(StringUtils.isNotBlank(dbName), "DB name cannot be empty"); - checkArgument(StringUtils.isNotBlank(tableName), "table name cannot be empty"); - - return String.format("%s.%s", dbName, tableName); - } - - public static String tableIdentifier(String dbName, Class clazz) { - - checkArgument(Objects.nonNull(clazz), "clazz is needed to derive the table name, thus cannot be null"); - - return tableIdentifier(dbName, clazz.getSimpleName().toLowerCase()); - } - - private static String idFnForRelation(Relation r) { - return Optional - .ofNullable(r.getSource()) - .map( - source -> Optional - .ofNullable(r.getTarget()) - .map( - target -> Optional - .ofNullable(r.getRelType()) - .map( - relType -> Optional - .ofNullable(r.getSubRelType()) - .map( - subRelType -> Optional - .ofNullable(r.getRelClass()) - .map( - relClass -> String - .join( - source, - target, - relType, - subRelType, - relClass)) - .orElse( - String - .join( - source, - target, - relType, - subRelType))) - .orElse(String.join(source, target, relType))) - .orElse(String.join(source, target))) - .orElse(source)) - .orElse(null); - } - - private static String idFnForOafEntity(T t) { - return t.getId(); - } - - public static String md5(final String s) { - try { - final MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(s.getBytes(StandardCharsets.UTF_8)); - return new String(Hex.encodeHex(md.digest())); - } catch (final NoSuchAlgorithmException e) { - throw new IllegalStateException(e); - } - } - - public static String generateIdentifier(final String originalId, final String nsPrefix) { - return String.format("%s::%s", nsPrefix, md5(originalId)); - } - - public static String oldest(String dateA, String dateB) throws ParseException { - - if (StringUtils.isBlank(dateA)) { - return dateB; - } - if (StringUtils.isBlank(dateB)) { - return dateA; - } - if (StringUtils.isNotBlank(dateA) && StringUtils.isNotBlank(dateB)) { - - final Date a = DateParserUtils.parseDate(dateA); - final Date b = DateParserUtils.parseDate(dateB); - - if (Objects.nonNull(a) && Objects.nonNull(b)) { - return a.before(b) ? dateA : dateB; - } else { - return null; - } - } else { - return null; - } - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java b/src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java deleted file mode 100644 index 86c0d97..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/common/RefereedComparator.java +++ /dev/null @@ -1,44 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -import java.util.Comparator; - -import eu.dnetlib.dhp.schema.oaf.Qualifier; - -public class RefereedComparator implements Comparator { - - @Override - public int compare(Qualifier left, Qualifier right) { - - if (left == null && right == null) - return 0; - if (left == null) - return 1; - if (right == null) - return -1; - - String lClass = left.getClassid(); - String rClass = right.getClassid(); - - if (lClass.equals(rClass)) - return 0; - - if (lClass.equals(ModelConstants.PEER_REVIEWED_CLASSID)) - return -1; - if (rClass.equals(ModelConstants.PEER_REVIEWED_CLASSID)) - return 1; - - if (lClass.equals(ModelConstants.NON_PEER_REVIEWED_CLASSID)) - return -1; - if (rClass.equals(ModelConstants.NON_PEER_REVIEWED_CLASSID)) - return 1; - - if (lClass.equals(ModelConstants.UNKNOWN)) - return -1; - if (rClass.equals(ModelConstants.UNKNOWN)) - return 1; - - // Else (but unlikely), lexicographical ordering will do. - return lClass.compareTo(rClass); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/common/RelationInverse.java b/src/main/java/eu/dnetlib/dhp/schema/common/RelationInverse.java deleted file mode 100644 index 2b9ed94..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/common/RelationInverse.java +++ /dev/null @@ -1,46 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -public class RelationInverse { - private String relClass; - private String inverseRelClass; - private String relType; - private String subReltype; - - public String getRelType() { - return relType; - } - - public RelationInverse setRelType(String relType) { - this.relType = relType; - return this; - } - - public String getSubReltype() { - return subReltype; - } - - public RelationInverse setSubReltype(String subReltype) { - this.subReltype = subReltype; - return this; - } - - public String getRelClass() { - return relClass; - } - - public RelationInverse setRelClass(String relClass) { - this.relClass = relClass; - return this; - } - - public String getInverseRelClass() { - return inverseRelClass; - } - - public RelationInverse setInverseRelClass(String inverseRelClass) { - this.inverseRelClass = inverseRelClass; - return this; - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java index 8277e14..9fce404 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java +++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java @@ -3,8 +3,6 @@ package eu.dnetlib.dhp.schema.mdstore; import java.io.Serializable; -import eu.dnetlib.dhp.schema.common.ModelSupport; - /** * This class models a record in a Metadata store collection on HDFS */ @@ -38,6 +36,7 @@ public class MetadataRecord implements Serializable { } public MetadataRecord( + String id, String originalId, String encoding, Provenance provenance, @@ -49,7 +48,7 @@ public class MetadataRecord implements Serializable { this.provenance = provenance; this.body = body; this.dateOfCollection = dateOfCollection; - this.id = ModelSupport.generateIdentifier(originalId, this.provenance.getNsPrefix()); + this.id = id; } public String getId() { diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Entity.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Entity.java index 3fef249..790f7fd 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Entity.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Entity.java @@ -14,7 +14,7 @@ public abstract class Entity extends Oaf implements Serializable { /** * The list of datasource id/name pairs providing this Oaf. */ - protected List collectedfrom; + private List collectedfrom; private Long lastupdatetimestamp; @@ -33,7 +33,6 @@ public abstract class Entity extends Oaf implements Serializable { private EntityDataInfo dataInfo; - public List getCollectedfrom() { return collectedfrom; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/EntityDataInfo.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/EntityDataInfo.java index 0f54eee..a172b36 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/EntityDataInfo.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/EntityDataInfo.java @@ -7,7 +7,6 @@ public class EntityDataInfo extends DataInfo { private Boolean invisible = false; private Boolean deletedbyinference = false; - public Boolean getInvisible() { return invisible; } diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java index 53c8414..09b16be 100644 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java +++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java @@ -1,16 +1,11 @@ package eu.dnetlib.dhp.schema.oaf; -import static com.google.common.base.Preconditions.checkArgument; - import java.io.Serializable; -import java.text.ParseException; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import eu.dnetlib.dhp.schema.common.ModelSupport; - /** * Relation models any edge between two nodes in the OpenAIRE graph. It has a source id and a target id pointing to * graph node identifiers and it is further characterised by the semantic of the link through the fields relType, @@ -145,26 +140,6 @@ public class Relation extends Oaf implements Serializable { this.provenance = provenance; } - public void mergeFrom(final Relation r) { - - checkArgument(Objects.equals(getSource(), r.getSource()), "source ids must be equal"); - checkArgument(Objects.equals(getTarget(), r.getTarget()), "target ids must be equal"); - checkArgument(Objects.equals(getRelType(), r.getRelType()), "relType(s) must be equal"); - checkArgument( - Objects.equals(getSubRelType(), r.getSubRelType()), "subRelType(s) must be equal"); - checkArgument(Objects.equals(getRelClass(), r.getRelClass()), "relClass(es) must be equal"); - - setValidated(getValidated() || r.getValidated()); - try { - setValidationDate(ModelSupport.oldest(getValidationDate(), r.getValidationDate())); - } catch (ParseException e) { - throw new IllegalArgumentException(String - .format( - "invalid validation date format in relation [s:%s, t:%s]: %s", getSource(), getTarget(), - getValidationDate())); - } - } - @Override public boolean equals(Object o) { if (this == o) diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java deleted file mode 100644 index 1d12478..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/CleaningFunctions.java +++ /dev/null @@ -1,74 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; - -import org.apache.commons.lang3.StringUtils; - -import eu.dnetlib.dhp.schema.oaf.StructuredProperty; - -public class CleaningFunctions { - - public static final String DOI_PREFIX_REGEX = "(^10\\.|\\/10\\.)"; - public static final String DOI_PREFIX = "10."; - - public static final Set PID_BLACKLIST = new HashSet<>(); - - static { - PID_BLACKLIST.add("none"); - PID_BLACKLIST.add("na"); - } - - public CleaningFunctions() {} - - /** - * Utility method that filter PID values on a per-type basis. - * @param s the PID whose value will be checked. - * @return false if the pid matches the filter criteria, true otherwise. - */ - public static boolean pidFilter(StructuredProperty s) { - final String pidValue = s.getValue(); - if (Objects.isNull(s.getQualifier()) || - StringUtils.isBlank(pidValue) || - StringUtils.isBlank(pidValue.replaceAll("(?:\\n|\\r|\\t|\\s)", ""))) { - return false; - } - if (CleaningFunctions.PID_BLACKLIST.contains(pidValue)) { - return false; - } - return !PidBlacklistProvider.getBlacklist(s.getQualifier().getClassid()).contains(pidValue); - } - - /** - * Utility method that normalises PID values on a per-type basis. - * @param pid the PID whose value will be normalised. - * @return the PID containing the normalised value. - */ - public static StructuredProperty normalizePidValue(StructuredProperty pid) { - pid.setValue( - normalizePidValue( - pid.getQualifier().getClassid(), - pid.getValue())); - - return pid; - } - - public static String normalizePidValue(String pidType, String pidValue) { - String value = Optional - .ofNullable(pidValue) - .map(String::trim) - .orElseThrow(() -> new IllegalArgumentException("PID value cannot be empty")); - - switch (pidType) { - - // TODO add cleaning for more PID types as needed - case "doi": - return value.toLowerCase().replaceFirst(DOI_PREFIX_REGEX, DOI_PREFIX); - } - return value; - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java deleted file mode 100644 index aac2c8c..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java +++ /dev/null @@ -1,292 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import static com.google.common.base.Preconditions.checkArgument; -import static eu.dnetlib.dhp.schema.common.ModelConstants.*; - -import java.io.Serializable; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.lang3.StringUtils; - -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Maps; - -import eu.dnetlib.dhp.schema.common.ModelSupport; -import eu.dnetlib.dhp.schema.oaf.*; - -/** - * Factory class for OpenAIRE identifiers in the Graph - */ -public class IdentifierFactory implements Serializable { - - public static final String ID_SEPARATOR = "::"; - public static final String ID_PREFIX_SEPARATOR = "|"; - - public static final int ID_PREFIX_LEN = 12; - - /** - * Declares the associations PID_TYPE -> [DATASOURCE ID, NAME] considered authoritative for that PID_TYPE. - * The id of the record (source_::id) will be rewritten as pidType_::id) - */ - public static final Map> PID_AUTHORITY = Maps.newHashMap(); - - static { - PID_AUTHORITY.put(PidType.doi, HashBiMap.create()); - PID_AUTHORITY.get(PidType.doi).put(CROSSREF_ID, "Crossref"); - PID_AUTHORITY.get(PidType.doi).put(DATACITE_ID, "Datacite"); - PID_AUTHORITY.get(PidType.doi).put(ZENODO_OD_ID, "ZENODO"); - PID_AUTHORITY.get(PidType.doi).put(ZENODO_R3_ID, "Zenodo"); - - PID_AUTHORITY.put(PidType.pmc, HashBiMap.create()); - PID_AUTHORITY.get(PidType.pmc).put(EUROPE_PUBMED_CENTRAL_ID, "Europe PubMed Central"); - PID_AUTHORITY.get(PidType.pmc).put(PUBMED_CENTRAL_ID, "PubMed Central"); - - PID_AUTHORITY.put(PidType.pmid, HashBiMap.create()); - PID_AUTHORITY.get(PidType.pmid).put(EUROPE_PUBMED_CENTRAL_ID, "Europe PubMed Central"); - PID_AUTHORITY.get(PidType.pmid).put(PUBMED_CENTRAL_ID, "PubMed Central"); - - PID_AUTHORITY.put(PidType.arXiv, HashBiMap.create()); - PID_AUTHORITY.get(PidType.arXiv).put(ARXIV_ID, "arXiv.org e-Print Archive"); - - PID_AUTHORITY.put(PidType.w3id, HashBiMap.create()); - PID_AUTHORITY.get(PidType.w3id).put(ROHUB_ID, "ROHub"); - } - - /** - * Declares the associations PID_TYPE -> [DATASOURCE ID, PID SUBSTRING] considered as delegated authority for that - * PID_TYPE. Example, Zenodo is delegated to forge DOIs that contain the 'zenodo' word. - * - * If a record with the same id (same pid) comes from 2 data sources, the one coming from a delegated source wins. E.g. Zenodo records win over those from Datacite. - * See also https://code-repo.d4science.org/D-Net/dnet-hadoop/pulls/187 and the class dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/OafMapperUtils.java - */ - public static final Map> DELEGATED_PID_AUTHORITY = Maps.newHashMap(); - - static { - DELEGATED_PID_AUTHORITY.put(PidType.doi, new HashMap<>()); - DELEGATED_PID_AUTHORITY.get(PidType.doi).put(ZENODO_OD_ID, "zenodo"); - DELEGATED_PID_AUTHORITY.get(PidType.doi).put(ZENODO_R3_ID, "zenodo"); - DELEGATED_PID_AUTHORITY.put(PidType.w3id, new HashMap<>()); - DELEGATED_PID_AUTHORITY.get(PidType.w3id).put(ROHUB_ID, "ro-id"); - } - - /** - * Declares the associations PID_TYPE -> [DATASOURCE ID, NAME] whose records are considered enrichment for the graph. - * Their OpenAIRE ID is built from the declared PID type. Are merged with their corresponding record, identified by - * the same OpenAIRE id. - */ - public static final Map> ENRICHMENT_PROVIDER = Maps.newHashMap(); - - static { - ENRICHMENT_PROVIDER.put(PidType.doi, HashBiMap.create()); - ENRICHMENT_PROVIDER.get(PidType.doi).put(OPEN_APC_ID, OPEN_APC_NAME); - } - - public static Set delegatedAuthorityDatasourceIds() { - return DELEGATED_PID_AUTHORITY.values() - .stream() - .flatMap(m -> m.keySet().stream()) - .collect(Collectors.toCollection(HashSet::new)); - } - - public static List getPids(List pid, KeyValue collectedFrom) { - return pidFromInstance(pid, collectedFrom, true).distinct().collect(Collectors.toList()); - } - - public static String createDOIBoostIdentifier(T entity) { - if (entity == null) - return null; - - StructuredProperty pid = null; - if (entity.getPid() != null) { - pid = entity - .getPid() - .stream() - .filter(Objects::nonNull) - .filter(s -> s.getQualifier() != null && "doi".equalsIgnoreCase(s.getQualifier().getClassid())) - .filter(CleaningFunctions::pidFilter) - .findAny() - .orElse(null); - } else { - if (entity.getInstance() != null) { - pid = entity - .getInstance() - .stream() - .filter(i -> i.getPid() != null) - .flatMap(i -> i.getPid().stream()) - .filter(CleaningFunctions::pidFilter) - .findAny() - .orElse(null); - } - } - if (pid != null) - return idFromPid(entity, pid, true); - return null; - } - - /** - * Creates an identifier from the most relevant PID (if available) provided by a known PID authority in the given - * entity T. Returns entity.id when none of the PIDs meet the selection criteria is available. - * - * @param entity the entity providing PIDs and a default ID. - * @param the specific entity type. Currently Organization and Result subclasses are supported. - * @param md5 indicates whether should hash the PID value or not. - * @return an identifier from the most relevant PID, entity.id otherwise - */ - public static String createIdentifier(T entity, boolean md5) { - - checkArgument(StringUtils.isNoneBlank(entity.getId()), "missing entity identifier"); - - final Map> pids = extractPids(entity); - - return pids - .values() - .stream() - .flatMap(Set::stream) - .min(new PidComparator<>(entity)) - .map( - min -> Optional - .ofNullable(pids.get(min.getQualifier().getClassid())) - .map( - p -> p - .stream() - .sorted(new PidValueComparator()) - .findFirst() - .map(s -> idFromPid(entity, s, md5)) - .orElseGet(entity::getId)) - .orElseGet(entity::getId)) - .orElseGet(entity::getId); - } - - private static Map> extractPids(T entity) { - if (entity instanceof Result) { - return Optional - .ofNullable(((Result) entity).getInstance()) - .map(IdentifierFactory::mapPids) - .orElse(new HashMap<>()); - } else { - return entity - .getPid() - .stream() - .map(CleaningFunctions::normalizePidValue) - .filter(CleaningFunctions::pidFilter) - .collect( - Collectors - .groupingBy( - p -> p.getQualifier().getClassid(), - Collectors.mapping(p -> p, Collectors.toCollection(HashSet::new)))); - } - } - - private static Map> mapPids(List instance) { - return instance - .stream() - .map(i -> pidFromInstance(i.getPid(), i.getCollectedfrom(), false)) - .flatMap(Function.identity()) - .collect( - Collectors - .groupingBy( - p -> p.getQualifier().getClassid(), - Collectors.mapping(p -> p, Collectors.toCollection(HashSet::new)))); - } - - private static Stream pidFromInstance(List pid, KeyValue collectedFrom, - boolean mapHandles) { - return Optional - .ofNullable(pid) - .map( - pp -> pp - .stream() - // filter away PIDs provided by a DS that is not considered an authority for the - // given PID Type - .filter(p -> shouldFilterPidByCriteria(collectedFrom, p, mapHandles)) - .map(CleaningFunctions::normalizePidValue) - .filter(p -> isNotFromDelegatedAuthority(collectedFrom, p)) - .filter(CleaningFunctions::pidFilter)) - .orElse(Stream.empty()); - } - - - private static boolean shouldFilterPidByCriteria(KeyValue collectedFrom, StructuredProperty p, boolean mapHandles) { - final PidType pType = PidType.tryValueOf(p.getQualifier().getClassid()); - - if (Objects.isNull(collectedFrom)) { - return false; - } - - boolean isEnrich = Optional - .ofNullable(ENRICHMENT_PROVIDER.get(pType)) - .map(enrich -> enrich.containsKey(collectedFrom.getKey()) - || enrich.containsValue(collectedFrom.getValue())) - .orElse(false); - - boolean isAuthority = Optional - .ofNullable(PID_AUTHORITY.get(pType)) - .map(authorities -> authorities.containsKey(collectedFrom.getKey()) - || authorities.containsValue(collectedFrom.getValue())) - .orElse(false); - - return (mapHandles && pType.equals(PidType.handle)) || isEnrich || isAuthority; - } - - private static boolean isNotFromDelegatedAuthority(KeyValue collectedFrom, StructuredProperty p) { - final PidType pType = PidType.tryValueOf(p.getQualifier().getClassid()); - - final Map da = DELEGATED_PID_AUTHORITY.get(pType); - if (Objects.isNull(da)) { - return true; - } - if (!da.containsKey(collectedFrom.getKey())) { - return true; - } - return StringUtils.contains(p.getValue(), da.get(collectedFrom.getKey())); - } - - /** - * @see {@link IdentifierFactory#createIdentifier(Entity, boolean)} - */ - public static String createIdentifier(T entity) { - - return createIdentifier(entity, true); - } - - private static String idFromPid(T entity, StructuredProperty s, boolean md5) { - return idFromPid(ModelSupport.getIdPrefix(entity.getClass()), s.getQualifier().getClassid(), s.getValue(), md5); - } - - public static String idFromPid(String numericPrefix, String pidType, String pidValue, boolean md5) { - return new StringBuilder() - .append(numericPrefix) - .append(ID_PREFIX_SEPARATOR) - .append(createPrefix(pidType)) - .append(ID_SEPARATOR) - .append(md5 ? md5(pidValue) : pidValue) - .toString(); - } - - // create the prefix (length = 12) - private static String createPrefix(String pidType) { - StringBuilder prefix = new StringBuilder(StringUtils.left(pidType, ID_PREFIX_LEN)); - while (prefix.length() < ID_PREFIX_LEN) { - prefix.append("_"); - } - return prefix.substring(0, ID_PREFIX_LEN); - } - - public static String md5(final String s) { - try { - final MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(s.getBytes(StandardCharsets.UTF_8)); - return new String(Hex.encodeHex(md.digest())); - } catch (final Exception e) { - return null; - } - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java deleted file mode 100644 index ea40509..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ModelHardLimits.java +++ /dev/null @@ -1,24 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -public class ModelHardLimits { - - private ModelHardLimits() {} - - public static final String LAYOUT = "index"; - public static final String INTERPRETATION = "openaire"; - public static final String SEPARATOR = "-"; - - public static final int MAX_EXTERNAL_ENTITIES = 50; - public static final int MAX_AUTHORS = 200; - public static final int MAX_AUTHOR_FULLNAME_LENGTH = 1000; - public static final int MAX_TITLE_LENGTH = 5000; - public static final int MAX_TITLES = 10; - public static final int MAX_ABSTRACT_LENGTH = 150000; - public static final int MAX_INSTANCES = 10; - - public static String getCollectionName(String format) { - return format + SEPARATOR + LAYOUT + SEPARATOR + INTERPRETATION; - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/OrganizationPidComparator.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/OrganizationPidComparator.java deleted file mode 100644 index 3a6df29..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/OrganizationPidComparator.java +++ /dev/null @@ -1,38 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.Comparator; - -import eu.dnetlib.dhp.schema.oaf.StructuredProperty; - -public class OrganizationPidComparator implements Comparator { - - @Override - public int compare(StructuredProperty left, StructuredProperty right) { - - PidType lClass = PidType.tryValueOf(left.getQualifier().getClassid()); - PidType rClass = PidType.tryValueOf(right.getQualifier().getClassid()); - - if (lClass.equals(PidType.openorgs)) - return -1; - if (rClass.equals(PidType.openorgs)) - return 1; - - if (lClass.equals(PidType.GRID)) - return -1; - if (rClass.equals(PidType.GRID)) - return 1; - - if (lClass.equals(PidType.mag_id)) - return -1; - if (rClass.equals(PidType.mag_id)) - return 1; - - if (lClass.equals(PidType.urn)) - return -1; - if (rClass.equals(PidType.urn)) - return 1; - - return 0; - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklist.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklist.java deleted file mode 100644 index 0b8e5e3..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklist.java +++ /dev/null @@ -1,8 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.HashMap; -import java.util.HashSet; - -public class PidBlacklist extends HashMap> { -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java deleted file mode 100644 index 3bcd0ab..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidBlacklistProvider.java +++ /dev/null @@ -1,39 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.io.IOException; -import java.util.HashSet; -import java.util.Optional; -import java.util.Set; - -import org.apache.commons.io.IOUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class PidBlacklistProvider { - - private static final PidBlacklist blacklist; - - static { - try { - String json = IOUtils.toString(IdentifierFactory.class.getResourceAsStream("pid_blacklist.json")); - blacklist = new ObjectMapper().readValue(json, PidBlacklist.class); - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static PidBlacklist getBlacklist() { - return blacklist; - } - - public static Set getBlacklist(String pidType) { - return Optional - .ofNullable(getBlacklist().get(pidType)) - .orElse(new HashSet<>()); - } - - private PidBlacklistProvider() {} - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidComparator.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidComparator.java deleted file mode 100644 index 7a5d560..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidComparator.java +++ /dev/null @@ -1,48 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.Comparator; - -import eu.dnetlib.dhp.schema.common.ModelSupport; -import eu.dnetlib.dhp.schema.oaf.Entity; -import eu.dnetlib.dhp.schema.oaf.Organization; -import eu.dnetlib.dhp.schema.oaf.Result; -import eu.dnetlib.dhp.schema.oaf.StructuredProperty; - -public class PidComparator implements Comparator { - - private final T entity; - - public PidComparator(T entity) { - this.entity = entity; - } - - @Override - public int compare(StructuredProperty left, StructuredProperty right) { - - if (left == null && right == null) - return 0; - if (left == null) - return 1; - if (right == null) - return -1; - - if (ModelSupport.isSubClass(entity, Result.class)) { - return compareResultPids(left, right); - } - if (ModelSupport.isSubClass(entity, Organization.class)) { - return compareOrganizationtPids(left, right); - } - - // Else (but unlikely), lexicographical ordering will do. - return left.getQualifier().getClassid().compareTo(right.getQualifier().getClassid()); - } - - private int compareResultPids(StructuredProperty left, StructuredProperty right) { - return new ResultPidComparator().compare(left, right); - } - - private int compareOrganizationtPids(StructuredProperty left, StructuredProperty right) { - return new OrganizationPidComparator().compare(left, right); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidType.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidType.java deleted file mode 100644 index 392bc02..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidType.java +++ /dev/null @@ -1,79 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import org.apache.commons.lang3.EnumUtils; - -public enum PidType { - - /** - * The DOI syntax shall be made up of a DOI prefix and a DOI suffix separated by a forward slash. - * - * There is no defined limit on the length of the DOI name, or of the DOI prefix or DOI suffix. - * - * The DOI name is case-insensitive and can incorporate any printable characters from the legal graphic characters - * of Unicode. Further constraints on character use (e.g. use of language-specific alphanumeric characters) can be - * defined for an application by the ISO 26324 Registration Authority. - * - * - * DOI prefix: The DOI prefix shall be composed of a directory indicator followed by a registrant code. - * These two components shall be separated by a full stop (period). The directory indicator shall be "10" and - * distinguishes the entire set of character strings (prefix and suffix) as digital object identifiers within the - * resolution system. - * - * Registrant code: The second element of the DOI prefix shall be the registrant code. The registrant code is a - * unique string assigned to a registrant. - * - * DOI suffix: The DOI suffix shall consist of a character string of any length chosen by the registrant. - * Each suffix shall be unique to the prefix element that precedes it. The unique suffix can be a sequential number, - * or it might incorporate an identifier generated from or based on another system used by the registrant - * (e.g. ISAN, ISBN, ISRC, ISSN, ISTC, ISNI; in such cases, a preferred construction for such a suffix can be - * specified, as in Example 1). - * - * Source: https://www.doi.org/doi_handbook/2_Numbering.html#2.2 - */ - doi, - - /** - * PubMed Unique Identifier (PMID) - * - * This field is a 1-to-8 digit accession number with no leading zeros. It is present on all records and is the - * accession number for managing and disseminating records. PMIDs are not reused after records are deleted. - * - * Beginning in February 2012 PMIDs include extensions following a decimal point to account for article versions - * (e.g., 21804956.2). All citations are considered version 1 until replaced. The extended PMID is not displayed - * on the MEDLINE format. - * - * View the citation in abstract format in PubMed to access additional versions when available (see the article in - * the Jan-Feb 2012 NLM Technical Bulletin). - * - * Source: https://www.nlm.nih.gov/bsd/mms/medlineelements.html#pmid - */ - pmid, - - /** - * This field contains the unique identifier for the cited article in PubMed Central. The identifier begins with the - * prefix PMC. - * - * Source: https://www.nlm.nih.gov/bsd/mms/medlineelements.html#pmc - */ - pmc, handle, arXiv, nct, pdb, w3id, - - // Organization - openorgs, corda, corda_h2020, GRID, mag_id, urn, - - // Used by dedup - undefined, original; - - public static boolean isValid(String type) { - return EnumUtils.isValidEnum(PidType.class, type); - } - - public static PidType tryValueOf(String s) { - try { - return PidType.valueOf(s); - } catch (Exception e) { - return PidType.original; - } - } - -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidValueComparator.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidValueComparator.java deleted file mode 100644 index 0e20835..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/PidValueComparator.java +++ /dev/null @@ -1,33 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.Comparator; -import java.util.Optional; - -import eu.dnetlib.dhp.schema.oaf.StructuredProperty; - -public class PidValueComparator implements Comparator { - - @Override - public int compare(StructuredProperty left, StructuredProperty right) { - - if (left == null && right == null) - return 0; - if (left == null) - return 1; - if (right == null) - return -1; - - StructuredProperty l = CleaningFunctions.normalizePidValue(left); - StructuredProperty r = CleaningFunctions.normalizePidValue(right); - - return Optional - .ofNullable(l.getValue()) - .map( - lv -> Optional - .ofNullable(r.getValue()) - .map(rv -> lv.compareTo(rv)) - .orElse(-1)) - .orElse(1); - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultPidComparator.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultPidComparator.java deleted file mode 100644 index e51c480..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultPidComparator.java +++ /dev/null @@ -1,53 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.Comparator; - -import eu.dnetlib.dhp.schema.oaf.StructuredProperty; - -public class ResultPidComparator implements Comparator { - - @Override - public int compare(StructuredProperty left, StructuredProperty right) { - - PidType lClass = PidType.tryValueOf(left.getQualifier().getClassid()); - PidType rClass = PidType.tryValueOf(right.getQualifier().getClassid()); - - if (lClass.equals(PidType.doi)) - return -1; - if (rClass.equals(PidType.doi)) - return 1; - - if (lClass.equals(PidType.pmid)) - return -1; - if (rClass.equals(PidType.pmid)) - return 1; - - if (lClass.equals(PidType.pmc)) - return -1; - if (rClass.equals(PidType.pmc)) - return 1; - - if (lClass.equals(PidType.handle)) - return -1; - if (rClass.equals(PidType.handle)) - return 1; - - if (lClass.equals(PidType.arXiv)) - return -1; - if (rClass.equals(PidType.arXiv)) - return 1; - - if (lClass.equals(PidType.nct)) - return -1; - if (rClass.equals(PidType.nct)) - return 1; - - if (lClass.equals(PidType.pdb)) - return -1; - if (rClass.equals(PidType.pdb)) - return 1; - - return 0; - } -} diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java deleted file mode 100644 index a233ae7..0000000 --- a/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/ResultTypeComparator.java +++ /dev/null @@ -1,77 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import static eu.dnetlib.dhp.schema.common.ModelConstants.CROSSREF_ID; - -import java.util.Comparator; -import java.util.HashSet; -import java.util.Optional; -import java.util.stream.Collectors; - -import eu.dnetlib.dhp.schema.common.ModelConstants; -import eu.dnetlib.dhp.schema.oaf.KeyValue; -import eu.dnetlib.dhp.schema.oaf.Result; - -public class ResultTypeComparator implements Comparator { - - @Override - public int compare(Result left, Result right) { - - if (left == null && right == null) - return 0; - if (left == null) - return 1; - if (right == null) - return -1; - - HashSet lCf = getCollectedFromIds(left); - HashSet rCf = getCollectedFromIds(right); - - if (lCf.contains(CROSSREF_ID) && !rCf.contains(CROSSREF_ID)) { - return -1; - } - if (!lCf.contains(CROSSREF_ID) && rCf.contains(CROSSREF_ID)) { - return 1; - } - - String lClass = left.getResulttype(); - String rClass = right.getResulttype(); - - if (lClass.equals(rClass)) - return 0; - - if (lClass.equals(ModelConstants.PUBLICATION_RESULTTYPE_CLASSID)) - return -1; - if (rClass.equals(ModelConstants.PUBLICATION_RESULTTYPE_CLASSID)) - return 1; - - if (lClass.equals(ModelConstants.DATASET_RESULTTYPE_CLASSID)) - return -1; - if (rClass.equals(ModelConstants.DATASET_RESULTTYPE_CLASSID)) - return 1; - - if (lClass.equals(ModelConstants.SOFTWARE_RESULTTYPE_CLASSID)) - return -1; - if (rClass.equals(ModelConstants.SOFTWARE_RESULTTYPE_CLASSID)) - return 1; - - if (lClass.equals(ModelConstants.ORP_RESULTTYPE_CLASSID)) - return -1; - if (rClass.equals(ModelConstants.ORP_RESULTTYPE_CLASSID)) - return 1; - - // Else (but unlikely), lexicographical ordering will do. - return lClass.compareTo(rClass); - } - - protected HashSet getCollectedFromIds(Result left) { - return Optional - .ofNullable(left.getCollectedfrom()) - .map( - cf -> cf - .stream() - .map(KeyValue::getKey) - .collect(Collectors.toCollection(HashSet::new))) - .orElse(new HashSet<>()); - } -} diff --git a/src/main/resources/eu/dnetlib/dhp/schema/oaf/utils/pid_blacklist.json b/src/main/resources/eu/dnetlib/dhp/schema/oaf/utils/pid_blacklist.json deleted file mode 100644 index 05e8cde..0000000 --- a/src/main/resources/eu/dnetlib/dhp/schema/oaf/utils/pid_blacklist.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "doi" : [ "10.12739/10.12739", "10.11646/zootaxa.4404.1.1", "10.5281/zenodo.3678492", "10.11646/zootaxa.4757.1.1", "10.17176/20170811-142447", "10.6035/asparkia", "10.11646/zootaxa.4754.1.6", "10.11646/zootaxa.4784.1.1", "10.6035/millars", "10.11646/zootaxa.4776.1.1", "10.1590/1982-0224-20170094", "10.11646/zootaxa.4773.1.1", "10.11646/zootaxa.4744.1.1", "10.3897/zookeys.38.383", "10.1371/journal.", "10.5281/zenodo.3727017", "10.5252/zoosystema2019v41a15", "10.6035/dossiersf", "10.11646/zootaxa.4754.1.20", "10.6035/recerca", "10.11646/zootaxa.4428.1.1", "10.7179/psri", "10.11646/zootaxa.4785.1.1", "10.2478/aemnp-2018-0014", "10.17979/spudc.9788497497565", "10.2139/ssrn.2721313", "10.17979/spudc.9788497497749", "10.5281/zenodo.3760976", "10.11646/zootaxa.4381.1.1", "10.6035/tiempos", "10.11646/zootaxa.4754.1.10", "10.5281/zenodo.3776452", "10.11646/zootaxa.4754.1.16", "10.5252/zoosystema2019v41a26", "10.11646/zootaxa.4759.2.1", "10.11646/zootaxa.4741.1.1", "10.5252/zoosystema2019v41a4", "10.1145/nnnnnnn.nnnnnnn", "10.17979/spudc.9788497497169", "10.11646/zootaxa.4780.3.1", "10.11646/zootaxa.4663.1.1", "10.5281/zenodo.3748525", "10.5281/zenodo.3746744", "10.3920/978-90-8686-761-5", "10.14198/eurau18alicante", "10.5252/geodiversitas2019v41a8", "10.4126/38m-0000003", "10.5281/zenodo.3648511", "10.6035/clr", "10.4126/38m-0000004", "10.5281/zenodo.3732535", "10.5281/zenodo.3355776", "10.4126/38m-0000002", "10.11646/zootaxa.4763.3.3", "10.11646/zootaxa.4413.3.1", "10.1163/9789004416208_005", "10.4126/38m-0000001", "10.3897/zookeys.30.308", "10.4126/38m-0000000", "10.5281/zenodo.3739808", "10.5281/zenodo.3674873", "10.3161/00034541anz2020.70.1.003", "10.5281/zenodo.3738648", "10.11646/zootaxa.4765.1.1", "10.11646/zootaxa.4754.1.8", "10.3897/zookeys.36.306", "10.4230/lipics", "10.5281/zenodo.3758345", "10.3161/00034541anz2020.70.1.001", "10.3929/ethz-a-005427569", "10.11646/zootaxa.4772.1.1", "10.5281/zenodo.3677235", "10.11646/zootaxa.4766.1.1", "10.17509/jurnal", "10.1145/1235", "10.11646/zootaxa.4754.1.15", "10.2478/aemnp-2018-0018", "10.11646/zootaxa.4538.1.1", "10.11646/zootaxa.4740.1.1", "10.3897/zookeys.32.282", "10.3897/zookeys.2.56", "10.3897/zookeys.39.425", "10.11646/zootaxa.4514.3.3", "10.1007/978-94-007-1966-8", "10.3897/zookeys.26.214", "10.11646/zootaxa.4106.1.1", "10.3897/zookeys.22.219", "10.11646/zootaxa.4748.2.1", "10.5252/zoosystema2019v41a19", "10.3897/zookeys.22.122", "10.1080/00222933.2019.1634225", "10.11646/zootaxa.4632.1.1", "10.1007/s00259-016-3484-4", "10.3897/zookeys.19.221", "10.3897/zookeys.2.7", "10.11646/zootaxa.4777.1.1", "10.14279/depositonce-3753", "10.1111/apha.12712", "10.11646/zootaxa.4759.3.4", "10.11646/zootaxa.4754.1.9", "10.11646/zootaxa.4747.2.8", "10.5281/zenodo.3757451", "10.5281/zenodo.3740269", "10.5252/zoosystema2020v42a4", "10.1140/epje/i2013-13103-3", "10.1177/0301006619863862", "10.5281/zenodo.3726987", "10.12795/hid", "10.24042/jipf", "10.12795/e-rips", "10.1186/s12913-016-1423-5", "10.4126/38m-0000005", "10.3847/2041-8213/aa91c9", "10.1145/1122445.1122456", "10.1103/physrevlett.114.191803", "10.3920/978-90-8686-782-0", "10.11646/zootaxa.4739.1.1", "10.11646/zootaxa.4770.1.1", "10.21009/10.21009/jpd.081", "10.1080/15548627.2015.1100356", "10.12795/ricl", "10.3897/zookeys.34.309", "10.1080/00222933.2019.1692088", "10.4126/frl01-0064002", "10.1371/journal", "10.1175/1520-0485(2002)032", "10.3897/zookeys.22.152", "10.11646/zootaxa.4731.2.1", "10.4126/frl01-0064005", "10.11646/zootaxa.4738.1.1", "10.11646/zootaxa.4780.1.6", "10.4126/frl01-0064004", "10.6018/analesps.31.1.158071", "10.1007/jhep08(2016)045", "10.5281/zenodo.3759519", "10.4126/frl01-0064010", "10.11646/zootaxa.4537.1.1", "10.5281/zenodo.3713533", "10.5281/zenodo.3742020", "10.4126/frl01-0064014", "10.4126/frl01-0064001", "10.1000/isbn", "10.5281/zenodo.3777290", "10.4126/frl01-0064008", "10.1159/000440895", "10.3897/zookeys.31.140", "10.4126/frl01-0064003", "10.1080/00222933.2018.1524032", "10.21686/2500-3925-2014-6", "10.1016/j.bbr.2011.03.031", "10.4126/frl01-0064006", "10.4126/frl01-0064007", "10.4126/frl01-0064020", "10.4126/frl01-0064016", "10.2478/aemnp-2018-0013", "10.4126/frl01-0064021", "10.5281/zenodo.3754300", "10.15330/gal.29-30.", "10.3897/zookeys.2.4", "10.5252/zoosystema2019v41a7", "10.22435/bpk.v17i2", "10.4126/frl01-0063997", "10.3897/zookeys.11.160", "10.11646/zootaxa.4754.1.14", "10.4126/frl01-0064013", "10.1080/20013078.2018.1535750", "10.1016/j.", "10.4126/frl01-0064011", "10.1002/ece3.2579", "10.1088/0264-9381/28/9/094001", "10.3897/zookeys.2.25", "10.4126/frl01-0064019", "10.4126/frl01-0063994", "10.4126/frl01-0064135", "10.4126/frl01-0063998", "10.12795/ppa", "10.4126/frl01-0064009", "10.11646/zootaxa.4769.1.1", "10.11646/zootaxa.4419.1.1", "10.11646/zootaxa.4733.1.1", "10.4126/frl01-0063993", "10.3161/15081109acc2016.18.1.005", "10.11646/zootaxa.4763.1.2", "10.11646/zootaxa.4754.1.19", "10.4126/frl01-0064136", "10.4126/frl01-0064159", "10.4126/frl01-0063999", "10.4126/frl01-0064161", "10.1089/ten.tea.2015.5000.abstracts", "10.1002/(issn)1521-3773", "10.1140/epjc/s10052-015-3325-9", "10.1016/j.physletb.2016.04.050", "10.1007/jhep04(2015)117", "10.1111/gcb.14904", "10.1016/s0140-6736(17)32129-3", "10.11646/zootaxa.4748.1.1", "10.4126/frl01-0064078", "10.1140/epjc/s10052-015-3408-7", "10.1002/(issn)1097-4652", "10.1007/jhep06(2015)121", "10.1007/jhep09(2014)103", "10.1016/j.gca.2007.06.021", "10.1007/jhep09(2015)049", "10.3897/zookeys.4.32", "10.6101/azq/0002", "10.11646/zootaxa.4764.1.1", "10.11646/zootaxa.4772.1.5", "10.4126/frl01-0064000", "10.4126/frl01-0064131", "10.1016/j.physletb.2015.08.061", "10.1007/jhep01(2015)069", "10.1016/j.physletb.2016.06.039", "10.1016/j.physletb.2015.07.011", "10.1007/jhep04(2015)116", "10.3920/978-90-8686-797-4", "10.1016/j.physletb.2015.12.020", "10.1016/j.physletb.2015.04.042", "10.1016/j.physletb.2016.06.004", "10.1140/epjc/s10052-015-3261-8", "10.1016/j.physletb.2015.10.067", "10.1016/j.physletb.2015.07.065", "10.1163/1876312x-00002195", "10.1016/j.physletb.2013.12.010", "10.1016/j.physletb.2013.01.024", "10.1007/jhep11(2014)056", "10.1007/jhep12(2017)142", "10.1002/pds.4864", "10.1140/epjc/s10052-015-3262-7", "10.1016/j.physletb.2014.09.054", "10.1140/epjc/s10052-015-3373-1", "10.1007/jhep03(2015)041", "10.1016/j.physletb.2016.02.047", "10.4126/frl01-0064018", "10.1016/j.physletb.2014.01.042", "10.1007/jhep09(2014)037", "10.1007/978-94-017-7285-3", "10.1007/s00424-013-1401-2", "10.1007/s00259-017-3822-1", "10.1177/0301006616671273", "10.1007/jhep09(2014)112", "10.1007/jhep06(2015)116", "10.1140/epjc/s10052-018-6243-9", "10.1140/epjc/s10052-017-4692-1", "10.1007/jhep10(2015)144", "10.1007/jhep07(2017)107", "10.1007/jhep11(2014)088", "10.1016/j.physletb.2014.01.006", "10.1007/jhep01(2018)055", "10.1016/j.physletb.2016.03.060", "10.1140/epjc/s10052-019-6904-3", "10.11646/zootaxa.4737.1.1", "10.3934/xx.xx.xx.xx", "10.11646/zootaxa.4758.2.1", "10.1016/j.physletb.2015.10.004", "10.1016/j.physletb.2015.07.053", "10.5798/diclemedj.0921.2012.04.0184", "10.1007/jhep04(2014)169", "10.4126/frl01-0064160", "10.3989/aem.2001.v31.i2", "10.1039/x0xx00000x", "10.11646/zootaxa.3856.4.1", "10.4126/frl01-0064133", "10.1007/jhep05(2015)078", "10.1016/j.physletb.2012.08.020", "10.1007/jhep07(2015)032", "10.1159/000090218", "10.1016/j.physletb.2014.03.015", "10.1007/jhep09(2015)108", "10.1007/jhep09(2015)050", "10.1007/jhep01(2014)163", "10.1016/j.physletb.2014.11.026", "10.1140/epjc/s10052-016-4580-0", "10.1140/epjc/s10052-014-3109-7", "10.1140/epjc/s10052-014-3231-6", "10.1007/jhep02(2014)088", "10.1016/j.physletb.2016.01.056", "10.1016/j.physletb.2015.08.047", "10.1016/j.physletb.2015.12.039", "10.1007/jhep11(2015)071", "10.1140/epjc/s10052-015-3853-3", "10.1007/jhep04(2015)124", "10.1016/j.physletb.2015.07.010", "10.5281/zenodo.3413524", "10.1007/jhep04(2014)031", "10.1007/jhep07(2015)157", "10.1103/physrevd.90.052008", "10.1007/jhep11(2014)118", "10.3920/978-90-8686-708-0", "10.5281/zenodo.1136235", "10.1103/physrevd.86.032003", "10.1016/j.physletb.2016.01.032", "10.1007/jhep03(2018)174", "10.1007/jhep10(2017)182", "10.1140/epjst/e2019-900045-4", "10.1016/j.physletb.2015.06.070", "10.1140/epjc/s10052-016-4067-z", "10.1016/j.physletb.2015.11.042", "10.1007/jhep04(2018)033", "10.1007/jhep09(2014)145", "10.1016/j.physletb.2016.08.055", "10.1016/j.physletb.2015.04.002", "10.1007/jhep03(2014)032", "10.1140/epjc/s10052-017-5491-4", "10.1016/j.physletb.2015.09.062", "10.1016/j.physletb.2014.12.003", "10.1016/j.physletb.2015.03.017", "10.1140/epjc/s10052-014-3195-6", "10.1140/epjc/s10052-016-4034-8", "10.1140/epjc/s10052-016-4070-4", "10.1140/epjc/s10052-018-5693-4", "10.4126/frl01-0064017", "10.1007/jhep08(2014)173", "10.1016/j.physletb.2014.06.076", "10.1016/j.physletb.2018.11.064", "10.1140/epjc/s10052-017-4988-1", "10.11646/zootaxa.4258.4.3", "10.11646/zootaxa.4766.1.2", "10.11646/zootaxa.4780.1.1", "10.5281/zenodo.3693943", "10.4126/frl01-0064129", "10.15330/gal.28.", "10.1007/jhep02(2016)145", "10.1007/jhep04(2014)172", "10.1007/jhep04(2016)005", "10.1007/jhep03(2016)125", "10.1016/j.physletb.2018.02.033", "10.1007/jhep08(2017)052", "10.1007/jhep12(2017)085", "10.1007/jhep09(2014)176", "10.1007/jhep12(2017)024", "10.1140/epjc/s10052-018-5686-3", "10.1016/j.physletb.2016.11.035", "10.1016/j.physletb.2015.12.017", "10.1140/epjc/s10052-015-3542-2", "10.1140/epjc/s10052-014-3071-4", "10.1103/physrevd.97.032009", "10.1140/epjc/s10052-015-3306-z", "10.1016/j.physletb.2017.12.043", "10.1140/epjc/s10052-014-3233-4", "10.1016/j.physletb.2018.09.013", "10.1016/j.gca.2007.06.014", "10.1016/j.physletb.2016.05.005", "10.1038/s41586-019-1171-x", "10.1016/j.physletb.2016.05.087", "10.1007/jhep06(2018)022", "10.1016/j.physletb.2016.01.057", "10.1016/j.physletb.2018.03.023", "10.1140/epjc/s10052-015-3351-7", "10.1126/science.aap8757", "10.1007/jhep09(2015)137", "10.1007/jhep01(2015)063", "10.1007/jhep01(2018)126", "10.1016/j.gca.2007.06.020", "10.1140/epjc/s10052-018-5595-5", "10.1016/j.physletb.2015.02.015", "10.1016/j.physletb.2014.06.077", "10.1007/jhep12(2017)059", "10.1007/jhep10(2017)141", "10.1007/jhep02(2014)107", "10.1140/epjc/s10052-014-2965-5", "10.1016/j.physletb.2015.07.079", "10.1007/jhep10(2017)112", "10.1140/epjc/s10052-014-2982-4", "10.1007/jhep05(2016)160", "10.1016/j.physletb.2016.07.030", "10.1140/epjc/s10052-014-3168-9", "10.1140/epjc/s10052-018-5583-9", "10.1140/epjc/s10052-016-4184-8", "10.1007/jhep08(2015)105", "10.1007/jhep05(2015)061", "10.1103/physrevd.97.032003", "10.1140/epjc/s10052-014-3190-y", "10.1016/j.physletb.2012.10.061", "10.1140/epjc/s10052-014-2941-0", "10.1016/j.physletb.2016.02.002", "10.1016/j.physletb.2016.05.033", "10.1007/jhep01(2014)096", "10.1007/jhep09(2015)201", "10.1016/j.physletb.2016.01.010", "10.1016/j.physletb.2015.07.037", "10.1007/jhep07(2015)042", "10.1016/j.physletb.2016.05.044", "10.1016/j.physletb.2016.05.088", "10.3897/zookeys.2.2", "10.1007/jhep11(2015)018", "10.1007/jhep11(2015)189", "10.1016/j.physletb.2016.10.014", "10.1007/jhep06(2015)080", "10.1016/j.physletb.2014.11.042", "10.1140/epjc/s10052-014-3157-z", "10.1140/epjc/s10052-015-3406-9", "10.1016/j.physletb.2016.02.056", "10.1016/j.physletb.2015.03.054", "10.1140/epjc/s10052-016-4574-y", "10.5252/geodiversitas2019v41a15", "10.1007/jhep09(2014)094", "10.1140/epjc/s10052-017-5486-1", "10.1007/jhep03(2018)095", "10.11646/zootaxa.4736.1.1", "10.11646/zootaxa.4766.2.1", "10.5281/zenodo.3762392", "10.5281/zenodo.3761958", "10.11646/zootaxa.4403.3.2", "10.1553/iswimab", "10.11646/zootaxa.3750.5.1", "10.4126/frl01-0064134", "10.1103/physrevd.87.032002", "10.1140/epjc/s10052-013-2676-3", "10.1007/jhep02(2015)153", "10.1007/jhep08(2017)006", "10.1016/j.physletb.2016.11.005", "10.1007/jhep01(2013)029", "10.1007/jhep10(2017)132", "10.1016/j.physletb.2013.01.034", "10.1016/j.physletb.2016.03.046", "10.1140/epjc/s10052-016-3988-x", "10.1016/j.physletb.2016.07.006", "10.1140/epjc/s10052-018-5752-x", "10.1140/epjc/s10052-015-3454-1", "10.1002/ece3.1303", "10.1007/jhep02(2014)013", "10.1007/jhep06(2016)081", "10.1140/epjc/s10052-014-3117-7", "10.1007/jhep09(2017)084", "10.1016/j.physletb.2017.09.078", "10.1007/jhep08(2016)005", "10.1007/jhep01(2015)020", "10.1140/epjc/s10052-017-4852-3", "10.1016/j.physletb.2018.02.045", "10.7818/sibecolandaeetmeeting.2019", "10.1007/jhep11(2014)104", "10.1007/jhep05(2018)077", "10.1016/j.physletb.2016.11.045", "10.1016/j.physletb.2016.10.042", "10.1140/epjc/s10052-016-4203-9", "10.1007/jhep01(2015)068", "10.1007/jhep06(2016)093", "10.1016/j.physletb.2015.09.051", "10.1140/epjc/s10052-015-3534-2", "10.1007/jhep09(2014)087", "10.1016/j.physletb.2014.05.055", "10.1016/j.physletb.2014.02.033", "10.1140/epjc/s10052-017-5225-7", "10.1140/epjc/s10052-017-5442-0", "10.1016/s0140-6736(18)32335-3", "10.1016/j.physletb.2017.11.049", "10.1007/jhep06(2018)166", "10.1016/j.physletb.2016.05.002", "10.1140/epjc/s10052-016-4219-1", "10.1140/epjst/e2019-900087-0", "10.1007/jhep01(2016)166", "10.1007/jhep01(2018)097", "10.1016/j.physletb.2017.11.043", "10.1016/j.physletb.2018.04.036", "10.1140/epjc/s10052-018-5607-5", "10.1007/jhep12(2017)034", "10.1007/jhep11(2016)112", "10.1007/jhep06(2014)008", "10.1140/epjc/s10052-012-2261-1", "10.1016/j.physletb.2014.08.039", "10.1016/s0140-6736(16)31919-5", "10.1140/epjc/s10052-019-7058-z", "10.1016/j.physletb.2014.07.053", "10.1007/jhep01(2015)053", "10.1016/j.physletb.2016.07.042", "10.1007/jhep08(2014)103", "10.1007/jhep06(2015)100", "10.1140/epjc/s10052-015-3363-3", "10.1140/epjc/s10052-017-4915-5", "10.1140/epjc/s10052-014-3023-z", "10.1140/epjc/s10052-017-5315-6", "10.1140/epjc/s10052-016-4050-8", "10.3389/fpsyt.2017.00244", "10.1016/j.physletb.2014.10.002", "10.1007/jhep07(2015)162", "10.1007/jhep08(2014)174", "10.3897/zookeys.2.23", "10.1007/jhep07(2017)014", "10.1007/jhep04(2016)035", "10.1140/epjc/s10052-017-4984-5", "10.1007/jhep02(2016)156", "10.1016/j.physletb.2016.03.039", "10.1007/jhep07(2018)115", "10.3897/zookeys.34.268", "10.1007/jhep02(2016)122", "10.1016/j.physletb.2012.03.022", "10.1016/j.physletb.2018.09.019", "10.1016/j.physletb.2018.09.024", "10.1051/0004-6361/201629272", "10.1103/physrevc.97.024904", "10.1140/epjc/s10052-016-4521-y", "10.1140/epjc/s10052-016-4176-8", "10.1140/epjc/s10052-014-3134-6", "10.1140/epjc/s10052-016-4110-0", "10.1007/jhep07(2017)121", "10.1007/jhep07(2018)153", "10.1007/jhep03(2018)115", "10.1007/jhep04(2018)060", "10.11606/1807-0205/2020.60.06", "10.4126/frl01-0064015", "10.1007/jhep09(2017)020", "10.1016/j.physletb.2014.04.023", "10.1016/j.physletb.2015.02.048", "10.1007/jhep02(2018)032", "10.1016/j.physletb.2018.01.001", "10.1140/epjc/s10052-015-3852-4", "10.1007/jhep10(2014)087", "10.11646/zootaxa.4630.1.1", "10.5281/zenodo.3742118", "10.4126/frl01-0064022", "10.11646/zootaxa.4758.3.1", "10.11646/zootaxa.4772.3.1", "10.11646/zootaxa.4576.3.5", "10.4126/frl01-0064125", "10.1007/jhep12(2017)017", "10.4126/frl01-0064162", "10.4126/frl01-0064138", "10.1007/jhep06(2014)124", "10.1007/jhep06(2016)059", "10.1007/jhep06(2014)035", "10.1103/physrevd.90.052005", "10.1007/jhep11(2017)062", "10.3847/2041-8213/aa9aed", "10.1016/j.physletb.2016.06.080", "10.1007/jhep10(2017)073", "10.1007/jhep03(2018)167", "10.1016/j.physletb.2018.11.065", "10.1140/epjc/s10052-017-5081-5", "10.1140/epjc/s10052-015-3500-z", "10.1140/epjc/s10052-017-5445-x", "10.1016/j.physletb.2014.01.049", "10.1007/jhep03(2018)172", "10.1016/j.physletb.2015.03.048", "10.1016/j.physletb.2018.11.032", "10.1007/jhep05(2018)025", "10.1016/j.physletb.2016.08.052", "10.1016/j.physletb.2014.09.008", "10.1103/physrevlett.120.071802", "10.1016/j.physletb.2018.01.049", "10.1016/j.physletb.2016.06.017", "10.1016/j.physletb.2016.04.005", "10.1007/jhep06(2018)031", "10.1007/jhep01(2016)079", "10.1007/jhep10(2017)006", "10.1140/epjc/s10052-018-5740-1", "10.1016/j.physletb.2015.01.034", "10.1007/jhep10(2017)005", "10.1016/j.physletb.2018.04.007", "10.1007/jhep04(2015)164", "10.1140/epjc/s10052-018-5691-6", "10.1007/jhep05(2018)148", "10.1007/jhep03(2018)003", "10.1140/epjc/s10052-014-3076-z", "10.1016/j.physletb.2016.02.015", "10.1103/physrevd.97.072003", "10.1016/j.physletb.2017.11.054", "10.1140/epjc/s10052-011-1849-1", "10.1007/jhep09(2016)175", "10.1016/j.physletb.2017.12.011", "10.1007/jhep04(2014)103", "10.1007/jhep12(2014)017", "10.1016/j.physletb.2014.09.048", "10.1140/epjc/s10052-019-7202-9", "10.1007/jhep04(2014)191", "10.1007/jhep07(2013)163", "10.1140/epjc/s10052-014-3130-x", "10.1007/jhep04(2016)023", "10.1016/j.physletb.2015.07.023", "10.1140/epjc/s10052-018-6500-y", "10.1016/j.physletb.2015.04.045", "10.1007/jhep09(2017)053", "10.1007/jhep10(2017)180", "10.1140/epjc/s10052-017-4912-8", "10.1007/jhep10(2016)129", "10.3920/978-90-8686-816-2", "10.1007/jhep01(2017)099", "10.1007/jhep01(2018)045", "10.1007/jhep04(2015)025", "10.1016/j.physletb.2018.02.050", "10.1103/physrevlett.116.032301", "10.1007/jhep08(2017)029", "10.1007/jhep08(2017)073", "10.1016/j.physletb.2014.11.059", "10.1007/jhep01(2013)131", "10.1007/jhep06(2014)112", "10.1016/j.physletb.2017.09.066", "10.1140/epjc/s10052-014-2883-6", "10.1094/mpmi", "10.1007/jhep11(2017)195", "10.1007/jhep06(2018)108", "10.1007/jhep09(2018)139", "10.1016/j.physletb.2016.12.005", "10.1140/epjc/s10052-017-5349-9", "10.1016/j.physletb.2012.08.021", "10.1016/j.physletb.2014.10.032", "10.1007/jhep09(2017)088", "10.1140/epjc/s10052-015-3425-6", "10.1007/jhep01(2018)054", "10.1103/physrevlett.110.182302", "10.1140/epjc/s10052-017-5317-4", "10.1007/jhep01(2017)117", "10.1016/j.physletb.2017.12.006", "10.1016/j.physletb.2018.02.004", "10.1016/j.physletb.2018.02.025", "10.1016/j.physletb.2016.02.055", "10.1016/j.physletb.2016.04.061", "10.1140/epjc/s10052-015-3372-2", "10.1016/j.physletb.2015.02.051", "10.1016/j.physletb.2014.11.049", "10.1007/jhep09(2016)001", "10.1016/j.physletb.2016.03.017", "10.1007/jhep06(2016)067", "10.1140/epjc/s10052-015-3543-1", "10.1140/epjc/s10052-017-4911-9", "10.1007/jhep07(2013)122", "10.1140/epjc/s10052-019-6855-8", "10.1140/epjc/s10052-019-6540-y", "10.1007/jhep06(2014)009", "10.1007/jhep05(2019)043", "10.1016/j.physletb.2016.01.028", "10.1103/physrevlett.120.231801", "10.1140/epjc/s10052-016-4325-0", "10.1007/jhep07(2018)127", "10.1016/j.physletb.2016.05.003", "10.1140/epjc/s10052-017-4644-9", "10.1140/epjc/s10052-017-4700-5", "10.1007/jhep06(2018)107", "10.1016/j.physletb.2018.01.042", "10.1140/epjc/s10052-018-5624-4", "10.1007/jhep08(2016)139", "10.1007/jhep05(2018)195", "10.1103/physrevd.97.052012", "10.1140/epjc/s10052-016-3978-z", "10.1007/jhep05(2019)088", "10.1140/epjc/s10052-017-5079-z", "10.1140/epjc/s10052-016-4205-7", "10.1007/jhep01(2016)006", "10.1140/epjc/s10052-016-4286-3", "10.1016/j.physletb.2017.04.071", "10.1103/physrevd.97.012007", "10.1016/j.physletb.2018.01.077", "10.1007/jhep04(2018)073", "10.1016/j.physletb.2015.09.057", "10.1007/jhep07(2018)032", "10.1140/epjc/s10052-015-3435-4", "10.1007/jhep11(2017)010", "10.1093/isd/ixaa002", "10.1016/j.physletb.2018.03.035", "10.1007/jhep10(2018)031", "10.1016/s0140-6736(18)31891-9", "10.1140/epjc/s10052-018-6148-7", "10.1016/j.physletb.2018.03.057", "10.1140/epjc/s10052-019-6632-8", "10.1016/j.physletb.2015.11.071", "10.1140/epjc/s10052-018-5605-7", "10.1016/j.physletb.2018.10.073", "10.1140/epjc/s10052-019-7387-y", "10.1007/jhep06(2019)143", "10.1140/epjc/s10052-018-5567-9", "10.1140/epjc/s10052-019-6909-y", "10.1002/(sici)1521-3978(199901)47:1/3", "10.5281/zenodo.3758372", "10.4126/frl01-0064041", "10.1140/epjc/s10052-014-3129-3", "10.11646/zootaxa.4685.1.1", "10.11646/zootaxa.4756.1.1", "10.6101/azq/0001", "10.14582/duzg", "10.1016/j.physletb.2012.11.039", "10.4126/frl01-0064191", "10.1016/j.physletb.2013.12.029", "10.1007/jhep10(2013)189", "10.1051/0004-6361/201629512", "10.1007/jhep01(2013)116", "10.2312/gfz.lis.2016.001", "10.1016/j.physletb.2013.01.040", "10.1103/physrevd.90.112005", "10.1140/epjc/s10052-015-3726-9", "10.1007/s11682-013-9269-5", "10.1007/jhep02(2017)071", "10.1016/j.physletb.2016.09.040", "10.1007/jhep02(2017)117", "10.1007/jhep08(2016)009", "10.1103/physrevd.97.052010", "10.1007/jhep09(2017)032", "10.1103/physrevd.97.032005", "10.1140/epjc/s10052-017-4965-8", "10.1016/j.physletb.2016.08.042", "10.1016/j.physletb.2017.10.039", "10.1007/jhep03(2016)127", "10.1140/epjc/s10052-014-3034-9", "10.1007/jhep03(2017)113", "10.1007/jhep11(2018)040", "10.1140/epjc/s10052-018-6457-x", "10.1140/epjc/s10052-016-4041-9", "10.1140/epjc/s10052-018-6219-9", "10.1140/epjc/s10052-016-4149-y", "10.1007/jhep10(2017)072", "10.1140/epjc/s10052-016-4083-z", "10.1140/epjc/s10052-016-3956-5", "10.1007/jhep04(2016)073", "10.1007/jhep06(2016)177", "10.1016/j.physletb.2018.03.084", "10.1007/jhep10(2015)128", "10.1007/jhep03(2018)166", "10.1140/epjc/s10052-015-3491-9", "10.1016/j.physletb.2015.04.060", "10.1103/physrevd.92.112001", "10.1140/epjc/s10052-015-3367-z", "10.1007/jhep10(2017)019", "10.1007/jhep10(2017)131", "10.1016/j.physletb.2018.08.057", "10.1007/jhep01(2016)096", "10.1016/j.physletb.2017.09.053", "10.1007/jhep07(2017)013", "10.1007/jhep01(2019)030", "10.1007/jhep11(2016)110", "10.1016/j.physletb.2012.02.044", "10.1140/epjc/s10052-017-5192-z", "10.1007/jhep03(2015)022", "10.1140/epjc/s10052-019-6847-8", "10.1093/database/baz085", "10.1140/epjc/s10052-015-3451-4", "10.1007/jhep11(2017)029", "10.1140/epjc/s10052-015-3517-3", "10.1007/jhep07(2017)001", "10.1007/jhep09(2016)074", "10.1103/physrevd.97.072016", "10.1007/jhep05(2018)006", "10.1103/physrevlett.120.081801", "10.1103/physrevlett.120.161802", "10.1103/physrevlett.120.202005", "10.5281/zenodo.1299123", "10.5281/zenodo.3777294" ], - "pmid" : [], - "pmc" : [] -} \ No newline at end of file diff --git a/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java b/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java deleted file mode 100644 index f26fed0..0000000 --- a/src/test/java/eu/dnetlib/dhp/schema/common/ModelSupportTest.java +++ /dev/null @@ -1,53 +0,0 @@ - -package eu.dnetlib.dhp.schema.common; - -import static org.junit.jupiter.api.Assertions.*; - -import java.io.IOException; - -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -import eu.dnetlib.dhp.schema.oaf.Entity; -import eu.dnetlib.dhp.schema.oaf.Relation; -import eu.dnetlib.dhp.schema.oaf.Result; - -public class ModelSupportTest { - - @Nested - class IsSubClass { - - @Test - void shouldReturnFalseWhenSubClassDoesNotExtendSuperClass() { - // when - Boolean result = ModelSupport.isSubClass(Relation.class, Entity.class); - - // then - assertFalse(result); - } - - @Test - void shouldReturnTrueWhenSubClassExtendsSuperClass() { - // when - Boolean result = ModelSupport.isSubClass(Result.class, Entity.class); - - // then - 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")); - - - } - } -} diff --git a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java b/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java deleted file mode 100644 index 61d06a6..0000000 --- a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/BlackListProviderTest.java +++ /dev/null @@ -1,21 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import java.util.Set; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -class BlackListProviderTest { - - @Test - void blackListTest() { - - Assertions.assertNotNull(PidBlacklistProvider.getBlacklist()); - Assertions.assertNotNull(PidBlacklistProvider.getBlacklist().get("doi")); - Assertions.assertTrue(PidBlacklistProvider.getBlacklist().get("doi").size() > 0); - final Set xxx = PidBlacklistProvider.getBlacklist("xxx"); - Assertions.assertNotNull(xxx); - Assertions.assertEquals(0, xxx.size()); - } -} diff --git a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java b/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java deleted file mode 100644 index e21f57e..0000000 --- a/src/test/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactoryTest.java +++ /dev/null @@ -1,87 +0,0 @@ - -package eu.dnetlib.dhp.schema.oaf.utils; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.io.IOException; - -import org.apache.commons.io.IOUtils; -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -import eu.dnetlib.dhp.schema.oaf.Publication; - -class IdentifierFactoryTest { - - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() - .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - @Test - void testCreateIdentifierForPublication() throws IOException { - - verifyIdentifier( - "publication_doi1.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true); - - verifyIdentifier( - "publication_doi2.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true); - - verifyIdentifier( - "publication_doi3.json", "50|pmc_________::94e4cb08c93f8733b48e2445d04002ac", true); - - verifyIdentifier( - "publication_doi4.json", "50|od______2852::38861c44e6052a8d49f59a4c39ba5e66", true); - - verifyIdentifier( - "publication_doi5.json", "50|doi_________::3bef95c0ca26dd55451fc8839ea69d27", true); - - verifyIdentifier( - "publication_pmc1.json", "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", true); - - verifyIdentifier( - "publication_pmc2.json", "50|pmc_________::94e4cb08c93f8733b48e2445d04002ac", true); - - verifyIdentifier( - "publication_openapc.json", "50|doi_________::79dbc7a2a56dc1532659f9038843256e", true); - - final String defaultID = "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f"; - verifyIdentifier("publication_3.json", defaultID, true); - verifyIdentifier("publication_4.json", defaultID, true); - verifyIdentifier("publication_5.json", defaultID, true); - - } - - @Test - void testCreateIdentifierForPublicationNoHash() throws IOException { - - 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_pmc1.json", "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", false); - verifyIdentifier( - "publication_urn1.json", "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", false); - - final String defaultID = "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f"; - verifyIdentifier("publication_3.json", defaultID, false); - verifyIdentifier("publication_4.json", defaultID, false); - verifyIdentifier("publication_5.json", defaultID, false); - } - - @Test - void testCreateIdentifierForROHub() throws IOException { - verifyIdentifier( - "orp-rohub.json", "50|w3id________::afc7592914ae190a50570db90f55f9c2", true); - } - - protected void verifyIdentifier(String filename, String expectedID, boolean md5) throws IOException { - final String json = IOUtils.toString(getClass().getResourceAsStream(filename)); - final Publication pub = OBJECT_MAPPER.readValue(json, Publication.class); - - String id = IdentifierFactory.createIdentifier(pub, md5); - System.out.println(id); - assertNotNull(id); - assertEquals(expectedID, id); - } - -} diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json deleted file mode 100644 index c0f13ff..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/orp-rohub.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "collectedfrom": [ - { - "key": "10|fairsharing_::1b69ebedb522700034547abc5652ffac", - "value": "ROHub", - "dataInfo": null - } - ], - "dataInfo": { - "invisible": false, - "inferred": false, - "deletedbyinference": false, - "trust": "0.9", - "inferenceprovenance": null, - "provenanceaction": { - "classid": "sysimport:crosswalk:repository", - "classname": "sysimport:crosswalk:repository", - "schemeid": "dnet:provenanceActions" - } - }, - "lastupdatetimestamp": 1663926081966, - "id": "50|w3id________::afc7592914ae190a50570db90f55f9c2", - "originalId": [ - "50|fsh_____4119::afc7592914ae190a50570db90f55f9c2", - "https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca" - ], - "pid": [ - { - "value": "https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca", - "qualifier": { - "classid": "w3id", - "classname": "w3id.org", - "schemeid": "dnet:pid_types" - } - } - ], - "dateofcollection": "2019-03-27T15:15:22.22Z", - "dateoftransformation": "2019-04-17T16:04:20.586Z", - "extraInfo": [], - "oaiprovenance": null, - "processingchargeamount": null, - "processingchargecurrency": null, - "measures": null, - "author": [ - { - "fullname": "CNR-ISMAR", - "name": "", - "surname": "", - "rank": 1, - "pid": [] - } - ], - "resulttype": "other", - "language": { - "classid": "UNKNOWN", - "classname": "Unknown", - "schemeid": "dnet:languages" - }, - "country": [], - "subject": [ - { - "value": "Ecology", - "qualifier": { - "classid": "", - "classname": "", - "schemeid": "" - }, - "dataInfo": { - "inferred": false, - "trust": "0.9", - "inferenceprovenance": null, - "provenanceaction": { - "classid": "sysimport:crosswalk:repository", - "classname": "sysimport:crosswalk:repository", - "schemeid": "dnet:provenanceActions" - } - } - }, - { - "value": "EOSC::RO-crate", - "qualifier": { - "classid": "", - "classname": "", - "schemeid": "" - }, - "dataInfo": { - "inferred": false, - "trust": "0.9", - "inferenceprovenance": null, - "provenanceaction": { - "classid": "sysimport:crosswalk:repository", - "classname": "sysimport:crosswalk:repository", - "schemeid": "dnet:provenanceActions" - } - } - } - ], - "title": [ - { - "value": "Using biological effects tools to define Good Environmental Status under the European Union Marine Strategy Framework Directive", - "qualifier": { - "classid": "main title", - "classname": "main title", - "schemeid": "dnet:dataCite_title" - } - } - ], - "relevantdate": [ - { - "value": "2018-06-20T11:21:46Z", - "qualifier": { - "classid": "UNKNOWN", - "classname": "UNKNOWN", - "schemeid": "dnet:dataCite_date" - } - } - ], - "description": [ - "The use of biological effects tools offer enormous potential to meet the challenges outlined by the European Union Marine Strategy Framework Directive (MSFD) whereby Member States are required to develop a robust set of tools for defining 11 qualitative descriptors of Good Environmental Status (GES), such as demonstrating that \"Concentrations of contaminants are at levels not giving rise to pollution effects\" (GES Descriptor 8). This paper discusses the combined approach of monitoring chemical contaminant levels, along side biological effect measurements relating to the effect of pollutants, for undertaking assessments of GES across European marine regions. We outline the minimum standards that biological effects tools should meet if they are to be used for defining GES in relation to Descriptor 8 and describe the current international initiatives underway to develop assessment criteria for these biological effects techniques. Crown Copyright (C) 2010 Published by Elsevier Ltd. All rights reserved." - ], - "dateofacceptance": null, - "publisher": { - "name": "PoznaƄ Supercomputing and Networking Center" - }, - "embargoenddate": null, - "source": [], - "fulltext": [], - "format": [], - "contributor": [ - "Generation Service" - ], - "resourcetype": { - "classid": "RO-crate", - "classname": "RO-crate", - "schemeid": "dnet:dataCite_resource", - "schemename": "dnet:dataCite_resource" - }, - "coverage": [], - "bestaccessright": { - "classid": "OPEN", - "classname": "Open Access", - "schemeid": "dnet:access_modes", - "schemename": "dnet:access_modes" - }, - "context": [], - "externalReference": [], - "instance": [ - { - "license": null, - "accessright": { - "classid": "OPEN", - "classname": "Open Access", - "schemeid": "dnet:access_modes", - "openAccessRoute": null - }, - "instancetype": { - "classid": "other research product", - "classname": "other research product", - "schemeid": "dnet:publication_resource" - }, - "hostedby": { - "key": "10|fairsharing_::1b69ebedb522700034547abc5652ffac", - "value": "ROHub" - }, - "url": null, - "distributionlocation": null, - "collectedfrom": { - "key": "10|fairsharing_::1b69ebedb522700034547abc5652ffac", - "value": "ROHub" - }, - "pid": [ - { - "value": "https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca", - "qualifier": { - "classid": "w3id", - "classname": "w3id.org", - "schemeid": "dnet:pid_types" - } - } - ], - "alternateIdentifier": [], - "dateofacceptance": null, - "processingchargeamount": null, - "processingchargecurrency": null, - "refereed": { - "classid": "UNKNOWN", - "classname": "Unknown", - "schemeid": "dnet:review_levels" - }, - "measures": null - } - ], - "eoscifguidelines": null, - "contactperson": [], - "contactgroup": [], - "tool": [] -} diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_3.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_3.json deleted file mode 100644 index 6d33568..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_3.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f","pid":[{"qualifier":{"classid":"scp-number"},"value":"79953761260"}]} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_4.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_4.json deleted file mode 100644 index 6617fe1..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_4.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f","pid":[]} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_5.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_5.json deleted file mode 100644 index 700a100..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_5.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f"} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi1.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi1.json deleted file mode 100644 index 83bc0cd..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi1.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "id": "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "instance": [ - { - "collectedfrom": { - "key": "10|openaire____::081b82f96300b6a6e3d282bad31cb6e2", - "value": "Crossref" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.1016/j.cmet.2010.03.013" - } - ] - }, - { - "pid": [ - { - "qualifier": {"classid": "urn"}, - "value": "urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2" - }, - { - "qualifier": {"classid": "scp-number"}, - "value": "79953761260" - }, - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi2.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi2.json deleted file mode 100644 index 5c73fc3..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi2.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "instance": [ - { - "collectedfrom": { - "key": "10|openaire____::081b82f96300b6a6e3d282bad31cb6e2", - "value": "Crossref" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.1016/j.cmet.2010.03.013" - } - ] - }, - { - "collectedfrom": { - "key": "10|opendoar____::8b6dd7db9af49e67306feb59a8bdc52c", - "value": "Europe PubMed Central" - }, - "pid": [ - { - "qualifier": {"classid": "urn"}, - "value": "urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2" - }, - { - "qualifier": {"classid": "scp-number"}, - "value": "79953761260" - }, - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi3.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi3.json deleted file mode 100644 index b1ea01f..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi3.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "instance": [ - { - "collectedfrom": { - "key": "10|opendoar____::358aee4cc897452c00244351e4d91f69", - "value": "Zenodo" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.1016/j.cmet.2010.03.013" - } - ] - }, - { - "collectedfrom": { - "key": "10|opendoar____::8b6dd7db9af49e67306feb59a8bdc52c", - "value": "Europe PubMed Central" - }, - "pid": [ - { - "qualifier": {"classid": "urn"}, - "value": "urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2" - }, - { - "qualifier": {"classid": "scp-number"}, - "value": "79953761260" - }, - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi4.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi4.json deleted file mode 100644 index 764c510..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi4.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "50|od______2852::38861c44e6052a8d49f59a4c39ba5e66", - "instance": [ - { - "collectedfrom": { - "key": "10|opendoar____::358aee4cc897452c00244351e4d91f69", - "value": "Zenodo" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.1016/j.cmet.2010.03.013" - }, - { - "qualifier": {"classid": "handle"}, - "value": "11012/83840" - } - ] - }, - { - "collectedfrom": { - "key": "10|opendoar____::2852", - "value": "Digital library of Brno University of Technology" - }, - "pid": [ - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - }, - { - "qualifier": {"classid": "handle"}, - "value": "11012/83840" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi5.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi5.json deleted file mode 100644 index 816f0dc..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_doi5.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "instance": [ - { - "collectedfrom": { - "key": "10|opendoar____::358aee4cc897452c00244351e4d91f69", - "value": "Zenodo" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.5281/zenodo.5121485" - } - ] - }, - { - "collectedfrom": { - "key": "10|opendoar____::8b6dd7db9af49e67306feb59a8bdc52c", - "value": "Europe PubMed Central" - }, - "pid": [ - { - "qualifier": {"classid": "urn"}, - "value": "urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2" - }, - { - "qualifier": {"classid": "scp-number"}, - "value": "79953761260" - }, - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_openapc.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_openapc.json deleted file mode 100644 index f06ac18..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_openapc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "50|openapc_____::000023f9cb6e3a247c764daec4273cbc", - "resuttype": { - "classid": "publication" - }, - "instance": [ - { - "collectedfrom": { - "key": "10|apc_________::e2b1600b229fc30663c8a1f662debddf", - "value": "OpenAPC Global Initiative" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.1016/j.cmet.2010.03.013" - }, - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - }, - { - "qualifier": {"classid": "pmid"}, - "value": "25811027" - } - ], - "url":["https://doi.org/10.1155/2015/439379"] - } - ] -} - - diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc1.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc1.json deleted file mode 100644 index 537719f..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id": "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "pid": [ - { - "qualifier": {"classid": "urn"}, - "value": "urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2" - }, - { - "qualifier": {"classid": "scp-number"}, - "value": "79953761260" - }, - { - "qualifier": {"classid": "pmc"}, - "value": "21459329" - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc2.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc2.json deleted file mode 100644 index e7d49ee..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_pmc2.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "id":"50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "instance": [ - { - "collectedfrom": { - "key": "10|opendoar____::8b6dd7db9af49e67306feb59a8bdc52c", - "value": "Europe PubMed Central" - }, - "pid": [ - { - "qualifier": {"classid": "doi"}, - "value": "10.1016/j.cmet.2010.03.013" - }, - { - "qualifier":{"classid":"pmc"}, - "value":"21459329" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_urn1.json b/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_urn1.json deleted file mode 100644 index 5323ac8..0000000 --- a/src/test/resources/eu/dnetlib/dhp/schema/oaf/utils/publication_urn1.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": "50|DansKnawCris::0829b5191605bdbea36d6502b8c1ce1f", - "pid": [ - { - "qualifier": { - "classid": "urn" - }, - "value": "urn:nbn:nl:ui:29-f3ed5f9e-edf6-457e-8848-61b58a4075e2" - }, - { - "qualifier": { - "classid": "scp-number" - }, - "value": "79953761260" - }, - { - "qualifier": { - "classid": "pmcid" - }, - "value": "21459329" - } - ] -} \ No newline at end of file