From 0ff7faad72a6db5bf6602721c81f91558c327354 Mon Sep 17 00:00:00 2001 From: Giambattista Bloisi Date: Fri, 22 Mar 2024 16:24:49 +0100 Subject: [PATCH] Fix conditions that prevented ORCID Enrichment --- .../scala/eu/dnetlib/dhp/enrich/orcid/ORCIDAuthorEnricher.scala | 2 +- .../dhp/enrich/orcid/SparkEnrichGraphWithOrcidAuthors.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/ORCIDAuthorEnricher.scala b/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/ORCIDAuthorEnricher.scala index f7ea7e5a48..e2e7fada6e 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/ORCIDAuthorEnricher.scala +++ b/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/ORCIDAuthorEnricher.scala @@ -87,7 +87,7 @@ object ORCIDAuthorEnricher extends Serializable { ) = { val matched = scala.collection.mutable.ArrayBuffer.empty[MatchedAuthors] - if (graph_authors != null && graph_authors.isEmpty) { + if (graph_authors != null && !graph_authors.isEmpty) { val ait = graph_authors.iterator while (ait.hasNext) { diff --git a/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/SparkEnrichGraphWithOrcidAuthors.scala b/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/SparkEnrichGraphWithOrcidAuthors.scala index e2d2182479..0824c2a71e 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/SparkEnrichGraphWithOrcidAuthors.scala +++ b/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/enrich/orcid/SparkEnrichGraphWithOrcidAuthors.scala @@ -72,7 +72,7 @@ class SparkEnrichGraphWithOrcidAuthors(propertyPath: String, args: Array[String] .join(matched, Seq("id"), "left") .withColumn( "author", - when(size(col("enriched_author")).gt(1), col("enriched_author")) + when(size(col("enriched_author")).gt(0), col("enriched_author")) .otherwise(col("author")) ) .drop("enriched_author")