forked from D-Net/dnet-hadoop
removed alternate identifier in resolutionMap
This commit is contained in:
parent
2ca0a436ad
commit
a7763d2492
|
@ -96,6 +96,21 @@ object SparkResolveRelation {
|
|||
.text(s"$graphBasePath/relation")
|
||||
}
|
||||
|
||||
def extractInstanceCF(input: String): List[(String, String)] = {
|
||||
implicit lazy val formats: DefaultFormats.type = org.json4s.DefaultFormats
|
||||
lazy val json: json4s.JValue = parse(input)
|
||||
val result: List[(String, String)] = for {
|
||||
JObject(iObj) <- json \ "instance"
|
||||
JField("collectedfrom", JObject(cf)) <- iObj
|
||||
JField("instancetype", JObject(instancetype)) <- iObj
|
||||
JField("value", JString(collectedFrom)) <- cf
|
||||
JField("classname", JString(classname)) <- instancetype
|
||||
} yield (classname, collectedFrom)
|
||||
|
||||
result
|
||||
|
||||
}
|
||||
|
||||
|
||||
def extractPidsFromRecord(input: String): (String, List[(String, String)]) = {
|
||||
implicit lazy val formats: DefaultFormats.type = org.json4s.DefaultFormats
|
||||
|
@ -108,14 +123,7 @@ object SparkResolveRelation {
|
|||
JField("classid", JString(pidType)) <- qualifier
|
||||
} yield (pidValue, pidType)
|
||||
|
||||
val alternateIds: List[(String, String)] = for {
|
||||
JObject(pids) <- json \\ "alternateIdentifier"
|
||||
JField("value", JString(pidValue)) <- pids
|
||||
JField("qualifier", JObject(qualifier)) <- pids
|
||||
JField("classid", JString(pidType)) <- qualifier
|
||||
} yield (pidValue, pidType)
|
||||
|
||||
(id, result ::: alternateIds)
|
||||
(id, result)
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue