From 7e2caafe840ae192d6df8784f2954fb51604dd24 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Thu, 15 Jul 2021 09:53:12 +0200 Subject: [PATCH] Scholexplorer: fixed mapping typologies --- .../dhp/sx/graph/scholix/ScholixUtils.scala | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/sx/graph/scholix/ScholixUtils.scala b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/sx/graph/scholix/ScholixUtils.scala index 6a7ee7803..4dafd4fa3 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/sx/graph/scholix/ScholixUtils.scala +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/sx/graph/scholix/ScholixUtils.scala @@ -1,11 +1,10 @@ package eu.dnetlib.dhp.sx.graph.scholix -import eu.dnetlib.dhp.schema.oaf.{Dataset, Relation, Result, StructuredProperty} -import eu.dnetlib.dhp.schema.sx.scholix.{Scholix, ScholixCollectedFrom, ScholixEntityId, ScholixIdentifier, ScholixRelationship, ScholixResource} +import eu.dnetlib.dhp.schema.oaf.{Publication, Relation, Result, StructuredProperty} +import eu.dnetlib.dhp.schema.sx.scholix._ import eu.dnetlib.dhp.schema.sx.summary.{CollectedFromType, SchemeValue, ScholixSummary, Typology} import eu.dnetlib.dhp.utils.DHPUtils -import org.apache.spark.sql.Encoders.bean import org.apache.spark.sql.expressions.Aggregator import org.apache.spark.sql.{Encoder, Encoders} import org.json4s @@ -301,14 +300,14 @@ object ScholixUtils { if (r.getPid == null || r.getPid.isEmpty) return null - val pids:List[ScholixIdentifier] = extractTypedIdentifierFromInstance(r) - if (pids.isEmpty) + val persistentIdentifiers:List[ScholixIdentifier] = extractTypedIdentifierFromInstance(r) + if (persistentIdentifiers.isEmpty) return null - s.setLocalIdentifier(pids.asJava) - if (r.isInstanceOf[Dataset]) - s.setTypology(Typology.dataset) - else + s.setLocalIdentifier(persistentIdentifiers.asJava) + if (r.isInstanceOf[Publication] ) s.setTypology(Typology.publication) + else + s.setTypology(Typology.dataset) s.setSubType(r.getInstance().get(0).getInstancetype.getClassname)