forked from D-Net/dnet-hadoop
Compare commits
No commits in common. "7fc5b978716094a79f6100e9535e269b5b3a4ed4" and "afb46d71f7128e02a0a50e759c3699f74ccb1180" have entirely different histories.
7fc5b97871
...
afb46d71f7
|
@ -74,36 +74,28 @@ object BioschemaModelConstants {
|
|||
)
|
||||
|
||||
val PED_PREFIX: String = "ped_________"
|
||||
val DISPROT_PREFIX: String = "disprot_____"
|
||||
|
||||
val resolvedURLPattern: Map[String, String] = Map(
|
||||
"https://identifiers.org/pubmed:" -> "pubmed",
|
||||
"http://purl.uniprot.org/uniprot/" -> "uniprot",
|
||||
"https://identifiers.org/uniprot:" -> "uniprot",
|
||||
"https://identifiers.org/disprot:" -> "disprot"
|
||||
"https://identifiers.org/uniprot:" -> "uniprot"
|
||||
)
|
||||
//TODO create DatasourceId and update those value
|
||||
|
||||
val collectedFromMap: Map[String, KeyValue] = {
|
||||
val PEDCollectedFrom: KeyValue = OafMapperUtils.keyValue(
|
||||
//TODO create pedDatasourceId and update this value
|
||||
"10|ped_________::pedDatasourceId",
|
||||
"Protein Ensemble Database"
|
||||
)
|
||||
PEDCollectedFrom.setDataInfo(DATA_INFO)
|
||||
val DISPROTCollectedFrom: KeyValue = OafMapperUtils.keyValue(
|
||||
"10|disprot_____::disprotDatasourceId",
|
||||
"DisProt, the database of intrinsically disordered proteins"
|
||||
)
|
||||
DISPROTCollectedFrom.setDataInfo(DATA_INFO)
|
||||
|
||||
Map(
|
||||
"ped" -> PEDCollectedFrom,
|
||||
"disprot" -> DISPROTCollectedFrom
|
||||
"ped" -> PEDCollectedFrom
|
||||
)
|
||||
}
|
||||
|
||||
val datasourceKeyPrefix: Map[String, String] = Map(
|
||||
"ped" -> PED_PREFIX,
|
||||
"disprot" -> DISPROT_PREFIX
|
||||
"ped" -> PED_PREFIX
|
||||
)
|
||||
|
||||
val REL_TYPE_VALUE: String = "resultResult"
|
||||
|
|
|
@ -100,9 +100,7 @@ object BioschemaToOAFTransformation {
|
|||
result.setDataInfo(dataInfo)
|
||||
|
||||
val titles: List[TitleType] = (json \\ "titles").extractOrElse[List[TitleType]](List())
|
||||
if (titles.isEmpty) {
|
||||
return List()
|
||||
}
|
||||
|
||||
result.setTitle(
|
||||
titles
|
||||
.filter(t => t.title.nonEmpty)
|
||||
|
@ -191,9 +189,6 @@ object BioschemaToOAFTransformation {
|
|||
})
|
||||
.asJava
|
||||
)
|
||||
if (instance.getUrl.isEmpty) {
|
||||
return List()
|
||||
}
|
||||
instance.setCollectedfrom(collectedFromMap(datasourceKey))
|
||||
instance.setPid(result.getPid)
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
{
|
||||
"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
|
||||
def testPEDMapping(): Unit = {
|
||||
def testMapping(): Unit = {
|
||||
val record = Source
|
||||
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/ped_record.json"))
|
||||
.mkString
|
||||
|
@ -73,17 +73,4 @@ class BioschemaDataciteToOAFTest {
|
|||
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