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")
|
.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)]) = {
|
def extractPidsFromRecord(input: String): (String, List[(String, String)]) = {
|
||||||
implicit lazy val formats: DefaultFormats.type = org.json4s.DefaultFormats
|
implicit lazy val formats: DefaultFormats.type = org.json4s.DefaultFormats
|
||||||
|
@ -108,14 +123,7 @@ object SparkResolveRelation {
|
||||||
JField("classid", JString(pidType)) <- qualifier
|
JField("classid", JString(pidType)) <- qualifier
|
||||||
} yield (pidValue, pidType)
|
} yield (pidValue, pidType)
|
||||||
|
|
||||||
val alternateIds: List[(String, String)] = for {
|
(id, result)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue