From a203c33693a8589e9d1254d57fcfcea637c15bdb Mon Sep 17 00:00:00 2001 From: Enrico Ottonello Date: Wed, 6 Apr 2022 12:48:24 +0200 Subject: [PATCH] added disprot constants configuration --- .../bioschema/BioschemaModelConstants.scala | 18 +++++--- .../dnetlib/dhp/bioschema/disprot_record.json | 45 +++++++++++++++++++ .../BioschemaDataciteToOAFTest.scala | 15 ++++++- 3 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/bioschema/disprot_record.json diff --git a/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/bioschema/BioschemaModelConstants.scala b/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/bioschema/BioschemaModelConstants.scala index ce56305f5..729aa0ec0 100644 --- a/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/bioschema/BioschemaModelConstants.scala +++ b/dhp-workflows/dhp-aggregation/src/main/scala/eu/dnetlib/dhp/bioschema/BioschemaModelConstants.scala @@ -74,28 +74,36 @@ 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/uniprot:" -> "uniprot", + "https://identifiers.org/disprot:" -> "disprot" ) - + //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 + "ped" -> PEDCollectedFrom, + "disprot" -> DISPROTCollectedFrom ) } val datasourceKeyPrefix: Map[String, String] = Map( - "ped" -> PED_PREFIX + "ped" -> PED_PREFIX, + "disprot" -> DISPROT_PREFIX ) val REL_TYPE_VALUE: String = "resultResult" diff --git a/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/bioschema/disprot_record.json b/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/bioschema/disprot_record.json new file mode 100644 index 000000000..3689d65be --- /dev/null +++ b/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/bioschema/disprot_record.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/dhp-workflows/dhp-aggregation/src/test/scala/eu/dnetlib/dhp/bioschema/BioschemaDataciteToOAFTest.scala b/dhp-workflows/dhp-aggregation/src/test/scala/eu/dnetlib/dhp/bioschema/BioschemaDataciteToOAFTest.scala index 07647a0d7..7ffe10c2c 100644 --- a/dhp-workflows/dhp-aggregation/src/test/scala/eu/dnetlib/dhp/bioschema/BioschemaDataciteToOAFTest.scala +++ b/dhp-workflows/dhp-aggregation/src/test/scala/eu/dnetlib/dhp/bioschema/BioschemaDataciteToOAFTest.scala @@ -62,7 +62,7 @@ class BioschemaDataciteToOAFTest { } @Test - def testMapping(): Unit = { + def testPEDMapping(): Unit = { val record = Source .fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/ped_record.json")) .mkString @@ -73,4 +73,17 @@ 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("----------------------------") + }) + } }