From c9a5ad6a0266de84a0be5efc493b686586705218 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 2 Oct 2023 16:28:42 +0200 Subject: [PATCH] extending the coverage of the peer non-unknown refereed instances --- .../oaf/utils/GraphCleaningFunctions.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/GraphCleaningFunctions.java b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/GraphCleaningFunctions.java index 8afa41f95..3c3e8052e 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/GraphCleaningFunctions.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/GraphCleaningFunctions.java @@ -36,6 +36,19 @@ public class GraphCleaningFunctions extends CleaningFunctions { public static final int TITLE_FILTER_RESIDUAL_LENGTH = 5; private static final String NAME_CLEANING_REGEX = "[\\r\\n\\t\\s]+"; + private static final HashSet PEER_REVIEWED_TYPES = new HashSet<>(); + + static { + PEER_REVIEWED_TYPES.add("Article"); + PEER_REVIEWED_TYPES.add("Part of book or chapter of book"); + PEER_REVIEWED_TYPES.add("Book"); + PEER_REVIEWED_TYPES.add("Doctoral thesis"); + PEER_REVIEWED_TYPES.add("Master thesis"); + PEER_REVIEWED_TYPES.add("Data Paper"); + PEER_REVIEWED_TYPES.add("Thesis"); + PEER_REVIEWED_TYPES.add("Bachelor thesis"); + PEER_REVIEWED_TYPES.add("Conference object"); + } public static T cleanContext(T value, String contextId, String verifyParam) { if (ModelSupport.isSubClass(value, Result.class)) { @@ -493,6 +506,28 @@ public class GraphCleaningFunctions extends CleaningFunctions { if (Objects.isNull(i.getRefereed()) || StringUtils.isBlank(i.getRefereed().getClassid())) { i.setRefereed(qualifier("0000", "Unknown", ModelConstants.DNET_REVIEW_LEVELS)); } + + // from the script from Dimitris + if ("0000".equals(i.getRefereed().getClassid())) { + final boolean isFromCrossref = ModelConstants.CROSSREF_ID + .equals(i.getCollectedfrom().getKey()); + final boolean hasDoi = i + .getPid() + .stream() + .anyMatch(pid -> PidType.doi.toString().equals(pid.getQualifier().getClassid())); + final boolean isPeerReviewedType = PEER_REVIEWED_TYPES + .contains(i.getInstancetype().getClassname()); + final boolean noOtherLitType = r + .getInstance() + .stream() + .noneMatch(ii -> "Other literature type".equals(ii.getInstancetype().getClassname())); + if (isFromCrossref && hasDoi && isPeerReviewedType && noOtherLitType) { + i.setRefereed(qualifier("0001", "peerReviewed", ModelConstants.DNET_REVIEW_LEVELS)); + } else { + i.setRefereed(qualifier("0002", "nonPeerReviewed", ModelConstants.DNET_REVIEW_LEVELS)); + } + } + if (Objects.nonNull(i.getDateofacceptance())) { Optional date = cleanDateField(i.getDateofacceptance()); if (date.isPresent()) {