From 64b0b0bfb309c96ec41e3a2973d180c133398531 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Tue, 15 Dec 2020 14:54:11 +0100 Subject: [PATCH] fixed a bug with invalid subject topic --- .../matchers/simple/EnrichMissingSubject.java | 19 ++++++++++++++++++- .../oa/matchers/simple/EnrichMoreSubject.java | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMissingSubject.java b/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMissingSubject.java index 26ebbb7c0..cb3ea5464 100644 --- a/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMissingSubject.java +++ b/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMissingSubject.java @@ -16,7 +16,24 @@ public class EnrichMissingSubject extends UpdateMatcher { public EnrichMissingSubject() { super(20, - s -> Topic.fromPath("ENRICH/MISSING/SUBJECT/" + s.getType()), + s -> { + switch (s.getType().toLowerCase()) { + case "acm": + return Topic.ENRICH_MISSING_SUBJECT_ACM; + case "arxiv": + return Topic.ENRICH_MISSING_SUBJECT_ARXIV; + case "ddc": + return Topic.ENRICH_MISSING_SUBJECT_DDC; + case "jel": + return Topic.ENRICH_MISSING_SUBJECT_JEL; + case "mesh": + return Topic.ENRICH_MISSING_SUBJECT_MESHEUROPMC; + case "rvk": + return Topic.ENRICH_MISSING_SUBJECT_RVK; + default: + return null; + } + }, (p, s) -> p.getSubjects().add(s), s -> subjectAsString(s)); } diff --git a/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMoreSubject.java b/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMoreSubject.java index bbe6609d7..1f6edf96e 100644 --- a/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMoreSubject.java +++ b/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMoreSubject.java @@ -16,7 +16,24 @@ public class EnrichMoreSubject extends UpdateMatcher { public EnrichMoreSubject() { super(20, - s -> Topic.fromPath("ENRICH/MORE/SUBJECT/" + s.getType()), + s -> { + switch (s.getType().toLowerCase()) { + case "acm": + return Topic.ENRICH_MORE_SUBJECT_ACM; + case "arxiv": + return Topic.ENRICH_MORE_SUBJECT_ARXIV; + case "ddc": + return Topic.ENRICH_MORE_SUBJECT_DDC; + case "jel": + return Topic.ENRICH_MORE_SUBJECT_JEL; + case "mesh": + return Topic.ENRICH_MORE_SUBJECT_MESHEUROPMC; + case "rvk": + return Topic.ENRICH_MORE_SUBJECT_RVK; + default: + return null; + } + }, (p, s) -> p.getSubjects().add(s), s -> subjectAsString(s)); }