forked from D-Net/dnet-hadoop
[DOIBoost] extended mapping for funder #8407
This commit is contained in:
parent
016337a0f9
commit
d617c3e812
|
@ -309,8 +309,6 @@ case object Crossref2Oaf {
|
|||
result
|
||||
}
|
||||
|
||||
|
||||
|
||||
def generateAuhtor(given: String, family: String, orcid: String, index: Int): Author = {
|
||||
val a = new Author
|
||||
a.setName(given)
|
||||
|
@ -372,14 +370,11 @@ case object Crossref2Oaf {
|
|||
case dataset: Dataset => convertDataset(dataset)
|
||||
}
|
||||
|
||||
|
||||
val doisReference: List[String] = for {
|
||||
JObject(reference_json) <- json \ "reference"
|
||||
JField("DOI", JString(doi_json)) <- reference_json
|
||||
} yield doi_json
|
||||
|
||||
|
||||
|
||||
if (doisReference != null && doisReference.nonEmpty) {
|
||||
val citation_relations: List[Relation] = generateCitationRelations(doisReference, result)
|
||||
resultList = resultList ::: citation_relations
|
||||
|
@ -388,11 +383,8 @@ case object Crossref2Oaf {
|
|||
resultList
|
||||
}
|
||||
|
||||
|
||||
|
||||
private def createCiteRelation(source: Result, targetPid: String, targetPidType: String): List[Relation] = {
|
||||
|
||||
|
||||
val targetId = IdentifierFactory.idFromPid("50", targetPidType, targetPid, true)
|
||||
|
||||
val from = new Relation
|
||||
|
@ -405,7 +397,6 @@ case object Crossref2Oaf {
|
|||
from.setDataInfo(source.getDataInfo)
|
||||
from.setLastupdatetimestamp(source.getLastupdatetimestamp)
|
||||
|
||||
|
||||
val to = new Relation
|
||||
to.setTarget(source.getId)
|
||||
to.setSource(targetId)
|
||||
|
@ -495,6 +486,7 @@ case object Crossref2Oaf {
|
|||
case "10.13039/501100000781" =>
|
||||
generateSimpleRelationFromAward(funder, "corda_______", extractECAward)
|
||||
generateSimpleRelationFromAward(funder, "corda__h2020", extractECAward)
|
||||
generateSimpleRelationFromAward(funder, "corda_____he", extractECAward)
|
||||
case "10.13039/100000001" => generateSimpleRelationFromAward(funder, "nsf_________", a => a)
|
||||
case "10.13039/501100001665" => generateSimpleRelationFromAward(funder, "anr_________", a => a)
|
||||
case "10.13039/501100002341" => generateSimpleRelationFromAward(funder, "aka_________", a => a)
|
||||
|
@ -536,6 +528,34 @@ case object Crossref2Oaf {
|
|||
val targetId = getProjectId("wt__________", "1e5e62235d094afd01cd56e65112fc63")
|
||||
queue += generateRelation(sourceId, targetId, ModelConstants.IS_PRODUCED_BY)
|
||||
queue += generateRelation(targetId, sourceId, ModelConstants.PRODUCES)
|
||||
//ASAP
|
||||
case "10.13039/100018231" => generateSimpleRelationFromAward(funder, "asap________", a => a)
|
||||
//CHIST-ERA
|
||||
case "10.13039/501100001942" =>
|
||||
val targetId = getProjectId("chistera____", "1e5e62235d094afd01cd56e65112fc63")
|
||||
queue += generateRelation(sourceId, targetId, ModelConstants.IS_PRODUCED_BY)
|
||||
queue += generateRelation(targetId, sourceId, ModelConstants.PRODUCES)
|
||||
//HE
|
||||
case "10.13039/100018693" | "10.13039/100018694" | "10.13039/100019188" | "10.13039/100019180" |
|
||||
"10.13039/100018695" | "10.13039/100019185" | "10.13039/100019186" | "10.13039/100019187" =>
|
||||
generateSimpleRelationFromAward(funder, "corda_____he", extractECAward)
|
||||
//FCT
|
||||
case "10.13039/501100001871" =>
|
||||
generateSimpleRelationFromAward(funder, "fct_________", extractECAward)
|
||||
//NHMRC
|
||||
case "10.13039/501100000925" =>
|
||||
generateSimpleRelationFromAward(funder, "mhmrc_______", extractECAward)
|
||||
//NIH
|
||||
case "10.13039/100000002" =>
|
||||
generateSimpleRelationFromAward(funder, "nih_________", extractECAward)
|
||||
//NWO
|
||||
case "10.13039/501100003246" =>
|
||||
generateSimpleRelationFromAward(funder, "nwo_________", extractECAward)
|
||||
//UKRI
|
||||
case "10.13039/100014013" | "10.13039/501100000267" | "10.13039/501100000268" | "10.13039/501100000269" |
|
||||
"10.13039/501100000266" | "10.13039/501100006041" | "10.13039/501100000265" | "10.13039/501100000270" |
|
||||
"10.13039/501100013589" | "10.13039/501100000271" =>
|
||||
generateSimpleRelationFromAward(funder, "nwo_________", extractECAward)
|
||||
|
||||
case _ => logger.debug("no match for " + funder.DOI.get)
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ class CrossrefMappingTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private def parseJson(input: String): JValue = {
|
||||
implicit lazy val formats: DefaultFormats.type = org.json4s.DefaultFormats
|
||||
lazy val json: json4s.JValue = JsonMethods.parse(input)
|
||||
|
@ -124,8 +123,9 @@ class CrossrefMappingTest {
|
|||
|
||||
@Test
|
||||
def testCitationRelations(): Unit = {
|
||||
val json = Source.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/doiboost/crossref/publication_license_embargo.json")).mkString
|
||||
|
||||
val json = Source
|
||||
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/doiboost/crossref/publication_license_embargo.json"))
|
||||
.mkString
|
||||
|
||||
assertNotNull(json)
|
||||
assertFalse(json.isEmpty)
|
||||
|
@ -134,7 +134,6 @@ class CrossrefMappingTest {
|
|||
|
||||
assertTrue(result.nonEmpty)
|
||||
|
||||
|
||||
val j = parseJson(json)
|
||||
|
||||
val doisReference: List[String] = for {
|
||||
|
@ -142,14 +141,18 @@ class CrossrefMappingTest {
|
|||
JField("DOI", JString(doi_json)) <- reference_json
|
||||
} yield doi_json
|
||||
|
||||
|
||||
|
||||
val relationList:List[Relation] = result.filter(s => s.isInstanceOf[Relation]).map(r=> r.asInstanceOf[Relation]).filter(r => r.getSubRelType.equalsIgnoreCase(ModelConstants.CITATION))
|
||||
val relationList: List[Relation] = result
|
||||
.filter(s => s.isInstanceOf[Relation])
|
||||
.map(r => r.asInstanceOf[Relation])
|
||||
.filter(r => r.getSubRelType.equalsIgnoreCase(ModelConstants.CITATION))
|
||||
|
||||
assertNotNull(relationList)
|
||||
assertFalse(relationList.isEmpty)
|
||||
|
||||
assertEquals(doisReference.size * 2, relationList.size)
|
||||
|
||||
mapper.getSerializationConfig.enable(SerializationConfig.Feature.INDENT_OUTPUT)
|
||||
relationList.foreach(p => println(mapper.writeValueAsString(p)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue