forked from D-Net/dnet-hadoop
hostedby patching to work with the updated Crossref contents, resolved conflict
This commit is contained in:
parent
0139f23d66
commit
3776327a8c
|
@ -25,6 +25,22 @@ object SparkApplyHostedByMapToResult {
|
|||
val i = p.getInstance().asScala
|
||||
if (i.size == 1) {
|
||||
val inst: Instance = i.head
|
||||
patchInstance(p, ei, inst)
|
||||
|
||||
} else {
|
||||
val cf = i.map(ii => ii.getCollectedfrom.getValue)
|
||||
if (cf.contains("Crossref")) {
|
||||
i.foreach(ii => {
|
||||
patchInstance(p, ei, ii)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
p
|
||||
})(Encoders.bean(classOf[Publication]))
|
||||
}
|
||||
|
||||
private def patchInstance(p: Publication, ei: EntityInfo, inst: Instance): Unit = {
|
||||
inst.getHostedby.setKey(ei.getHostedById)
|
||||
inst.getHostedby.setValue(ei.getName)
|
||||
if (ei.getOpenAccess) {
|
||||
|
@ -39,11 +55,6 @@ object SparkApplyHostedByMapToResult {
|
|||
inst.getAccessright.setOpenAccessRoute(OpenAccessRoute.gold)
|
||||
p.setBestaccessright(OafMapperUtils.createBestAccessRights(p.getInstance()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
p
|
||||
})(Encoders.bean(classOf[Publication]))
|
||||
}
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
|
|
Loading…
Reference in New Issue