forked from D-Net/dnet-hadoop
Compare commits
2 Commits
afb46d71f7
...
7fc5b97871
Author | SHA1 | Date |
---|---|---|
Enrico Ottonello | 7fc5b97871 | |
Enrico Ottonello | a203c33693 |
|
@ -74,28 +74,36 @@ object BioschemaModelConstants {
|
||||||
)
|
)
|
||||||
|
|
||||||
val PED_PREFIX: String = "ped_________"
|
val PED_PREFIX: String = "ped_________"
|
||||||
|
val DISPROT_PREFIX: String = "disprot_____"
|
||||||
|
|
||||||
val resolvedURLPattern: Map[String, String] = Map(
|
val resolvedURLPattern: Map[String, String] = Map(
|
||||||
"https://identifiers.org/pubmed:" -> "pubmed",
|
"https://identifiers.org/pubmed:" -> "pubmed",
|
||||||
"http://purl.uniprot.org/uniprot/" -> "uniprot",
|
"http://purl.uniprot.org/uniprot/" -> "uniprot",
|
||||||
"https://identifiers.org/uniprot:" -> "uniprot"
|
"https://identifiers.org/uniprot:" -> "uniprot",
|
||||||
|
"https://identifiers.org/disprot:" -> "disprot"
|
||||||
)
|
)
|
||||||
|
//TODO create DatasourceId and update those value
|
||||||
val collectedFromMap: Map[String, KeyValue] = {
|
val collectedFromMap: Map[String, KeyValue] = {
|
||||||
val PEDCollectedFrom: KeyValue = OafMapperUtils.keyValue(
|
val PEDCollectedFrom: KeyValue = OafMapperUtils.keyValue(
|
||||||
//TODO create pedDatasourceId and update this value
|
|
||||||
"10|ped_________::pedDatasourceId",
|
"10|ped_________::pedDatasourceId",
|
||||||
"Protein Ensemble Database"
|
"Protein Ensemble Database"
|
||||||
)
|
)
|
||||||
PEDCollectedFrom.setDataInfo(DATA_INFO)
|
PEDCollectedFrom.setDataInfo(DATA_INFO)
|
||||||
|
val DISPROTCollectedFrom: KeyValue = OafMapperUtils.keyValue(
|
||||||
|
"10|disprot_____::disprotDatasourceId",
|
||||||
|
"DisProt, the database of intrinsically disordered proteins"
|
||||||
|
)
|
||||||
|
DISPROTCollectedFrom.setDataInfo(DATA_INFO)
|
||||||
|
|
||||||
Map(
|
Map(
|
||||||
"ped" -> PEDCollectedFrom
|
"ped" -> PEDCollectedFrom,
|
||||||
|
"disprot" -> DISPROTCollectedFrom
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val datasourceKeyPrefix: Map[String, String] = Map(
|
val datasourceKeyPrefix: Map[String, String] = Map(
|
||||||
"ped" -> PED_PREFIX
|
"ped" -> PED_PREFIX,
|
||||||
|
"disprot" -> DISPROT_PREFIX
|
||||||
)
|
)
|
||||||
|
|
||||||
val REL_TYPE_VALUE: String = "resultResult"
|
val REL_TYPE_VALUE: String = "resultResult"
|
||||||
|
|
|
@ -100,7 +100,9 @@ object BioschemaToOAFTransformation {
|
||||||
result.setDataInfo(dataInfo)
|
result.setDataInfo(dataInfo)
|
||||||
|
|
||||||
val titles: List[TitleType] = (json \\ "titles").extractOrElse[List[TitleType]](List())
|
val titles: List[TitleType] = (json \\ "titles").extractOrElse[List[TitleType]](List())
|
||||||
|
if (titles.isEmpty) {
|
||||||
|
return List()
|
||||||
|
}
|
||||||
result.setTitle(
|
result.setTitle(
|
||||||
titles
|
titles
|
||||||
.filter(t => t.title.nonEmpty)
|
.filter(t => t.title.nonEmpty)
|
||||||
|
@ -189,6 +191,9 @@ object BioschemaToOAFTransformation {
|
||||||
})
|
})
|
||||||
.asJava
|
.asJava
|
||||||
)
|
)
|
||||||
|
if (instance.getUrl.isEmpty) {
|
||||||
|
return List()
|
||||||
|
}
|
||||||
instance.setCollectedfrom(collectedFromMap(datasourceKey))
|
instance.setCollectedfrom(collectedFromMap(datasourceKey))
|
||||||
instance.setPid(result.getPid)
|
instance.setPid(result.getPid)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"id": "DP01454",
|
||||||
|
"types": {
|
||||||
|
"resourceType": "Protein",
|
||||||
|
"resourceTypeGeneral": "Dataset"
|
||||||
|
},
|
||||||
|
"creators": [],
|
||||||
|
"identifiers": [
|
||||||
|
{
|
||||||
|
"identifier": "https://disprot.org/DP01454",
|
||||||
|
"identifierType": "URL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"relatedIdentifiers": [
|
||||||
|
{
|
||||||
|
"relationType": "IsIdenticalTo",
|
||||||
|
"relatedIdentifier": "http://purl.uniprot.org/uniprot/P60006",
|
||||||
|
"relatedIdentifierType": "URL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"alternateIdentifiers": [
|
||||||
|
{
|
||||||
|
"alternateIdentifier": "https://identifiers.org/disprot:DP01454"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"descriptions": [],
|
||||||
|
"titles": [
|
||||||
|
{
|
||||||
|
"title": "DP01454 - Anaphase-promoting complex subunit 15 "
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dates": [
|
||||||
|
{
|
||||||
|
"date": "2021-11-25T12:23:57",
|
||||||
|
"dateType": "Collected"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjects": [
|
||||||
|
{
|
||||||
|
"schemeURI": "https://disprot.org/assets/data/IDPO_v0.2.owl#IDPO:00076",
|
||||||
|
"value": "disorder",
|
||||||
|
"subjectScheme": "IDPO:00076"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -62,7 +62,7 @@ class BioschemaDataciteToOAFTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
def testMapping(): Unit = {
|
def testPEDMapping(): Unit = {
|
||||||
val record = Source
|
val record = Source
|
||||||
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/ped_record.json"))
|
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/ped_record.json"))
|
||||||
.mkString
|
.mkString
|
||||||
|
@ -73,4 +73,17 @@ class BioschemaDataciteToOAFTest {
|
||||||
println("----------------------------")
|
println("----------------------------")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
def testDISPROTMapping(): Unit = {
|
||||||
|
val record = Source
|
||||||
|
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/disprot_record.json"))
|
||||||
|
.mkString
|
||||||
|
val mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT)
|
||||||
|
val res: List[Oaf] = BioschemaToOAFTransformation.generateOAF(record, true, "disprot", "protein")
|
||||||
|
res.foreach(r => {
|
||||||
|
println(mapper.writeValueAsString(r))
|
||||||
|
println("----------------------------")
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue