From 5749d8f681262e94ee48fb358114ae208e0a2296 Mon Sep 17 00:00:00 2001 From: jh-RLI Date: Mon, 5 Dec 2022 16:43:51 +0100 Subject: [PATCH 01/33] add full example for proposal in #97 - oemetadata single ressource metainformation + schema - oemetadata datapackage collection of ressources in one datapackge possible, each ressource got its own metainformation + schema --- metadata/oemetadata_16_wip/oem_16_bundle.json | 808 ++++++++++++++++++ .../oemetadata_16_wip/oem_16_ressource.json | 401 +++++++++ 2 files changed, 1209 insertions(+) create mode 100644 metadata/oemetadata_16_wip/oem_16_bundle.json create mode 100644 metadata/oemetadata_16_wip/oem_16_ressource.json diff --git a/metadata/oemetadata_16_wip/oem_16_bundle.json b/metadata/oemetadata_16_wip/oem_16_bundle.json new file mode 100644 index 00000000..e7d19291 --- /dev/null +++ b/metadata/oemetadata_16_wip/oem_16_bundle.json @@ -0,0 +1,808 @@ +{ + "name": "", + "resources": [ + { + "profile": "tabular-data-resource", + "name": "model_draft.oep_metadata_table_example_v152", + "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "title": "Example title for metadata example - Version 1.5.2", + "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", + "language": [ + "en-GB", + "en-US", + "de-DE", + "fr-FR" + ], + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + }, + { + "name": "test dataset", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" + } + ], + "keywords": [ + "energy", + "example", + "template", + "test" + ], + "publicationDate": "2022-02-15", + "context": { + "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", + "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", + "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", + "contact": "https://github.com/Ludee", + "grantNo": "03EI1005", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": null, + "extent": "europe", + "resolution": "100 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2017-01-01T00:00+01", + "end": "2017-12-31T23:00+01", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + }, + { + "start": "2018-01-01T00:00+01", + "end": "2019-06-01T23:00+01", + "resolution": "15 min", + "alignment": "right", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "OpenEnergyPlatform Metadata Example", + "description": "Metadata description", + "path": "https://github.com/OpenEnergyPlatform", + "licenses": [ + { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt", + "attribution": "© Reiner Lemoine Institut" + } + ] + }, + { + "title": "OpenStreetMap", + "description": "A collaborative project to create a free editable map of the world", + "path": "https://www.openstreetmap.org/", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" + } + ], + "contributors": [ + { + "title": "Ludee", + "email": null, + "date": "2016-06-16", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update header and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-16", + "object": "metadata", + "comment": "Add license to source" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-28", + "object": "metadata", + "comment": "Add copyright to source and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-05-30", + "object": "metadata", + "comment": "Release metadata version 1.3" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-06-26", + "object": "metadata", + "comment": "Move referenceDate into temporal and remove array" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-19", + "object": "metadata", + "comment": "Start metadata version 1.4" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-26", + "object": "data", + "comment": "Rename table and files" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add contribution object" + }, + { + "title": "christian-rli", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add datapackage compatibility" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-11-02", + "object": "metadata", + "comment": "Release metadata version 1.4" + }, + { + "title": "christian-rli", + "email": null, + "date": "2019-02-05", + "object": "metadata", + "comment": "Apply template structure to example" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-03-22", + "object": "metadata", + "comment": "Hotfix foreignKeys" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-07-09", + "object": "metadata", + "comment": "Release metadata version OEP-1.3.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2021-11-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2022-02-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.1" + }, + { + "title": "jh-RLI", + "email": null, + "date": "2022-11-18", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.2" + } + ], + "format": "PostgreSQL", + "encoding": "UTF-8", + "dialect": { + "delimiter": null, + "decimalSeparator": "." + }, + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "serial", + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "name", + "description": "Example name", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "written name", + "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "type", + "description": "Type of wind farm", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" + } + ], + "valueReference": [ + { + "value": "onshore ", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + }, + { + "value": "offshore ", + "name": "offshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" + } + ] + }, + { + "name": "year", + "description": "Reference year", + "type": "integer", + "unit": null, + "isAbout": [ + { + "name": "year", + "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "value", + "description": "Example value", + "type": "double precision", + "unit": "MW", + "isAbout": [ + { + "name": "quantity value", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "geom", + "description": "Geometry", + "type": "geometry(Point, 4326)", + "unit": null, + "isAbout": [ + { + "name": "spatial region", + "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + "id" + ], + "foreignKeys": [ + { + "fields": [ + "year" + ], + "reference": { + "resource": "schema.table", + "fields": [ + "year" + ] + } + } + ] + }, + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", + "review": { + "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", + "badge": "Platinum" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.5.2", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "null": "If not applicable use: null", + "todo": "If a value is not yet available, use: todo" + } + }, + { + "profile": "tabular-data-resource", + "name": "model_draft.oep_metadata_table_example_v152", + "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "title": "Example title for metadata example - Version 1.5.2", + "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", + + "language": [ + "en-GB", + "en-US", + "de-DE", + "fr-FR" + ], + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + }, + { + "name": "test dataset", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" + } + ], + "keywords": [ + "energy", + "example", + "template", + "test" + ], + "publicationDate": "2022-02-15", + "context": { + "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", + "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", + "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", + "contact": "https://github.com/Ludee", + "grantNo": "03EI1005", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": null, + "extent": "europe", + "resolution": "100 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2017-01-01T00:00+01", + "end": "2017-12-31T23:00+01", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + }, + { + "start": "2018-01-01T00:00+01", + "end": "2019-06-01T23:00+01", + "resolution": "15 min", + "alignment": "right", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "OpenEnergyPlatform Metadata Example", + "description": "Metadata description", + "path": "https://github.com/OpenEnergyPlatform", + "licenses": [ + { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt", + "attribution": "© Reiner Lemoine Institut" + } + ] + }, + { + "title": "OpenStreetMap", + "description": "A collaborative project to create a free editable map of the world", + "path": "https://www.openstreetmap.org/", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" + } + ], + "contributors": [ + { + "title": "Ludee", + "email": null, + "date": "2016-06-16", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update header and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-16", + "object": "metadata", + "comment": "Add license to source" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-28", + "object": "metadata", + "comment": "Add copyright to source and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-05-30", + "object": "metadata", + "comment": "Release metadata version 1.3" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-06-26", + "object": "metadata", + "comment": "Move referenceDate into temporal and remove array" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-19", + "object": "metadata", + "comment": "Start metadata version 1.4" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-26", + "object": "data", + "comment": "Rename table and files" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add contribution object" + }, + { + "title": "christian-rli", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add datapackage compatibility" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-11-02", + "object": "metadata", + "comment": "Release metadata version 1.4" + }, + { + "title": "christian-rli", + "email": null, + "date": "2019-02-05", + "object": "metadata", + "comment": "Apply template structure to example" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-03-22", + "object": "metadata", + "comment": "Hotfix foreignKeys" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-07-09", + "object": "metadata", + "comment": "Release metadata version OEP-1.3.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2021-11-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2022-02-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.1" + }, + { + "title": "jh-RLI", + "email": null, + "date": "2022-11-18", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.2" + } + ], + "format": "PostgreSQL", + "encoding": "UTF-8", + "dialect": { + "delimiter": null, + "decimalSeparator": "." + }, + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "serial", + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "name", + "description": "Example name", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "written name", + "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "type", + "description": "Type of wind farm", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" + } + ], + "valueReference": [ + { + "value": "onshore ", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + }, + { + "value": "offshore ", + "name": "offshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" + } + ] + }, + { + "name": "year", + "description": "Reference year", + "type": "integer", + "unit": null, + "isAbout": [ + { + "name": "year", + "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "value", + "description": "Example value", + "type": "double precision", + "unit": "MW", + "isAbout": [ + { + "name": "quantity value", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "geom", + "description": "Geometry", + "type": "geometry(Point, 4326)", + "unit": null, + "isAbout": [ + { + "name": "spatial region", + "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + "id" + ], + "foreignKeys": [ + { + "fields": [ + "year" + ], + "reference": { + "resource": "schema.table", + "fields": [ + "year" + ] + } + } + ] + }, + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", + "review": { + "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", + "badge": "Platinum" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.5.2", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "null": "If not applicable use: null", + "todo": "If a value is not yet available, use: todo" + } + } + ] +} \ No newline at end of file diff --git a/metadata/oemetadata_16_wip/oem_16_ressource.json b/metadata/oemetadata_16_wip/oem_16_ressource.json new file mode 100644 index 00000000..0887d59d --- /dev/null +++ b/metadata/oemetadata_16_wip/oem_16_ressource.json @@ -0,0 +1,401 @@ +{ + "profile": "tabular-data-resource", + "name": "model_draft.oep_metadata_table_example_v152", + "title": "Example title for metadata example - Version 1.5.2", + "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", + "language": [ + "en-GB", + "en-US", + "de-DE", + "fr-FR" + ], + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + }, + { + "name": "test dataset", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" + } + ], + "keywords": [ + "energy", + "example", + "template", + "test" + ], + "publicationDate": "2022-02-15", + "context": { + "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", + "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", + "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", + "contact": "https://github.com/Ludee", + "grantNo": "03EI1005", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": null, + "extent": "europe", + "resolution": "100 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2017-01-01T00:00+01", + "end": "2017-12-31T23:00+01", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + }, + { + "start": "2018-01-01T00:00+01", + "end": "2019-06-01T23:00+01", + "resolution": "15 min", + "alignment": "right", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "OpenEnergyPlatform Metadata Example", + "description": "Metadata description", + "path": "https://github.com/OpenEnergyPlatform", + "licenses": [ + { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt", + "attribution": "© Reiner Lemoine Institut" + } + ] + }, + { + "title": "OpenStreetMap", + "description": "A collaborative project to create a free editable map of the world", + "path": "https://www.openstreetmap.org/", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" + } + ], + "contributors": [ + { + "title": "Ludee", + "email": null, + "date": "2016-06-16", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update header and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-16", + "object": "metadata", + "comment": "Add license to source" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-28", + "object": "metadata", + "comment": "Add copyright to source and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-05-30", + "object": "metadata", + "comment": "Release metadata version 1.3" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-06-26", + "object": "metadata", + "comment": "Move referenceDate into temporal and remove array" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-19", + "object": "metadata", + "comment": "Start metadata version 1.4" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-26", + "object": "data", + "comment": "Rename table and files" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add contribution object" + }, + { + "title": "christian-rli", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add datapackage compatibility" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-11-02", + "object": "metadata", + "comment": "Release metadata version 1.4" + }, + { + "title": "christian-rli", + "email": null, + "date": "2019-02-05", + "object": "metadata", + "comment": "Apply template structure to example" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-03-22", + "object": "metadata", + "comment": "Hotfix foreignKeys" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-07-09", + "object": "metadata", + "comment": "Release metadata version OEP-1.3.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2021-11-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2022-02-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.1" + }, + { + "title": "jh-RLI", + "email": null, + "date": "2022-11-18", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.2" + } + ], + "format": "PostgreSQL", + "encoding": "UTF-8", + "dialect": { + "delimiter": null, + "decimalSeparator": "." + }, + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "serial", + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "name", + "description": "Example name", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "written name", + "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "type", + "description": "Type of wind farm", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" + } + ], + "valueReference": [ + { + "value": "onshore ", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + }, + { + "value": "offshore ", + "name": "offshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" + } + ] + }, + { + "name": "year", + "description": "Reference year", + "type": "integer", + "unit": null, + "isAbout": [ + { + "name": "year", + "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "value", + "description": "Example value", + "type": "double precision", + "unit": "MW", + "isAbout": [ + { + "name": "quantity value", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "geom", + "description": "Geometry", + "type": "geometry(Point, 4326)", + "unit": null, + "isAbout": [ + { + "name": "spatial region", + "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + "id" + ], + "foreignKeys": [ + { + "fields": [ + "year" + ], + "reference": { + "resource": "schema.table", + "fields": [ + "year" + ] + } + } + ] + }, + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", + "review": { + "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", + "badge": "Platinum" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.5.2", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "null": "If not applicable use: null", + "todo": "If a value is not yet available, use: todo" + } +} \ No newline at end of file From b7389886fc514b7c5d6d1637c49ac07190e59e04 Mon Sep 17 00:00:00 2001 From: wingechr Date: Mon, 5 Dec 2022 17:45:50 +0100 Subject: [PATCH 02/33] Update oem_16_ressource.json --- metadata/oemetadata_16_wip/oem_16_ressource.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/metadata/oemetadata_16_wip/oem_16_ressource.json b/metadata/oemetadata_16_wip/oem_16_ressource.json index 0887d59d..21ac90ba 100644 --- a/metadata/oemetadata_16_wip/oem_16_ressource.json +++ b/metadata/oemetadata_16_wip/oem_16_ressource.json @@ -1,6 +1,5 @@ { - "profile": "tabular-data-resource", - "name": "model_draft.oep_metadata_table_example_v152", + "name": "oep_metadata_table_example_v152", "title": "Example title for metadata example - Version 1.5.2", "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", @@ -229,12 +228,6 @@ "comment": "Release metadata version OEP-1.5.2" } ], - "format": "PostgreSQL", - "encoding": "UTF-8", - "dialect": { - "delimiter": null, - "decimalSeparator": "." - }, "schema": { "fields": [ { @@ -366,7 +359,7 @@ "year" ], "reference": { - "resource": "schema.table", + "resource": "table", "fields": [ "year" ] @@ -398,4 +391,4 @@ "null": "If not applicable use: null", "todo": "If a value is not yet available, use: todo" } -} \ No newline at end of file +} From 289c890cc75e853c3d0eca9c2b262b1f4346384b Mon Sep 17 00:00:00 2001 From: wingechr Date: Mon, 5 Dec 2022 17:46:38 +0100 Subject: [PATCH 03/33] Update oem_16_bundle.json --- metadata/oemetadata_16_wip/oem_16_bundle.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata/oemetadata_16_wip/oem_16_bundle.json b/metadata/oemetadata_16_wip/oem_16_bundle.json index e7d19291..498d259d 100644 --- a/metadata/oemetadata_16_wip/oem_16_bundle.json +++ b/metadata/oemetadata_16_wip/oem_16_bundle.json @@ -4,7 +4,7 @@ { "profile": "tabular-data-resource", "name": "model_draft.oep_metadata_table_example_v152", - "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "path": "data/oep_metadata_table_example_v152.csv", "title": "Example title for metadata example - Version 1.5.2", "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", @@ -805,4 +805,4 @@ } } ] -} \ No newline at end of file +} From e84f3040ec83a9a66eb390d3043d49904d699357 Mon Sep 17 00:00:00 2001 From: wingechr Date: Mon, 5 Dec 2022 17:51:06 +0100 Subject: [PATCH 04/33] Update oem_16_bundle.json --- metadata/oemetadata_16_wip/oem_16_bundle.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata/oemetadata_16_wip/oem_16_bundle.json b/metadata/oemetadata_16_wip/oem_16_bundle.json index 498d259d..9ce1c950 100644 --- a/metadata/oemetadata_16_wip/oem_16_bundle.json +++ b/metadata/oemetadata_16_wip/oem_16_bundle.json @@ -232,10 +232,10 @@ "comment": "Release metadata version OEP-1.5.2" } ], - "format": "PostgreSQL", - "encoding": "UTF-8", + "format": "csv", + "encoding": "utf-8", "dialect": { - "delimiter": null, + "delimiter": ",", "decimalSeparator": "." }, "schema": { From f1cead4de3576892b2e57f0b0b235f88daffb489 Mon Sep 17 00:00:00 2001 From: jh-RLI Date: Tue, 11 Apr 2023 14:06:37 +0200 Subject: [PATCH 05/33] remove outdated folders --- metadata/oemetadata_16_wip/oem_16_bundle.json | 808 ------------------ .../oemetadata_16_wip/oem_16_ressource.json | 394 --------- 2 files changed, 1202 deletions(-) delete mode 100644 metadata/oemetadata_16_wip/oem_16_bundle.json delete mode 100644 metadata/oemetadata_16_wip/oem_16_ressource.json diff --git a/metadata/oemetadata_16_wip/oem_16_bundle.json b/metadata/oemetadata_16_wip/oem_16_bundle.json deleted file mode 100644 index 9ce1c950..00000000 --- a/metadata/oemetadata_16_wip/oem_16_bundle.json +++ /dev/null @@ -1,808 +0,0 @@ -{ - "name": "", - "resources": [ - { - "profile": "tabular-data-resource", - "name": "model_draft.oep_metadata_table_example_v152", - "path": "data/oep_metadata_table_example_v152.csv", - "title": "Example title for metadata example - Version 1.5.2", - "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", - "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", - "language": [ - "en-GB", - "en-US", - "de-DE", - "fr-FR" - ], - "subject": [ - { - "name": "energy", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" - }, - { - "name": "test dataset", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" - } - ], - "keywords": [ - "energy", - "example", - "template", - "test" - ], - "publicationDate": "2022-02-15", - "context": { - "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", - "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", - "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", - "contact": "https://github.com/Ludee", - "grantNo": "03EI1005", - "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", - "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", - "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" - }, - "spatial": { - "location": null, - "extent": "europe", - "resolution": "100 m" - }, - "temporal": { - "referenceDate": "2016-01-01", - "timeseries": [ - { - "start": "2017-01-01T00:00+01", - "end": "2017-12-31T23:00+01", - "resolution": "1 h", - "alignment": "left", - "aggregationType": "sum" - }, - { - "start": "2018-01-01T00:00+01", - "end": "2019-06-01T23:00+01", - "resolution": "15 min", - "alignment": "right", - "aggregationType": "sum" - } - ] - }, - "sources": [ - { - "title": "OpenEnergyPlatform Metadata Example", - "description": "Metadata description", - "path": "https://github.com/OpenEnergyPlatform", - "licenses": [ - { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", - "instruction": "You are free: To Share, To Create, To Adapt", - "attribution": "© Reiner Lemoine Institut" - } - ] - }, - { - "title": "OpenStreetMap", - "description": "A collaborative project to create a free editable map of the world", - "path": "https://www.openstreetmap.org/", - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", - "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", - "attribution": "© OpenStreetMap contributors" - } - ] - } - ], - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1.0/", - "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", - "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" - } - ], - "contributors": [ - { - "title": "Ludee", - "email": null, - "date": "2016-06-16", - "object": "metadata", - "comment": "Create metadata" - }, - { - "title": "Ludee", - "email": null, - "date": "2016-11-22", - "object": "metadata", - "comment": "Update metadata" - }, - { - "title": "Ludee", - "email": null, - "date": "2016-11-22", - "object": "metadata", - "comment": "Update header and license" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-03-16", - "object": "metadata", - "comment": "Add license to source" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-03-28", - "object": "metadata", - "comment": "Add copyright to source and license" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-05-30", - "object": "metadata", - "comment": "Release metadata version 1.3" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-06-26", - "object": "metadata", - "comment": "Move referenceDate into temporal and remove array" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-07-19", - "object": "metadata", - "comment": "Start metadata version 1.4" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-07-26", - "object": "data", - "comment": "Rename table and files" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-10-18", - "object": "metadata", - "comment": "Add contribution object" - }, - { - "title": "christian-rli", - "email": null, - "date": "2018-10-18", - "object": "metadata", - "comment": "Add datapackage compatibility" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-11-02", - "object": "metadata", - "comment": "Release metadata version 1.4" - }, - { - "title": "christian-rli", - "email": null, - "date": "2019-02-05", - "object": "metadata", - "comment": "Apply template structure to example" - }, - { - "title": "Ludee", - "email": null, - "date": "2019-03-22", - "object": "metadata", - "comment": "Hotfix foreignKeys" - }, - { - "title": "Ludee", - "email": null, - "date": "2019-07-09", - "object": "metadata", - "comment": "Release metadata version OEP-1.3.0" - }, - { - "title": "Ludee", - "email": null, - "date": "2021-11-15", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.0" - }, - { - "title": "Ludee", - "email": null, - "date": "2022-02-15", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.1" - }, - { - "title": "jh-RLI", - "email": null, - "date": "2022-11-18", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.2" - } - ], - "format": "csv", - "encoding": "utf-8", - "dialect": { - "delimiter": ",", - "decimalSeparator": "." - }, - "schema": { - "fields": [ - { - "name": "id", - "description": "Unique identifier", - "type": "serial", - "unit": null, - "isAbout": [ - { - "name": null, - "path": null - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "name", - "description": "Example name", - "type": "text", - "unit": null, - "isAbout": [ - { - "name": "written name", - "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "type", - "description": "Type of wind farm", - "type": "text", - "unit": null, - "isAbout": [ - { - "name": "wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" - } - ], - "valueReference": [ - { - "value": "onshore ", - "name": "onshore wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" - }, - { - "value": "offshore ", - "name": "offshore wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" - } - ] - }, - { - "name": "year", - "description": "Reference year", - "type": "integer", - "unit": null, - "isAbout": [ - { - "name": "year", - "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "value", - "description": "Example value", - "type": "double precision", - "unit": "MW", - "isAbout": [ - { - "name": "quantity value", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "geom", - "description": "Geometry", - "type": "geometry(Point, 4326)", - "unit": null, - "isAbout": [ - { - "name": "spatial region", - "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - } - ], - "primaryKey": [ - "id" - ], - "foreignKeys": [ - { - "fields": [ - "year" - ], - "reference": { - "resource": "schema.table", - "fields": [ - "year" - ] - } - } - ] - }, - "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", - "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", - "review": { - "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", - "badge": "Platinum" - }, - "metaMetadata": { - "metadataVersion": "OEP-1.5.2", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - }, - "_comment": { - "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", - "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", - "units": "Use a space between numbers and units (100 m)", - "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", - "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", - "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", - "null": "If not applicable use: null", - "todo": "If a value is not yet available, use: todo" - } - }, - { - "profile": "tabular-data-resource", - "name": "model_draft.oep_metadata_table_example_v152", - "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", - "title": "Example title for metadata example - Version 1.5.2", - "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", - "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", - - "language": [ - "en-GB", - "en-US", - "de-DE", - "fr-FR" - ], - "subject": [ - { - "name": "energy", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" - }, - { - "name": "test dataset", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" - } - ], - "keywords": [ - "energy", - "example", - "template", - "test" - ], - "publicationDate": "2022-02-15", - "context": { - "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", - "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", - "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", - "contact": "https://github.com/Ludee", - "grantNo": "03EI1005", - "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", - "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", - "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" - }, - "spatial": { - "location": null, - "extent": "europe", - "resolution": "100 m" - }, - "temporal": { - "referenceDate": "2016-01-01", - "timeseries": [ - { - "start": "2017-01-01T00:00+01", - "end": "2017-12-31T23:00+01", - "resolution": "1 h", - "alignment": "left", - "aggregationType": "sum" - }, - { - "start": "2018-01-01T00:00+01", - "end": "2019-06-01T23:00+01", - "resolution": "15 min", - "alignment": "right", - "aggregationType": "sum" - } - ] - }, - "sources": [ - { - "title": "OpenEnergyPlatform Metadata Example", - "description": "Metadata description", - "path": "https://github.com/OpenEnergyPlatform", - "licenses": [ - { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", - "instruction": "You are free: To Share, To Create, To Adapt", - "attribution": "© Reiner Lemoine Institut" - } - ] - }, - { - "title": "OpenStreetMap", - "description": "A collaborative project to create a free editable map of the world", - "path": "https://www.openstreetmap.org/", - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", - "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", - "attribution": "© OpenStreetMap contributors" - } - ] - } - ], - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1.0/", - "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", - "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" - } - ], - "contributors": [ - { - "title": "Ludee", - "email": null, - "date": "2016-06-16", - "object": "metadata", - "comment": "Create metadata" - }, - { - "title": "Ludee", - "email": null, - "date": "2016-11-22", - "object": "metadata", - "comment": "Update metadata" - }, - { - "title": "Ludee", - "email": null, - "date": "2016-11-22", - "object": "metadata", - "comment": "Update header and license" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-03-16", - "object": "metadata", - "comment": "Add license to source" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-03-28", - "object": "metadata", - "comment": "Add copyright to source and license" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-05-30", - "object": "metadata", - "comment": "Release metadata version 1.3" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-06-26", - "object": "metadata", - "comment": "Move referenceDate into temporal and remove array" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-07-19", - "object": "metadata", - "comment": "Start metadata version 1.4" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-07-26", - "object": "data", - "comment": "Rename table and files" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-10-18", - "object": "metadata", - "comment": "Add contribution object" - }, - { - "title": "christian-rli", - "email": null, - "date": "2018-10-18", - "object": "metadata", - "comment": "Add datapackage compatibility" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-11-02", - "object": "metadata", - "comment": "Release metadata version 1.4" - }, - { - "title": "christian-rli", - "email": null, - "date": "2019-02-05", - "object": "metadata", - "comment": "Apply template structure to example" - }, - { - "title": "Ludee", - "email": null, - "date": "2019-03-22", - "object": "metadata", - "comment": "Hotfix foreignKeys" - }, - { - "title": "Ludee", - "email": null, - "date": "2019-07-09", - "object": "metadata", - "comment": "Release metadata version OEP-1.3.0" - }, - { - "title": "Ludee", - "email": null, - "date": "2021-11-15", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.0" - }, - { - "title": "Ludee", - "email": null, - "date": "2022-02-15", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.1" - }, - { - "title": "jh-RLI", - "email": null, - "date": "2022-11-18", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.2" - } - ], - "format": "PostgreSQL", - "encoding": "UTF-8", - "dialect": { - "delimiter": null, - "decimalSeparator": "." - }, - "schema": { - "fields": [ - { - "name": "id", - "description": "Unique identifier", - "type": "serial", - "unit": null, - "isAbout": [ - { - "name": null, - "path": null - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "name", - "description": "Example name", - "type": "text", - "unit": null, - "isAbout": [ - { - "name": "written name", - "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "type", - "description": "Type of wind farm", - "type": "text", - "unit": null, - "isAbout": [ - { - "name": "wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" - } - ], - "valueReference": [ - { - "value": "onshore ", - "name": "onshore wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" - }, - { - "value": "offshore ", - "name": "offshore wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" - } - ] - }, - { - "name": "year", - "description": "Reference year", - "type": "integer", - "unit": null, - "isAbout": [ - { - "name": "year", - "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "value", - "description": "Example value", - "type": "double precision", - "unit": "MW", - "isAbout": [ - { - "name": "quantity value", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "geom", - "description": "Geometry", - "type": "geometry(Point, 4326)", - "unit": null, - "isAbout": [ - { - "name": "spatial region", - "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - } - ], - "primaryKey": [ - "id" - ], - "foreignKeys": [ - { - "fields": [ - "year" - ], - "reference": { - "resource": "schema.table", - "fields": [ - "year" - ] - } - } - ] - }, - "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", - "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", - "review": { - "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", - "badge": "Platinum" - }, - "metaMetadata": { - "metadataVersion": "OEP-1.5.2", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - }, - "_comment": { - "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", - "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", - "units": "Use a space between numbers and units (100 m)", - "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", - "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", - "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", - "null": "If not applicable use: null", - "todo": "If a value is not yet available, use: todo" - } - } - ] -} diff --git a/metadata/oemetadata_16_wip/oem_16_ressource.json b/metadata/oemetadata_16_wip/oem_16_ressource.json deleted file mode 100644 index 21ac90ba..00000000 --- a/metadata/oemetadata_16_wip/oem_16_ressource.json +++ /dev/null @@ -1,394 +0,0 @@ -{ - "name": "oep_metadata_table_example_v152", - "title": "Example title for metadata example - Version 1.5.2", - "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", - "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", - "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", - "language": [ - "en-GB", - "en-US", - "de-DE", - "fr-FR" - ], - "subject": [ - { - "name": "energy", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" - }, - { - "name": "test dataset", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" - } - ], - "keywords": [ - "energy", - "example", - "template", - "test" - ], - "publicationDate": "2022-02-15", - "context": { - "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", - "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", - "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", - "contact": "https://github.com/Ludee", - "grantNo": "03EI1005", - "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", - "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", - "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" - }, - "spatial": { - "location": null, - "extent": "europe", - "resolution": "100 m" - }, - "temporal": { - "referenceDate": "2016-01-01", - "timeseries": [ - { - "start": "2017-01-01T00:00+01", - "end": "2017-12-31T23:00+01", - "resolution": "1 h", - "alignment": "left", - "aggregationType": "sum" - }, - { - "start": "2018-01-01T00:00+01", - "end": "2019-06-01T23:00+01", - "resolution": "15 min", - "alignment": "right", - "aggregationType": "sum" - } - ] - }, - "sources": [ - { - "title": "OpenEnergyPlatform Metadata Example", - "description": "Metadata description", - "path": "https://github.com/OpenEnergyPlatform", - "licenses": [ - { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", - "instruction": "You are free: To Share, To Create, To Adapt", - "attribution": "© Reiner Lemoine Institut" - } - ] - }, - { - "title": "OpenStreetMap", - "description": "A collaborative project to create a free editable map of the world", - "path": "https://www.openstreetmap.org/", - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", - "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", - "attribution": "© OpenStreetMap contributors" - } - ] - } - ], - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1.0/", - "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", - "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" - } - ], - "contributors": [ - { - "title": "Ludee", - "email": null, - "date": "2016-06-16", - "object": "metadata", - "comment": "Create metadata" - }, - { - "title": "Ludee", - "email": null, - "date": "2016-11-22", - "object": "metadata", - "comment": "Update metadata" - }, - { - "title": "Ludee", - "email": null, - "date": "2016-11-22", - "object": "metadata", - "comment": "Update header and license" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-03-16", - "object": "metadata", - "comment": "Add license to source" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-03-28", - "object": "metadata", - "comment": "Add copyright to source and license" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-05-30", - "object": "metadata", - "comment": "Release metadata version 1.3" - }, - { - "title": "Ludee", - "email": null, - "date": "2017-06-26", - "object": "metadata", - "comment": "Move referenceDate into temporal and remove array" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-07-19", - "object": "metadata", - "comment": "Start metadata version 1.4" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-07-26", - "object": "data", - "comment": "Rename table and files" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-10-18", - "object": "metadata", - "comment": "Add contribution object" - }, - { - "title": "christian-rli", - "email": null, - "date": "2018-10-18", - "object": "metadata", - "comment": "Add datapackage compatibility" - }, - { - "title": "Ludee", - "email": null, - "date": "2018-11-02", - "object": "metadata", - "comment": "Release metadata version 1.4" - }, - { - "title": "christian-rli", - "email": null, - "date": "2019-02-05", - "object": "metadata", - "comment": "Apply template structure to example" - }, - { - "title": "Ludee", - "email": null, - "date": "2019-03-22", - "object": "metadata", - "comment": "Hotfix foreignKeys" - }, - { - "title": "Ludee", - "email": null, - "date": "2019-07-09", - "object": "metadata", - "comment": "Release metadata version OEP-1.3.0" - }, - { - "title": "Ludee", - "email": null, - "date": "2021-11-15", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.0" - }, - { - "title": "Ludee", - "email": null, - "date": "2022-02-15", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.1" - }, - { - "title": "jh-RLI", - "email": null, - "date": "2022-11-18", - "object": "metadata", - "comment": "Release metadata version OEP-1.5.2" - } - ], - "schema": { - "fields": [ - { - "name": "id", - "description": "Unique identifier", - "type": "serial", - "unit": null, - "isAbout": [ - { - "name": null, - "path": null - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "name", - "description": "Example name", - "type": "text", - "unit": null, - "isAbout": [ - { - "name": "written name", - "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "type", - "description": "Type of wind farm", - "type": "text", - "unit": null, - "isAbout": [ - { - "name": "wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" - } - ], - "valueReference": [ - { - "value": "onshore ", - "name": "onshore wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" - }, - { - "value": "offshore ", - "name": "offshore wind farm", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" - } - ] - }, - { - "name": "year", - "description": "Reference year", - "type": "integer", - "unit": null, - "isAbout": [ - { - "name": "year", - "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "value", - "description": "Example value", - "type": "double precision", - "unit": "MW", - "isAbout": [ - { - "name": "quantity value", - "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": "geom", - "description": "Geometry", - "type": "geometry(Point, 4326)", - "unit": null, - "isAbout": [ - { - "name": "spatial region", - "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - } - ], - "primaryKey": [ - "id" - ], - "foreignKeys": [ - { - "fields": [ - "year" - ], - "reference": { - "resource": "table", - "fields": [ - "year" - ] - } - } - ] - }, - "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", - "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", - "review": { - "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", - "badge": "Platinum" - }, - "metaMetadata": { - "metadataVersion": "OEP-1.5.2", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - }, - "_comment": { - "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", - "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", - "units": "Use a space between numbers and units (100 m)", - "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", - "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", - "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", - "null": "If not applicable use: null", - "todo": "If a value is not yet available, use: todo" - } -} From ace8e7211effacc34148643943160faa55399e32 Mon Sep 17 00:00:00 2001 From: jh-RLI Date: Tue, 11 Apr 2023 14:07:09 +0200 Subject: [PATCH 06/33] add draft v200 metadata files --- metadata/v200_draft/example_multi_table.json | 808 +++++++++++++++++++ metadata/v200_draft/template.json | 186 +++++ 2 files changed, 994 insertions(+) create mode 100644 metadata/v200_draft/example_multi_table.json create mode 100644 metadata/v200_draft/template.json diff --git a/metadata/v200_draft/example_multi_table.json b/metadata/v200_draft/example_multi_table.json new file mode 100644 index 00000000..2353ec9b --- /dev/null +++ b/metadata/v200_draft/example_multi_table.json @@ -0,0 +1,808 @@ +{ + "name": "", // Datapackage name + "resources": [ + { + "profile": "tabular-data-resource", // Just for CSV, not relevant on server + "name": "model_draft.oep_metadata_table_example_v152", // Table name + "path": "data/oep_metadata_table_example_v152.csv", // Local path to CSV and on server URL to table + "format": "csv", + "encoding": "utf-8", + "dialect": { + "delimiter": ",", + "decimalSeparator": "." + }, + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "serial", + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "name", + "description": "Example name", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "written name", + "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "type", + "description": "Type of wind farm", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" + } + ], + "valueReference": [ + { + "value": "onshore ", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + }, + { + "value": "offshore ", + "name": "offshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" + } + ] + }, + { + "name": "year", + "description": "Reference year", + "type": "integer", + "unit": null, + "isAbout": [ + { + "name": "year", + "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "value", + "description": "Example value", + "type": "double precision", + "unit": "MW", + "isAbout": [ + { + "name": "quantity value", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "geom", + "description": "Geometry", + "type": "geometry(Point, 4326)", + "unit": null, + "isAbout": [ + { + "name": "spatial region", + "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + "id" + ], + "foreignKeys": [ + { + "fields": [ + "year" + ], + "reference": { + "resource": "schema.table", + "fields": [ + "year" + ] + } + } + ] + }, + "title": "Example title for metadata example - Version 1.5.2", // Display title + "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", + "language": [ + "en-GB", + "en-US", + "de-DE", + "fr-FR" + ], + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + }, + { + "name": "test dataset", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" + } + ], + "keywords": [ + "energy", + "example", + "template", + "test" + ], + "publicationDate": "2022-02-15", + "context": { + "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", + "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", + "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", + "contact": "https://github.com/Ludee", + "grantNo": "03EI1005", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": null, + "extent": "europe", + "resolution": "100 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2017-01-01T00:00+01", + "end": "2017-12-31T23:00+01", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + }, + { + "start": "2018-01-01T00:00+01", + "end": "2019-06-01T23:00+01", + "resolution": "15 min", + "alignment": "right", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "OpenEnergyPlatform Metadata Example", + "description": "Metadata description", + "path": "https://github.com/OpenEnergyPlatform", + "licenses": [ + { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt", + "attribution": "© Reiner Lemoine Institut" + } + ] + }, + { + "title": "OpenStreetMap", + "description": "A collaborative project to create a free editable map of the world", + "path": "https://www.openstreetmap.org/", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" + } + ], + "contributors": [ + { + "title": "Ludee", + "email": null, + "date": "2016-06-16", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update header and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-16", + "object": "metadata", + "comment": "Add license to source" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-28", + "object": "metadata", + "comment": "Add copyright to source and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-05-30", + "object": "metadata", + "comment": "Release metadata version 1.3" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-06-26", + "object": "metadata", + "comment": "Move referenceDate into temporal and remove array" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-19", + "object": "metadata", + "comment": "Start metadata version 1.4" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-26", + "object": "data", + "comment": "Rename table and files" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add contribution object" + }, + { + "title": "christian-rli", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add datapackage compatibility" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-11-02", + "object": "metadata", + "comment": "Release metadata version 1.4" + }, + { + "title": "christian-rli", + "email": null, + "date": "2019-02-05", + "object": "metadata", + "comment": "Apply template structure to example" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-03-22", + "object": "metadata", + "comment": "Hotfix foreignKeys" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-07-09", + "object": "metadata", + "comment": "Release metadata version OEP-1.3.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2021-11-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2022-02-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.1" + }, + { + "title": "jh-RLI", + "email": null, + "date": "2022-11-18", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.2" + } + ], + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", + "review": { + "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", + "badge": "Platinum" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.5.2", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "null": "If not applicable use: null", + "todo": "If a value is not yet available, use: todo" + } + }, + { + "profile": "tabular-data-resource", + "name": "model_draft.oep_metadata_table_example_v152", + "path": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "title": "Example title for metadata example - Version 1.5.2", + "id": "http://openenergyplatform.org/dataedit/view/model_draft/oep_metadata_table_example_v152", + "description": "This is an metadata example for example data. There is a corresponding table on the OEP for each metadata version.", + + "language": [ + "en-GB", + "en-US", + "de-DE", + "fr-FR" + ], + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + }, + { + "name": "test dataset", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000408" + } + ], + "keywords": [ + "energy", + "example", + "template", + "test" + ], + "publicationDate": "2022-02-15", + "context": { + "homepage": "https://reiner-lemoine-institut.de/lod-geoss/", + "documentation": "https://openenergy-platform.org/tutorials/jupyter/OEMetadata/", + "sourceCode": "https://github.com/OpenEnergyPlatform/oemetadata/tree/master", + "contact": "https://github.com/Ludee", + "grantNo": "03EI1005", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": null, + "extent": "europe", + "resolution": "100 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2017-01-01T00:00+01", + "end": "2017-12-31T23:00+01", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + }, + { + "start": "2018-01-01T00:00+01", + "end": "2019-06-01T23:00+01", + "resolution": "15 min", + "alignment": "right", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "OpenEnergyPlatform Metadata Example", + "description": "Metadata description", + "path": "https://github.com/OpenEnergyPlatform", + "licenses": [ + { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt", + "attribution": "© Reiner Lemoine Institut" + } + ] + }, + { + "title": "OpenStreetMap", + "description": "A collaborative project to create a free editable map of the world", + "path": "https://www.openstreetmap.org/", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "© Reiner Lemoine Institut © OpenStreetMap contributors" + } + ], + "contributors": [ + { + "title": "Ludee", + "email": null, + "date": "2016-06-16", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update metadata" + }, + { + "title": "Ludee", + "email": null, + "date": "2016-11-22", + "object": "metadata", + "comment": "Update header and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-16", + "object": "metadata", + "comment": "Add license to source" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-03-28", + "object": "metadata", + "comment": "Add copyright to source and license" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-05-30", + "object": "metadata", + "comment": "Release metadata version 1.3" + }, + { + "title": "Ludee", + "email": null, + "date": "2017-06-26", + "object": "metadata", + "comment": "Move referenceDate into temporal and remove array" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-19", + "object": "metadata", + "comment": "Start metadata version 1.4" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-07-26", + "object": "data", + "comment": "Rename table and files" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add contribution object" + }, + { + "title": "christian-rli", + "email": null, + "date": "2018-10-18", + "object": "metadata", + "comment": "Add datapackage compatibility" + }, + { + "title": "Ludee", + "email": null, + "date": "2018-11-02", + "object": "metadata", + "comment": "Release metadata version 1.4" + }, + { + "title": "christian-rli", + "email": null, + "date": "2019-02-05", + "object": "metadata", + "comment": "Apply template structure to example" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-03-22", + "object": "metadata", + "comment": "Hotfix foreignKeys" + }, + { + "title": "Ludee", + "email": null, + "date": "2019-07-09", + "object": "metadata", + "comment": "Release metadata version OEP-1.3.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2021-11-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.0" + }, + { + "title": "Ludee", + "email": null, + "date": "2022-02-15", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.1" + }, + { + "title": "jh-RLI", + "email": null, + "date": "2022-11-18", + "object": "metadata", + "comment": "Release metadata version OEP-1.5.2" + } + ], + "format": "PostgreSQL", + "encoding": "UTF-8", + "dialect": { + "delimiter": null, + "decimalSeparator": "." + }, + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "serial", + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "name", + "description": "Example name", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "written name", + "path": "https://openenergy-platform.org/ontology/oeo/IAO_0000590" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "type", + "description": "Type of wind farm", + "type": "text", + "unit": null, + "isAbout": [ + { + "name": "wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000447" + } + ], + "valueReference": [ + { + "value": "onshore ", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + }, + { + "value": "offshore ", + "name": "offshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000308" + } + ] + }, + { + "name": "year", + "description": "Reference year", + "type": "integer", + "unit": null, + "isAbout": [ + { + "name": "year", + "path": "https://openenergy-platform.org/ontology/oeo/UO_0000036" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "value", + "description": "Example value", + "type": "double precision", + "unit": "MW", + "isAbout": [ + { + "name": "quantity value", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000350" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": "geom", + "description": "Geometry", + "type": "geometry(Point, 4326)", + "unit": null, + "isAbout": [ + { + "name": "spatial region", + "path": "https://openenergy-platform.org/ontology/oeo/BFO_0000006" + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + "id" + ], + "foreignKeys": [ + { + "fields": [ + "year" + ], + "reference": { + "resource": "schema.table", + "fields": [ + "year" + ] + } + } + ] + }, + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json", + "review": { + "path": "https://github.com/OpenEnergyPlatform/data-preprocessing/issues", + "badge": "Platinum" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.5.2", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "null": "If not applicable use: null", + "todo": "If a value is not yet available, use: todo" + } + } + ] +} diff --git a/metadata/v200_draft/template.json b/metadata/v200_draft/template.json new file mode 100644 index 00000000..73d23e3c --- /dev/null +++ b/metadata/v200_draft/template.json @@ -0,0 +1,186 @@ +{ + "name": null, + "ressources": [ + { + "name": null, + "dialect": { + "delimiter": null, + "decimalSeparator": "." + }, + "profile": null, + "path": null, + "format": null, + "encoding": null, + "schema": { + "fields": [ + { + "name": null, + "description": null, + "type": null, + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": null, + "description": null, + "type": null, + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + null + ], + "foreignKeys": [ + { + "fields": [ + null + ], + "reference": { + "resource": null, + "fields": [ + null + ] + } + } + ] + }, + "title": null, + "id": null, + "description": null, + "language": [ + null + ], + "subject": [ + { + "name": null, + "path": null + } + ], + "keywords": [ + null + ], + "publicationDate": null, + "context": { + "homepage": null, + "documentation": null, + "sourceCode": null, + "contact": null, + "grantNo": null, + "fundingAgency": null, + "fundingAgencyLogo": null, + "publisherLogo": null + }, + "spatial": { + "location": null, + "extent": null, + "resolution": null + }, + "temporal": { + "referenceDate": null, + "timeseries": [ + { + "start": null, + "end": null, + "resolution": null, + "alignment": null, + "aggregationType": null + }, + { + "start": null, + "end": null, + "resolution": null, + "alignment": null, + "aggregationType": null + } + ] + }, + "sources": [ + { + "title": null, + "description": null, + "path": null, + "licenses": [ + { + "name": null, + "title": null, + "path": null, + "instruction": null, + "attribution": null + } + ] + }, + { + "title": null, + "description": null, + "path": null, + "licenses": [ + { + "name": null, + "title": null, + "path": null, + "instruction": null, + "attribution": null + } + ] + } + ], + "licenses": [ + { + "name": null, + "title": null, + "path": null, + "instruction": null, + "attribution": null + } + ], + "contributors": [ + { + "title": null, + "email": null, + "date": null, + "object": null, + "comment": null + } + ], + "@id": null, + "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", + "review": { + "path": null, + "badge": null + }, + "metaMetadata": { + "metadataVersion": "OEP-1.5.2", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + } + } + ] +} \ No newline at end of file From 7549b5469af0b71b0a977db21fddc932341702da Mon Sep 17 00:00:00 2001 From: jh-RLI Date: Tue, 11 Apr 2023 15:16:01 +0200 Subject: [PATCH 07/33] add datatype field --- metadata/v200_draft/example_multi_table.json | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/metadata/v200_draft/example_multi_table.json b/metadata/v200_draft/example_multi_table.json index 2353ec9b..0b24d1b8 100644 --- a/metadata/v200_draft/example_multi_table.json +++ b/metadata/v200_draft/example_multi_table.json @@ -6,8 +6,8 @@ "name": "model_draft.oep_metadata_table_example_v152", // Table name "path": "data/oep_metadata_table_example_v152.csv", // Local path to CSV and on server URL to table "format": "csv", - "encoding": "utf-8", - "dialect": { + "encoding": "utf-8", // Just for CSV, not relevant on server + "dialect": { // Just for CSV, not relevant on server "delimiter": ",", "decimalSeparator": "." }, @@ -16,7 +16,8 @@ { "name": "id", "description": "Unique identifier", - "type": "serial", + "type": "array null", // 100% frictionless + umwandlung zu SQL typen ... array problem + "sqlDataType": "", // postgresql database types + guter weg damit user nicht beide types ausfüllen müssen "unit": null, "isAbout": [ { @@ -390,16 +391,6 @@ "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/" } - }, - "_comment": { - "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", - "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", - "units": "Use a space between numbers and units (100 m)", - "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", - "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", - "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", - "null": "If not applicable use: null", - "todo": "If a value is not yet available, use: todo" } }, { From 13317ad172180cab980741aedf4368ec31952fac Mon Sep 17 00:00:00 2001 From: "c.winger" Date: Wed, 12 Apr 2023 19:27:36 +0200 Subject: [PATCH 08/33] started draft schema --- metadata/v200_draft/schema.json | 657 ++++++++++++++++++++++++++++++++ 1 file changed, 657 insertions(+) create mode 100644 metadata/v200_draft/schema.json diff --git a/metadata/v200_draft/schema.json b/metadata/v200_draft/schema.json new file mode 100644 index 00000000..0fabd5f5 --- /dev/null +++ b/metadata/v200_draft/schema.json @@ -0,0 +1,657 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/metadata/v200_draft/schema.json", + "description": "Open Energy Plaftorm (OEP) metadata schema v2.0.0-draft", + "type": "object", + "properties": { + "@context": { + "description": "Explanation of metadata keys in ontology terms. Example: https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "examples": [ + "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld" + ], + "type": "string", + "title": "@context" + }, + "@id": { + "description": "Uniform Resource Identifier (URI) that links the resource via the databus", + "type": "string", + "title": "@Id", + "readonly": true + }, + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI). Example: https://example.com", + "type": "string", + "title": "Id", + "readonly": true + }, + "name": { + "description": "File name or database table name. Example: oep_metadata_table_example_v15", + "type": "string", + "title": "Name", + "maxLength": 50, + "pattern": "[a-z][a-z_0-9]*" + }, + "title": { + "description": "Human readable title. Example: Metadata Example Table", + "type": "string", + "title": "Title" + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata. Example: Example table used to illustrate the metadata structure and meaning", + "type": "string", + "title": "Description" + }, + "subject": { + "description": "Reference the topic of the resource in ontology terms", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name of the OEO Class", + "type": "string", + "title": "Name" + }, + "path": { + "description": "Path to the OEO (URL)", + "type": "string", + "title": "Path", + "format": "uri" + } + }, + "additionalProperties": false, + "title": "Subject" + }, + "title": "Subject" + }, + "language": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47). Example: [en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "type": "string", + "examples": [ + "en", + "en-US", + "de", + "de-DE", + "fr", + "fr-FR" + ], + "title": "Language" + }, + "title": "Language" + }, + "keywords": { + "description": "An array of string keywords to assist users searching for the package in catalogs. Example: [example, template, test]", + "type": "array", + "items": { + "type": "string", + "maxLength": 40, + "title": "Keyword" + }, + "title": "Keyword" + }, + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD). Example: 2019-02-06", + "type": "string", + "title": "Publication date", + "format": "date" + }, + "context": { + "description": "Object. Contains name-value-pairs that describe the general setting, evironment or project leading to the creation or maintenance of this dataset.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project. Example: https://openenergy-platform.org/", + "type": "string", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "URL of project documentation. Example: https://github.com/OpenEnergyPlatform/metadata/wiki/Metadata-Description", + "type": "string", + "title": "Documentation" + }, + "sourceCode": { + "description": "Url of project source code. Example: https://github.com/OpenEnergyPlatform", + "type": "string", + "title": "Source code" + }, + "contact": { + "description": "Reference to the creator or maintainer of the data set. Example: contact@example.com", + "type": "string", + "title": "E-Mail contact", + "format": "email" + }, + "grantNo": { + "description": "In a publicly funded Project: the identifying grant number. Example: 01AB2345", + "type": "string", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded Project: The name of the funding agency. Example: Bundesministerium für Wirtschaft und Energie", + "type": "string", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "In a publicly funded Project: A link to the Logo of the funding agency. Example: https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=poster&v=2", + "type": "string", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "Link to the logo of the publishing institution. Example: https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": "string", + "title": "Publisher logo", + "format": "uri" + } + }, + "additionalProperties": false, + "title": "Context" + }, + "spatial": { + "description": "Object. Contains name-value-pairs describing the spatial context of the contained data.", + "type": "object", + "properties": { + "location": { + "description": "In the case of data where the location can be described as a point. May come as coordinates, URI or addresses with street, house number and zip code. Example: 52.433509, 13.535855", + "type": "string", + "title": "Location" + }, + "extent": { + "description": "Covered area. May be the name of a region, or the geometry of a bounding box. Example: Europe", + "type": "string", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size. Example: 30 m", + "type": "string", + "title": "Resolution" + } + }, + "additionalProperties": false, + "title": "Spatial" + }, + "temporal": { + "description": "Temporal object. Time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "Base year, month or day. Point in time for which the data is meant to be accurate. A census will generally have a reference year. A satellite image will have a reference date. Date Format is ISO 8601. Example: 2016-01-01", + "type": "string", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "Times series object in temporal object, contains start, end, resolution, alignment and aggregation type properties.", + "type": "array", + "items": { + "type": "object", + "properties": { + "start": { + "description": "The beginning point in time of a time series. Example: 2019-02-06T10:12:04+00:00", + "type": "string", + "title": "Start", + "format": "date-time" + }, + "end": { + "description": "The end point in time of a time series. Example: 2019-02-07T10:12:04+00:00", + "type": "string", + "title": "End", + "format": "date-time" + }, + "resolution": { + "description": "The time span between individual points of information in a time series. Example: 30 s", + "type": "string", + "title": "Resolution" + }, + "alignment": { + "description": "Indicator whether stamps in a time series are left, right or middle. Example: left", + "type": "string", + "title": "Alignment", + "enum": [ + "left", + "right", + "middle" + ] + }, + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current. Example: sum", + "type": "string", + "title": "Aggregation type", + "examples": [ + "sum", + "average", + "current" + ] + } + }, + "additionalProperties": false, + "title": "Timeseries" + }, + "title": "Timeseries" + } + }, + "additionalProperties": false, + "title": "Temporal" + }, + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "Human readable title of the source, e.g. document title or organisation name. Example: IPCC Fifth Assessment Report", + "type": "string", + "title": "Title" + }, + "description": { + "description": "Free text description of the data set. Example: Scientific climate change report by the UN", + "type": "string", + "title": "Description" + }, + "path": { + "description": "URL to original source. Example: https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": "string", + "title": "Path", + "format": "uri" + }, + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier: Example: ODbL-1.0", + "type": "string", + "title": "Name", + "examples": [ + "ODbL-1.0" + ] + }, + "title": { + "description": "Official (human readable) title. Example: Open Data Commons Open Database License 1.0", + "type": "string", + "title": "Title", + "examples": [ + "Open Data Commons Open Database License 1.0" + ] + }, + "path": { + "description": "A link to the license. Example: https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": "string", + "title": "Path", + "examples": [ + "https://opendatacommons.org/licenses/odbl/1-0/index.html" + ] + }, + "instruction": { + "description": "Short description of rights and restrictions. Example: You are free to share and change, but you must attribute, and share derivations under the same license.", + "type": "string", + "title": "Instruction" + }, + "attribution": { + "description": "Copyrightholder of the source. Example: © Intergovernmental Panel on Climate Change 2014", + "type": "string", + "title": "Attribution" + } + }, + "title": "Licenses" + }, + "title": "Licenses" + } + }, + "additionalProperties": false, + "title": "Sources" + }, + "title": "Sources" + }, + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier. Example: ODbL-1.0", + "type": "string", + "title": "Name" + }, + "title": { + "description": "Official (human readable) title. Example: Open Data Commons Open Database License 1.0", + "type": "string", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details). Example: https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": "string", + "title": "Path" + }, + "instruction": { + "description": "Short description of rights and restrictions. Example: You are free to share and change, but you must attribute, and share derivations under the same license.", + "type": "string", + "title": "Instruction" + }, + "attribution": { + "description": "Copyrightholder of the produced data set. Example: © Reiner Lemoine Institut", + "type": "string", + "title": "Attribution" + } + }, + "additionalProperties": false, + "title": "Licenses" + }, + "title": "Licenses" + }, + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization). Example: Jon Doe", + "type": "string", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor. Example: contact@example.com", + "type": "string", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601. Example: 2016-06-16", + "type": "string", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed. Example: Metadata", + "type": "string", + "title": "Object" + }, + "comment": { + "description": "Free text comment on what's been done. Example: Fixed a typo in the title", + "type": "string", + "title": "Comment" + } + }, + "additionalProperties": false, + "title": "Contributors" + }, + "title": "Contributors" + }, + "schema": { + "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "type": "object", + "properties": { + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "type": "object", + "properties": { + "name": { + "description": "Name string unique within its scope. Example: year", + "type": "string", + "title": "Name", + "maxLength": 50, + "pattern": "[a-z][a-z0-9_]*", + "readonly": true + }, + "description": { + "description": "Free-text describing the field. Example: Reference year for which the data were collected.", + "type": "string", + "title": "Description" + }, + "type": { + "description": "Data type of the field. In case of a geom-column in a database, also indicate the shape and CRS. Example: geometry(Point, 4326)", + "type": "string", + "title": "Type", + "examples": [ + "string", + "integer", + "number" + ], + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name of the Dataset", + "type": "string", + "title": "Name" + }, + "path": { + "description": "Path to the OEO (URL)", + "type": "string", + "title": "Path", + "format": "uri" + } + }, + "additionalProperties": false, + "title": "isAbout" + }, + "title": "isAbout" + }, + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "description": "The value this reference is assinged to.", + "type": "string", + "title": "Value" + }, + "name": { + "description": "Full name of the value", + "type": "string", + "title": "Name" + }, + "path": { + "description": "Path to the OEO", + "type": "string", + "title": "Path", + "format": "uri" + } + }, + "additionalProperties": false, + "title": "valueReference" + }, + "title": "valueReference" + }, + "unit": { + "description": "Unit, preferably SI-Unit, that values in this field are mapped to. Example: MW", + "type": "string", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" + }, + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns. Example: id", + "type": "array", + "items": { + "type": "string", + "title": "Primary key" + }, + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { + "fields": { + "description": "The column (as list of items) in the table that is constrainted by the foreign key. Example: version", + "type": "array", + "items": { + "type": "string", + "title": "Field" + }, + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table). Example: schema.table", + "type": "string", + "title": "Resource" + }, + "fields": { + "description": "The foreign resource column. List of fields. Example: version", + "type": "array", + "items": { + "type": "string", + "title": "Field" + }, + "title": "Field" + } + }, + "additionalProperties": false, + "title": "Reference" + } + }, + "additionalProperties": false, + "title": "Foreign Key" + }, + "title": "Foreign Keys" + } + }, + "additionalProperties": false, + "title": "Schema" + }, + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", + "type": "object", + "properties": { + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review. Example: https://www.example.com", + "type": "string", + "title": "Path" + }, + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platin is used to label the given metadata based on its quality. Example: Platin", + "type": "string", + "title": "Badge" + } + }, + "additionalProperties": false, + "title": "Review", + "options": { + "hidden": true + } + }, + "metaMetadata": { + "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you’re filling out your metadata.", + "type": "object", + "properties": { + "metadataVersion": { + "description": "Type and version number of the metadata", + "type": "string", + "title": "Metadata version", + "const": "OEP-2.0.0-draft" + }, + "metadataLicense": { + "description": "Object describing the license of the provided metadata.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier. Example: CC0-1.0", + "type": "string", + "title": "Name", + "default": "CC0-1.0", + "examples": [ + "CC0-1.0", + "CC-BY-4.0" + ] + }, + "title": { + "description": "Official (human readable) license title. Example: Creative Commons Zero v1.0 Universal", + "type": "string", + "title": "Title", + "default": "Creative Commons Zero v1.0 Universal" + }, + "path": { + "description": "Url or path string, that is a fully qualified HTTP address. Example: https://creativecommons.org/publicdomain/zero/1.0/", + "type": "string", + "title": "Path", + "default": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "additionalProperties": false, + "title": "Metadata license" + } + }, + "additionalProperties": false, + "title": "Meta metadata", + "options": { + "hidden": true + } + }, + "_comment": { + "description": "Object. The “_comment”-section is used as a self-description of the final metadata-file. It is text, intended for humans and can include a link to the metadata documentation(s), required value formats and similar remarks. The comment section has no fix structure or mandatory values, but a useful self-description, similar to the one depicted here, is encouraged.", + "type": "object", + "properties": { + "metadata": { + "description": "Reference to the metadata documentation in use. Example: Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/organisation/wiki/metadata)", + "type": "string", + "title": "Metadata" + }, + "dates": { + "description": "Comment on data/time format. Example: Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "type": "string", + "title": "Dates" + }, + "units": { + "description": "Comment on units. Example: If you must use units in cells (which is discouraged), leave a space between numbers and units (100 m)", + "type": "string", + "title": "Units" + }, + "languages": { + "description": "Comment on language format. Example: Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "type": "string", + "title": "Languages" + }, + "licenses": { + "description": "Reference to license format. Example: License name must follow the SPDX License List (https://spdx.org/licenses/)", + "type": "string", + "title": "Licenses" + }, + "review": { + "description": "Reference to review documentation. Example: Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "type": "string", + "title": "Review" + }, + "todo": { + "description": "If an applicable value is not yet available and will be inserted later on use: 'todo' ", + "type": "string", + "title": "Todo" + } + }, + "title": "_comment" + } + }, + "additionalProperties": false +} \ No newline at end of file From a13e55117d07c6c5dee5c909f02840f35427ed1d Mon Sep 17 00:00:00 2001 From: "c.winger" Date: Mon, 17 Apr 2023 09:08:53 +0200 Subject: [PATCH 09/33] WIP: auto generate example json from examples in schema --- metadata/v200_draft/create_example.py | 58 ++++++++++ metadata/v200_draft/example.json | 73 ++++++++++++ metadata/v200_draft/schema.json | 159 +++++++++++++++++++------- 3 files changed, 247 insertions(+), 43 deletions(-) create mode 100644 metadata/v200_draft/create_example.py create mode 100644 metadata/v200_draft/example.json diff --git a/metadata/v200_draft/create_example.py b/metadata/v200_draft/create_example.py new file mode 100644 index 00000000..b0f6c5c8 --- /dev/null +++ b/metadata/v200_draft/create_example.py @@ -0,0 +1,58 @@ +"""create example from json schema +""" +import json +from pathlib import Path +from os.path import dirname + + +def main(schema_file_in: Path, example_file_out: Path) -> None: + """ + Args: + schema_file_in: path to schema file + example_file_out: path to example file + """ + with open(schema_file_in, "r", encoding="utf-8") as file: + schema = json.load(file) + + example = generate_example(schema) + + with open(example_file_out, "w", encoding="utf-8") as file: + json.dump(example, file, indent=4, ensure_ascii=False) + + +def generate_example(schema: dict) -> dict: + """Recursively create example object from json schema object. + Args: + schema: json schema object + Returns: + dict: example object + """ + + if schema.get("const"): + return schema["const"] + if schema.get("examples"): + # the object has examples: return the first + # TODO: maybe randomize? + return schema["examples"][0] + if schema["type"] == "object": + result = {} + for pname, prop in schema["properties"].items(): + ex = generate_example(prop) + if ex: + result[pname] = ex + return result + if schema["type"] == "array": + # TODO: random number between minItems and maxItems? + n = schema.get("minItems") or 1 + result = [] + for _ in range(n): + ex = generate_example(schema["items"]) + if ex: + result.append(ex) + if result: + return result + + +if __name__ == "__main__": + pwd = dirname(__file__) + main(pwd + "/schema.json", pwd + "/example.json") diff --git a/metadata/v200_draft/example.json b/metadata/v200_draft/example.json new file mode 100644 index 00000000..8922de4d --- /dev/null +++ b/metadata/v200_draft/example.json @@ -0,0 +1,73 @@ +{ + "$schema": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/feature/draft_updated_oem_ressourse_and_datapackge/metadata/v200_draft/schema.json", + "id": "https://openenergy-platform.org/dataedit/view/example_table_name", + "name": "example_table_name", + "title": "Example Table Name", + "description": "Example description", + "language": [ + "en" + ], + "keywords": [ + "example" + ], + "publicationDate": "2023-12-04", + "context": { + "homepage": "https://example.org", + "contact": "example@example.org" + }, + "spatial": { + "extent": "Germany", + "resolution": "100m" + }, + "temporal": { + "referenceDate": "2020-01-01", + "timeseries": [ + { + "start": "2019-02-06T10:12:04+00:00", + "end": " 2019-02-07T10:12:04+00:00", + "resolution": "1h", + "aggregationType": "current" + } + ] + }, + "sources": [ + { + "title": "IPCC Fifth Assessment Report", + "path": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "licenses": [ + { + "name": "CC-BY-4.0" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "attribution": "© Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "Jon Doe", + "email": "example@example.org", + "date": "2023-03-12" + } + ], + "schema": { + "fields": [ + { + "name": "id", + "type": "integer" + } + ] + }, + "metaMetadata": { + "metadataVersion": "OEP-2.0.0-draft", + "metadataLicense": { + "name": "CC0-1.0" + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/schema.json b/metadata/v200_draft/schema.json index 0fabd5f5..158b3600 100644 --- a/metadata/v200_draft/schema.json +++ b/metadata/v200_draft/schema.json @@ -1,14 +1,17 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/metadata/v200_draft/schema.json", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/feature/draft_updated_oem_ressourse_and_datapackge/metadata/v200_draft/schema.json", "description": "Open Energy Plaftorm (OEP) metadata schema v2.0.0-draft", "type": "object", "properties": { + "$schema": { + "type": "string", + "format": "uri", + "const": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/feature/draft_updated_oem_ressourse_and_datapackge/metadata/v200_draft/schema.json", + "readonly": true + }, "@context": { "description": "Explanation of metadata keys in ontology terms. Example: https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", - "examples": [ - "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld" - ], "type": "string", "title": "@context" }, @@ -22,24 +25,36 @@ "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI). Example: https://example.com", "type": "string", "title": "Id", - "readonly": true + "readonly": true, + "examples": [ + "https://openenergy-platform.org/dataedit/view/example_table_name" + ] }, "name": { "description": "File name or database table name. Example: oep_metadata_table_example_v15", "type": "string", "title": "Name", "maxLength": 50, - "pattern": "[a-z][a-z_0-9]*" + "pattern": "[a-z][a-z_0-9]*", + "examples": [ + "example_table_name" + ] }, "title": { "description": "Human readable title. Example: Metadata Example Table", "type": "string", - "title": "Title" + "title": "Title", + "examples": [ + "Example Table Name" + ] }, "description": { "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata. Example: Example table used to illustrate the metadata structure and meaning", "type": "string", - "title": "Description" + "title": "Description", + "examples": [ + "Example description" + ] }, "subject": { "description": "Reference the topic of the resource in ontology terms", @@ -87,7 +102,10 @@ "items": { "type": "string", "maxLength": 40, - "title": "Keyword" + "title": "Keyword", + "examples": [ + "example" + ] }, "title": "Keyword" }, @@ -95,7 +113,10 @@ "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD). Example: 2019-02-06", "type": "string", "title": "Publication date", - "format": "date" + "format": "date", + "examples": [ + "2023-12-04" + ] }, "context": { "description": "Object. Contains name-value-pairs that describe the general setting, evironment or project leading to the creation or maintenance of this dataset.", @@ -105,7 +126,10 @@ "description": "URL of project. Example: https://openenergy-platform.org/", "type": "string", "title": "Homepage", - "format": "uri" + "format": "uri", + "examples": [ + "https://example.org" + ] }, "documentation": { "description": "URL of project documentation. Example: https://github.com/OpenEnergyPlatform/metadata/wiki/Metadata-Description", @@ -121,7 +145,10 @@ "description": "Reference to the creator or maintainer of the data set. Example: contact@example.com", "type": "string", "title": "E-Mail contact", - "format": "email" + "format": "email", + "examples": [ + "example@example.org" + ] }, "grantNo": { "description": "In a publicly funded Project: the identifying grant number. Example: 01AB2345", @@ -161,12 +188,20 @@ "extent": { "description": "Covered area. May be the name of a region, or the geometry of a bounding box. Example: Europe", "type": "string", - "title": "Extent" + "title": "Extent", + "examples": [ + "Germany", + "Europe" + ] }, "resolution": { - "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size. Example: 30 m", + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size. Example: 30m", "type": "string", - "title": "Resolution" + "title": "Resolution", + "examples": [ + "100m", + "NUTS-2" + ] } }, "additionalProperties": false, @@ -180,7 +215,10 @@ "description": "Base year, month or day. Point in time for which the data is meant to be accurate. A census will generally have a reference year. A satellite image will have a reference date. Date Format is ISO 8601. Example: 2016-01-01", "type": "string", "title": "Reference date", - "format": "date" + "format": "date", + "examples": [ + "2020-01-01" + ] }, "timeseries": { "description": "Times series object in temporal object, contains start, end, resolution, alignment and aggregation type properties.", @@ -192,18 +230,27 @@ "description": "The beginning point in time of a time series. Example: 2019-02-06T10:12:04+00:00", "type": "string", "title": "Start", - "format": "date-time" + "format": "date-time", + "examples": [ + "2019-02-06T10:12:04+00:00" + ] }, "end": { "description": "The end point in time of a time series. Example: 2019-02-07T10:12:04+00:00", "type": "string", "title": "End", - "format": "date-time" + "format": "date-time", + "examples": [ + " 2019-02-07T10:12:04+00:00" + ] }, "resolution": { - "description": "The time span between individual points of information in a time series. Example: 30 s", + "description": "The time span between individual points of information in a time series. Example: 30s", "type": "string", - "title": "Resolution" + "title": "Resolution", + "examples": [ + "1h" + ] }, "alignment": { "description": "Indicator whether stamps in a time series are left, right or middle. Example: left", @@ -220,9 +267,9 @@ "type": "string", "title": "Aggregation type", "examples": [ + "current", "sum", - "average", - "current" + "average" ] } }, @@ -245,7 +292,10 @@ "title": { "description": "Human readable title of the source, e.g. document title or organisation name. Example: IPCC Fifth Assessment Report", "type": "string", - "title": "Title" + "title": "Title", + "examples": [ + "IPCC Fifth Assessment Report" + ] }, "description": { "description": "Free text description of the data set. Example: Scientific climate change report by the UN", @@ -256,7 +306,10 @@ "description": "URL to original source. Example: https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", "type": "string", "title": "Path", - "format": "uri" + "format": "uri", + "examples": [ + "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf" + ] }, "licenses": { "description": "The license(s) under which the source(s) is/are provided. List of objects.", @@ -270,24 +323,18 @@ "type": "string", "title": "Name", "examples": [ - "ODbL-1.0" + "CC-BY-4.0" ] }, "title": { "description": "Official (human readable) title. Example: Open Data Commons Open Database License 1.0", "type": "string", - "title": "Title", - "examples": [ - "Open Data Commons Open Database License 1.0" - ] + "title": "Title" }, "path": { "description": "A link to the license. Example: https://opendatacommons.org/licenses/odbl/1-0/index.html", "type": "string", - "title": "Path", - "examples": [ - "https://opendatacommons.org/licenses/odbl/1-0/index.html" - ] + "title": "Path" }, "instruction": { "description": "Short description of rights and restrictions. Example: You are free to share and change, but you must attribute, and share derivations under the same license.", @@ -320,17 +367,26 @@ "name": { "description": "SPDX identifier. Example: ODbL-1.0", "type": "string", - "title": "Name" + "title": "Name", + "examples": [ + "ODbL-1.0" + ] }, "title": { "description": "Official (human readable) title. Example: Open Data Commons Open Database License 1.0", "type": "string", - "title": "Title" + "title": "Title", + "examples": [ + "Open Data Commons Open Database License 1.0" + ] }, "path": { "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details). Example: https://opendatacommons.org/licenses/odbl/1-0/index.html", "type": "string", - "title": "Path" + "title": "Path", + "examples": [ + "https://opendatacommons.org/licenses/odbl/1-0/index.html" + ] }, "instruction": { "description": "Short description of rights and restrictions. Example: You are free to share and change, but you must attribute, and share derivations under the same license.", @@ -340,7 +396,10 @@ "attribution": { "description": "Copyrightholder of the produced data set. Example: © Reiner Lemoine Institut", "type": "string", - "title": "Attribution" + "title": "Attribution", + "examples": [ + "© Reiner Lemoine Institut" + ] } }, "additionalProperties": false, @@ -358,19 +417,28 @@ "title": { "description": "Name/title of the contributor (name for a person, name or title for an organization). Example: Jon Doe", "type": "string", - "title": "Title" + "title": "Title", + "examples": [ + "Jon Doe" + ] }, "email": { "description": "E-mail address of the contributor. Example: contact@example.com", "type": "string", "title": "Email", - "format": "email" + "format": "email", + "examples": [ + "example@example.org" + ] }, "date": { "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601. Example: 2016-06-16", "type": "string", "title": "Date", - "format": "date" + "format": "date", + "examples": [ + "2023-03-12" + ] }, "object": { "description": "Target of contribution. Which part of the package was supplied/changed. Example: Metadata", @@ -405,6 +473,9 @@ "title": "Name", "maxLength": 50, "pattern": "[a-z][a-z0-9_]*", + "examples": [ + "id" + ], "readonly": true }, "description": { @@ -417,8 +488,8 @@ "type": "string", "title": "Type", "examples": [ - "string", "integer", + "string", "number" ], "readonly": true @@ -483,7 +554,8 @@ "additionalProperties": false, "title": "Field" }, - "title": "Field" + "title": "Field", + "minItems": 1 }, "primaryKey": { "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns. Example: id", @@ -571,7 +643,8 @@ "description": "Type and version number of the metadata", "type": "string", "title": "Metadata version", - "const": "OEP-2.0.0-draft" + "const": "OEP-2.0.0-draft", + "readonly": true }, "metadataLicense": { "description": "Object describing the license of the provided metadata.", From 9b9d3f30bcff080071b25ac483bf9e3dde00214e Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 3 Apr 2024 11:55:57 +0200 Subject: [PATCH 10/33] update template --- metadata/v200_draft/template.json | 165 ++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 metadata/v200_draft/template.json diff --git a/metadata/v200_draft/template.json b/metadata/v200_draft/template.json new file mode 100644 index 00000000..2e4ca72e --- /dev/null +++ b/metadata/v200_draft/template.json @@ -0,0 +1,165 @@ +{ + "name": null, + "resources": [ + { + "name": null, + "dialect": { + "delimiter": null, + "decimalSeparator": "." + }, + "profile": null, + "path": null, + "format": null, + "encoding": null, + "schema": { + "fields": [ + { + "name": null, + "description": null, + "type": null, + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + }, + { + "name": null, + "description": null, + "type": null, + "unit": null, + "isAbout": [ + { + "name": null, + "path": null + } + ], + "valueReference": [ + { + "value": null, + "name": null, + "path": null + } + ] + } + ], + "primaryKey": [ + null + ], + "foreignKeys": [ + { + "fields": [ + null + ], + "reference": { + "resource": null, + "fields": [ + null + ] + } + } + ] + }, + "title": null, + "id": null, + "description": null, + "language": [ + null + ], + "subject": [ + { + "name": null, + "path": null + } + ], + "keywords": [ + null + ], + "publicationDate": null, + "context": { + "homepage": null, + "documentation": null, + "sourceCode": null, + "contact": null, + "grantNo": null, + "fundingAgency": null, + "fundingAgencyLogo": null, + "publisherLogo": null + }, + "spatial": { + "location": null, + "extent": null, + "resolution": null + }, + "temporal": { + "referenceDate": null, + "timeseries": [ + { + "start": null, + "end": null, + "resolution": null, + "alignment": null, + "aggregationType": null + } + ] + }, + "sources": [ + { + "title": null, + "description": null, + "path": null, + "licenses": [ + { + "name": null, + "title": null, + "path": null, + "instruction": null, + "attribution": null + } + ] + } + ], + "licenses": [ + { + "name": null, + "title": null, + "path": null, + "instruction": null, + "attribution": null + } + ], + "contributors": [ + { + "title": null, + "email": null, + "date": null, + "object": null, + "comment": null + } + ], + "@id": null, + "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", + "review": { + "path": null, + "badge": null + }, + "metaMetadata": { + "metadataVersion": "2.0.0", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + } + } + ] +} \ No newline at end of file From 1b7a94ca4356006099280f2a757a7fac694cb88f Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Mon, 3 Jun 2024 17:28:10 +0200 Subject: [PATCH 11/33] add scripts to resolve the schema from its parts and create a example json based on the schema #143 --- scripts/generate_example_from_schema.py | 92 ++++++++++++ scripts/resolve_schema_refs.py | 187 ++++++++++++++++++++++++ 2 files changed, 279 insertions(+) create mode 100644 scripts/generate_example_from_schema.py create mode 100644 scripts/resolve_schema_refs.py diff --git a/scripts/generate_example_from_schema.py b/scripts/generate_example_from_schema.py new file mode 100644 index 00000000..c878dc62 --- /dev/null +++ b/scripts/generate_example_from_schema.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Title: create example from json schema +Description: Create example from json schema. +Author: jh-RLI +Email: jonas.huber@rl-institut.de +Date: 2024-05-30 +Version: 1.0.0 +""" + +# Standard Library Imports +# import os +from os.path import dirname + +import sys +import json +import logging + +# from datetime import datetime +from pathlib import Path + +from jsonschema import validate, ValidationError + +# Configuration +LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +logger = logging.getLogger(__name__) + +# Constants +BASE_PATH = Path("metadata/") +VERSION = "v200_draft" +VERSION_PATH = BASE_PATH / VERSION +SCHEMA_BUILD_PATH = VERSION_PATH / "build" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "main_schema.json" +SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" +EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" +EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" + + +def generate_example(schema): + if "example" in schema: + return schema["example"] + if "const" in schema: + return schema["const"] + if "enum" in schema: + return schema["enum"][0] + if schema.get("type") == "object": + obj = {} + for key, value in schema.get("properties", {}).items(): + obj[key] = generate_example(value) + return obj + if schema.get("type") == "array": + example_items = schema.get("example", []) + if not example_items: + example_items = [generate_example(schema["items"])] + return example_items + if "type" in schema: + if schema["type"] == "string": + return schema.get("example", "") + if schema["type"] == "number": + return schema.get("example", 0) + if schema["type"] == "boolean": + return schema.get("example", False) + if schema["type"] == "null": + return None + return None + + +def create_example_json(schema_file_path, output_file_path): + with open(schema_file_path, "r") as schema_file: + schema = json.load(schema_file) + + example_json = generate_example(schema) + + with open(output_file_path, "w") as output_file: + json.dump(example_json, output_file, indent=4) + print(f"{output_file_path} has been created.") + + try: + validate(instance=example_json, schema=schema) + print(f"The generated example JSON is valid according to the schema.") + except ValidationError as e: + print(f"The generated example JSON is not valid: {e.message}") + + +schema_file_path = RESOLVED_SCHEMA_FILE_NAME +output_file_path = EXAMPLE_PATH + +create_example_json(schema_file_path, output_file_path) diff --git a/scripts/resolve_schema_refs.py b/scripts/resolve_schema_refs.py new file mode 100644 index 00000000..bd3400a5 --- /dev/null +++ b/scripts/resolve_schema_refs.py @@ -0,0 +1,187 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Title: Resolve schema $ref +Description: Resolve "$ref" elements in schema.json. +Author: jh-RLI +Email: jonas.huber@rl-institut.de +Date: 2024-05-30 +Version: 1.0.0 + +requires: "pip install jsonschema referencing" + +Usage: Script with additional arguments --debug for more detailed output. + Requires the folder structure introduced in oemetadata v2.0.0. +""" + +# Standard Library Imports +# import os +import sys +import json +import logging + +# from datetime import datetime +from pathlib import Path +from urllib.parse import urljoin +import argparse + +from referencing import Registry, Resource +from jsonschema import Draft7Validator + +# Configuration +LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +logger = logging.getLogger(__name__) + +# Constants +BASE_PATH = Path("metadata/") +VERSION = "v200_draft" +VERSION_PATH = BASE_PATH / VERSION +SCHEMA_BUILD_PATH = VERSION_PATH / "build" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "main_schema.json" +SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" +EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" + + +# Function Definitions +def setup(): + """ + Setup function to initialize resources or configurations. + """ + logger.info("Setup complete.") + + +# Load the main schema +def load_schema(schema_path): + with open(schema_path, "r") as file: + return json.load(file) + + +# Ensure the schema has the $schema field +def ensure_schema_field(schema): + if "$schema" not in schema: + schema["$schema"] = "http://json-schema.org/draft-07/schema#" + return schema + + +# Debugging function to print registry contents +def print_registry_contents(registry, debug): + if debug: + print("Registry Contents:") + for uri, resource in registry._resources.items(): + print(f"{uri}: {resource.contents}") + + +# Resolve and merge references using referencing library +def resolve_and_merge(schema_path, debug): + schema = load_schema(schema_path) + schema = ensure_schema_field(schema) + + # Create a registry and register the schemas + base_uri = MAIN_SCHEMA_PATH.resolve().parent.as_uri() + "/" + registry = Registry().with_resource(base_uri, Resource.from_contents(schema)) + + for schema_file in SCHEMA_REFS.glob("*.json"): + try: + with open(schema_file, "r") as file: + ref_schema = json.load(file) + ref_schema = ensure_schema_field(ref_schema) + schema_uri = urljoin(base_uri, schema_file.name) + registry = registry.with_resource( + schema_uri, Resource.from_contents(ref_schema) + ) + except json.JSONDecodeError as e: + logger.error(f"Error decoding JSON from {schema_file}: {e}") + continue + + # Print registry contents for debugging + print_registry_contents(registry, debug) + + # Resolve references in the schema + def resolve_references(schema, registry, base_uri): + if isinstance(schema, dict): + if "$ref" in schema: + ref_uri = urljoin(base_uri, schema["$ref"]) + if debug: + print(f"Resolving reference {ref_uri}") # Debugging + try: + ref_schema = registry[ref_uri] + if debug: + print( + f"Resolved reference {ref_uri} to {ref_schema.contents}" + ) # Debugging + return resolve_references(ref_schema.contents, registry, base_uri) + except KeyError as e: + raise ValueError(f"Reference {ref_uri} could not be resolved: {e}") + else: + return { + key: resolve_references(value, registry, base_uri) + for key, value in schema.items() + } + elif isinstance(schema, list): + return [resolve_references(item, registry, base_uri) for item in schema] + return schema + + # Resolve the top-level properties + resolved_properties = {} + for prop, value in schema["properties"].items(): + if "$ref" in value: + resolved_value = resolve_references(value, registry, base_uri) + resolved_properties.update(resolved_value["properties"]) + else: + resolved_properties[prop] = resolve_references(value, registry, base_uri) + + # Replace the properties in the schema with the resolved properties + schema["properties"] = resolved_properties + return schema + + +# Validate the schema +def validate_schema(resolved_schema, expected_schema): + validator = Draft7Validator(expected_schema) + errors = sorted(validator.iter_errors(resolved_schema), key=lambda e: e.path) + for error in errors: + print(f"Validation error at {list(error.path)}: {error.message}") + + +# Load expected schema (without refs) for validation +def load_expected_schema(expected_schema_path): + with open(expected_schema_path, "r", encoding="utf-8") as file: + return json.load(file) + + +def main(debug): + """ + Main function to execute the script's primary logic. + """ + try: + setup() + logger.info("Main execution started.") + + # Resolve and merge the schema + resolved_schema = resolve_and_merge(MAIN_SCHEMA_PATH, debug) + + # Save the resolved schema to a new file + with open(RESOLVED_SCHEMA_FILE_NAME, "w") as output_file: + json.dump(resolved_schema, output_file, indent=2) + + # Load the expected schema and validate + expected_schema = load_expected_schema(EXPECTED_SCHEMA_PATH) + validate_schema(resolved_schema, expected_schema) + + logger.info("Main execution finished.") + except Exception as e: + logger.error("An error occurred: %s", e) + sys.exit(1) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Resolve and merge JSON schema references." + ) + parser.add_argument("--debug", action="store_true", help="Enable debugging output") + args = parser.parse_args() + + main(args.debug) From fbbb93646b5f9066a0507200836add679b4b0b1f Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 11:54:04 +0200 Subject: [PATCH 12/33] setup v200 release directory (currently in draft) and tests #144 --- metadata/v200_draft/README.md | 16 ++ metadata/v200_draft/__init__.py | 0 metadata/v200_draft/example.py | 5 + .../v200_draft/metadata_key_description.md | 182 ++++++++++++++++++ metadata/v200_draft/schema.py | 5 + metadata/v200_draft/template.py | 5 + tests/metadata/v200/test_example.py | 10 + tests/metadata/v200/test_schema.py | 34 ++++ tests/metadata/v200/test_template.py | 10 + 9 files changed, 267 insertions(+) create mode 100644 metadata/v200_draft/README.md create mode 100644 metadata/v200_draft/__init__.py create mode 100644 metadata/v200_draft/example.py create mode 100644 metadata/v200_draft/metadata_key_description.md create mode 100644 metadata/v200_draft/schema.py create mode 100644 metadata/v200_draft/template.py create mode 100644 tests/metadata/v200/test_example.py create mode 100644 tests/metadata/v200/test_schema.py create mode 100644 tests/metadata/v200/test_template.py diff --git a/metadata/v200_draft/README.md b/metadata/v200_draft/README.md new file mode 100644 index 00000000..dee9fa23 --- /dev/null +++ b/metadata/v200_draft/README.md @@ -0,0 +1,16 @@ +OpenEnergyMetadata +OpenEnergyPlatform + + +# Open Energy Metadata (OEM) - Latest-Release + +This version of the OEM represents the latest released version. This release is fully integrated +into the OEP. + +The OEM contains the following files: + +* [template.json](https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/template.json) contains an empty metadata string with all fields. +* [metadata_key_description.md](https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/metadata_key_description.md) contains a full description of each metadata key and an example. +* [example.json](https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/example.json) contains a basic metadata example. + +For further information see the [Changelog](https://github.com/OpenEnergyPlatform/oemetadata/blob/master/CHANGELOG.md). diff --git a/metadata/v200_draft/__init__.py b/metadata/v200_draft/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/metadata/v200_draft/example.py b/metadata/v200_draft/example.py new file mode 100644 index 00000000..ef80e826 --- /dev/null +++ b/metadata/v200_draft/example.py @@ -0,0 +1,5 @@ +import json +import os + +with open(os.path.join(os.path.dirname(__file__), "example.json"), "rb") as f: + OEMETADATA_V200_EXAMPLE = json.loads(f.read()) diff --git a/metadata/v200_draft/metadata_key_description.md b/metadata/v200_draft/metadata_key_description.md new file mode 100644 index 00000000..5e0c954a --- /dev/null +++ b/metadata/v200_draft/metadata_key_description.md @@ -0,0 +1,182 @@ +# OEMetadata - Key Description + +This pages describes the key of **OEMetadata version 1.6.0 .**
+You can have a look at an empty [template](https://github.com/OpenEnergyPlatform/metadata/blob/master/metadata/v200/template.json) and a filled out [example](https://github.com/OpenEnergyPlatform/metadata/blob/master/metadata/v160/example.json) of the metadata string. + + +## JSON Format +The JSON format offers different formats: +* key-value pair: + ```JSON + {"key":"value"} + ``` +* array: + ```JSON + {"key": + ["value","value"]} + ``` +* object {nested key}: + ```JSON + {"key": + {"key":"value"}, + {"key":"value"}} + ``` +* array of objects {nested array}: + ```JSON + {"key": [ + {"key":"value"}, + {"key":"value"}]} + ``` + + +## Metadata keys with a description and example + + +### General Keys +|#|Key |Description |Example | +|---|---|---|---| +| 1 | name | A file name or database table name. | oep_metadata_table_example_v16 | +| 2 | title | A human readable full title including author. | RLI - OEMetadata - Metadata example table | +| 3 | id | An Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI). | https://example.com | +| 4 | description | A description or abstract of the package. It should be usable as summary information for the entire package that is described by the metadata. | Example table used to illustrate the metadata structure and meaning. | +| 5 | language | An array of languages used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47) | en-GB, de-DE, fr-FR | +| 6 | **subject** | An array of objects with topics of the data in OEO terms. | +| 6.1 | name | The class label of the OEO terms. | energy | +| 6.2 | path | The URI of the class. | https://openenergy-platform.org/ontology/oeo/OEO_00000150 | +| 7 | keywords | An array of keywords to assist users searching for the package in catalogs. | example, template, test | +| 8 | publicationDate | A date of publishing of the data or metadata. Date format is ISO 8601 (YYYY-MM-DD). | 2019-02-06 | + +### Context Keys +|#|Key |Description |Example | +|---|---|---|---| +| 9 | **context** | An object that describes the general setting, environment, or project leading to the creation or maintenance of this dataset. In science this is can be the research project. | | +| 9.1 | homepage | A URL of the project. | https://openenergy-platform.org/ | +| 9.2 | documentation | A URL of the project documentation. | https://openenergy-platform.org/about/ | +| 9.3 | sourceCode | A URL of the projects source code. | https://github.com/OpenEnergyPlatform | +| 9.4 | contact | A reference to the creator or maintainer of the data set. It can be an email address or a GitHub handle. | contact@example.com | +| 9.5 | grantNo | An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency. | 01AB2345 | +| 9.6 | fundingAgency | A name of the entity providing the funding. This can be a government agency or a company. | Bundesministerium für Wirtschaft und Klimaschutz | +| 9.7 | fundingAgencyLogo | A URL to the logo or image of the funding agency. | https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg | +| 9.8 | publisherLogo | A URL to the logo of the publishing agency of data. | https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png | + +### Spatial and Temporal Keys +|#|Key |Description |Example | +|---|---|---|---| +| 10 | **spatial** | An object that describes the spatial context of the data it contains. | | +| 10.1 | location | A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code. | 52.433509, 13.535855 | +| 10.2 | extent | A covered area. May be the name of a region, or the geometry of a bounding box. | Europe | +| 10.3 | resolution | Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size. | 1 ha | +| 11 | **temporal** | An object with the time period covered in the data. Temporal information should either contain a "referenceDate" or the keys describing a time series; in rare cases both. | | +| 11.1 | referenceDate | The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601. | 2016-01-01 | +| 11.2 | **timeseries** | An array that describes the timeseries. || +| 11.2.1 | start | The beginning point in time of a time series. | 2019-02-06T10:12:04+00:00 | +| 11.2.2 | end | The end point in time of a time series. | 2019-02-07T10:12:04+00:00 | +| 11.2.3 | resolution | The time span between individual points of information in a time series. | 30 s | +| 11.2.4 | alignment | An indicator whether stamps in a time series are left, right or middle. | left | +| 11.2.5 | aggregationType | Indicates whether the values are a sum, average or current. | sum | + +### Source Keys +|#|Key |Description |Example | +|---|---|---|---| +| 12 | **sources** | An array of objects with the used and underlying sources of the data and metadata. | | +| 12.1 | title | A human readable title of the source, a document title or organisation name. | IPCC Fifth Assessment Report | +| 12.2 | description | A free text description of the data set. | Scientific climate change report by the UN | +| 12.3 | path | A URL to the original source. | https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf | +| 12.4 | **licenses** | An array of objects under which the source is provided. | | +| 12.4.1 | name | The [SPDX](https://spdx.org/licenses/) identifier. | ODbL-1.0 | +| 12.4.2 | title | The official (human readable) title of the license. | Open Data Commons Open Database License 1.0 | +| 12.4.3 | path | A link to the license text. | https://opendatacommons.org/licenses/odbl/1-0/index.html | +| 12.4.4 | instruction | A short description of rights and restrictions. The use of [tl;drLegal](https://tldrlegal.com/) is recommended. | You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information. | +| 12.4.5 | attribution | The copyright owner of the **source**. If attribution licenses are used, that name must be acknowledged. | © Intergovernmental Panel on Climate Change 2014 | + +### License Keys +|#|Key |Description |Example | +|---|---|---|---| +| 13 | **licenses** | An array of objects of the license(s) under which the described package is provided. It can depend on the licenses of the sources (copyleft or share-alike) or can be granted by the creator of the data. | | +| 13.1 | name | The [SPDX](https://spdx.org/licenses/) identifier. | ODbL-1.0 | +| 13.2 | title | The official (human readable) title of the license. | Open Data Commons Open Database License 1.0 | +| 13.3 | path | A link to the license text. | https://opendatacommons.org/licenses/odbl/1-0/index.html | +| 13.4 | instruction | A short description of rights and restrictions. The use of [tl;drLegal](https://tldrlegal.com/) is recommended. | You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information. | +| 13.5 | attribution | The copyright owner of the **data**. If attribution licenses are used, that name must be acknowledged. | © Reiner Lemoine Institut | + +### Provenience Keys +|#|Key |Description |Example | +|---|---|---|---| +| 14 | **contributors** | An array of objects of the people or organizations who contributed to the data or metadata. Each object refers to one contributor. Every contributor must have a title and property. The path, email, role and organization properties are optional. | | +| 14.1 | title | A name of the contributor. | Ludwig Hülk | +| 14.2 | email | A email address of the contributor or GitHub handle. | @Ludee | +| 14.3 | date | The date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601. | 2016-06-16 | +| 14.4 | object | The target of the contribution. Which part of the package was supplied or changed. Can be the data, metadata or both (data and metadata). | data and metadata | +| 14.5 | comment | A free text commentary on what has been done. | Fixed a typo in the title. | + +### Resource Keys +|#|Key |Description |Example | +|---|---|---|---| +| 15 | **resources** | An array of objects of the data. It describes the data resource as an individual file or (database) table. | | +| 15.1 | profile | The profile of this descriptor according to the profiles specification. This information is retained in order to comply with the "Tabular Data Package" standard. Use "tabular-data-resource" for all tables. | tabular-data-resource | +| 15.2 | name | A name for the entire data package. The name must consist of only lowercase alphanumeric characters or underscore. It must not start with a number or underscore. In a database, this will be the name of the table within the schema containing it. The name can correspond to the file name (minus the file-extension) of the data file describing the resource, if it complies with the naming convention above. Name also contains information about the shema on the OEP, use "." to seperate shema from table name. | openstreetmap.osm_deu_line | +| 15.3 | path | A URL that should be a permanent http(s) address or other path directly linking to the resource. | https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line | +| 15.4 | format | The file extension. 'csv', 'xls', 'json' etc. would be expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database. | PostgreSQL | +| 15.5 | encoding | Specifies the character encoding of the resource's data file. The values should be one of the ["Preferred MIME Names"](https://www.iana.org/assignments/character-sets/character-sets.xhtml) for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8. | UTF-8 | + +#### Resource Keys - Schema +|#|Key |Description |Example | +|---|---|---|---| +| 15.6 | **schema** | An object that describes the structure of the present data. It contains all fields (columns of the table), the primary key and optional foreign keys. | | +| 15.6.1 | **fields** | An array of objects describing a column and providing name, description, type and unit. | | +| 15.6.1.1 | name | The name of the field. The name must consist of only lowercase alphanumeric characters or underscore. It must not start with a number or underscore. | year | +| 15.6.1.2 | description | A text describing the field. | Reference year for which the data were collected. | +| 15.6.1.3 | type | The data type of the field. In case of a geom column in a database, also indicate the shape and CRS. | geometry(Point, 4326) | +| 15.6.1.4 | unit | The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field. | MW | +| 15.6.1.5 | **isAbout** | An array of objects with describe the field in [OEO](https://openenergy-platform.org/ontology/oeo/) terms. | +| 15.6.1.5.1 | name | The class label of the OEO terms. | wind energy converting unit | +| 15.6.1.5.2 | path | The URI of the class. | https://openenergy-platform.org/ontology/oeo/OEO_00000044 | +| 15.6.1.6 | **valueReference** | An array of objects for an extended description of the values in the column in [OEO](https://openenergy-platform.org/ontology/oeo/) terms. | | +| 15.6.1.6.1 | value | The name of the value in the column. | onshore | +| 15.6.1.6.2 | name | The class label of the OEO terms. | onshore wind farm | +| 15.6.1.6.3 | path | The URI of the class. | https://openenergy-platform.org/ontology/oeo/OEO_00000311 | + +#### Resource Keys - Properties +|#|Key |Description |Example | +|---|---|---|---| +| 15.6.2 | primaryKey | A primary key is a field or set of fields that uniquely identifies each row in the table. It is recorded as an array, since it is possible to define the primary key as made up of several columns. | id | +| 15.6.3 | **foreignKeys** | A foreign key is a field that refers to a column in another table. | | +| 15.6.3.1 | fields | The column in the table that is constrainted by the foreign key. | version | +| 15.6.3.2 | **reference** | The reference to the foreign table. | | +| 15.6.3.2.1 | resource | The foreign resource (table). | schema.table | +| 15.6.3.2.2 | fields | The foreign resource column. | version | +| 15.7 | **dialect** | Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are 'null'. | | +| 15.7.1 | delimiter | The delimiter specifies the character sequence which should separate fields (columns). Common characters are "," (comma), "." (point) and "\t" (tab). | , | +| 15.7.2 | decimalSeparator | A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be "." or ",". | . | + +### Review Keys +|#|Key |Description |Example | +|---|---|---|---| +| 16 | @id | A Uniform Resource Identifier (URI) that links the resource via the [DBedia Databus](https://www.dbpedia.org/resources/databus/). | https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00 | +| 17 | @context | Explanation of metadata keys in ontology terms. | https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/latest/context.json | +| 18. | **review** | Data uploaded through the OEP will go through a review process. The review will cover the data and metadata. It is done by the OEP community. See the [OEP Data Review](https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md) for detailed information. The review itself is documented at the specified path and a badge is rewarded with regards to completeness. | | +| 18.1 | path | A URL that should be a permanent http(s) address directly linking to the documented review. | https://www.example.com | +| 18.2 | badge | A badge of either Bronze, Silver, Gold or Platinum is used to label the given data and metadata based on its quality. | Platinum | + +### MetaMetadata Keys +|#|Key |Description |Example | +|---|---|---|---| +| 19 | **metaMetadata** | An object that describes the metadata themselves, their format, version and license. These fields should already be provided when you are filling out your metadata. | | +| 19.1 | metadataVersion | The type and version number of the metadata. | OEP-1.5.2 | +| 19.2 | **metadataLicense** | The license of the provided metadata. | | +| 19.2.1 | name | The [SPDX](https://spdx.org/licenses/) identifier. | CC0-1.0 | +| 19.2.2 | title | The official (human readable) title of the license. | Creative Commons Zero v1.0 Universal | +| 19.2.3 | path | A link to the license text. | https://creativecommons.org/publicdomain/zero/1.0/ | + +### Comments +|#|Key |Description |Example | +|---|---|---|---| +| 20 | **_comment** | An array of objects. This section is used as a self-description of the final metadata file. It is text, intended for humans and includes a link to the metadata documentation, required value formats and similar remarks. | | +| 20.1 | metadata | Reference to the metadata documentation in use. | Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata) | +| 20.2 | dates | Comment on data and time format. | Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh) | +| 20.3 | units | Comment on units. | Use a space between numbers and units (100 m) | +| 20.4 | languages | Comment on language format. | Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE) | +| 20.5 | licenses | Comment on license format. | License name must follow the SPDX License List (https://spdx.org/licenses/) | +| 20.6 | review | Reference to review documentation. | Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md) | +| 20.7 | null | Comment on fields that don't apply. | If not applicable use: null | +| 20.8 | todo | Comment on fields that are not yet available and will be inserted later on. | If a value is not yet available, use: todo | diff --git a/metadata/v200_draft/schema.py b/metadata/v200_draft/schema.py new file mode 100644 index 00000000..e016f37c --- /dev/null +++ b/metadata/v200_draft/schema.py @@ -0,0 +1,5 @@ +import json +import os + +with open(os.path.join(os.path.dirname(__file__), "schema.json"), "rb") as f: + OEMETADATA_V200_SCHEMA = json.loads(f.read()) diff --git a/metadata/v200_draft/template.py b/metadata/v200_draft/template.py new file mode 100644 index 00000000..3e58141e --- /dev/null +++ b/metadata/v200_draft/template.py @@ -0,0 +1,5 @@ +import json +import os + +with open(os.path.join(os.path.dirname(__file__), "template.json"), "rb") as f: + OEMETADATA_V200_TEMPLATE = json.loads(f.read()) diff --git a/tests/metadata/v200/test_example.py b/tests/metadata/v200/test_example.py new file mode 100644 index 00000000..3ed2e9f0 --- /dev/null +++ b/tests/metadata/v200/test_example.py @@ -0,0 +1,10 @@ +def test_if_example_json_loads_successfully(): + from metadata.v200_draft.example import OEMETADATA_V200_EXAMPLE + + +def test_example_against_schema_which_should_succeed(): + import jsonschema + from metadata.v200_draft.example import OEMETADATA_V200_EXAMPLE + from metadata.v200_draft.schema import OEMETADATA_V200_SCHEMA + + assert jsonschema.validate(OEMETADATA_V200_EXAMPLE, OEMETADATA_V200_SCHEMA) == None diff --git a/tests/metadata/v200/test_schema.py b/tests/metadata/v200/test_schema.py new file mode 100644 index 00000000..c2f117b2 --- /dev/null +++ b/tests/metadata/v200/test_schema.py @@ -0,0 +1,34 @@ +def test_if_schema_json_loads_successfully(): + try: + from metadata.v200_draft.schema import OEMETADATA_V200_SCHEMA + except Warning: + print("Metadata Schema v2.0.0 cant load. Check if the files are missing!") + + +def test_if_schema_json_has_correct_schema_and_id_set(): + from metadata.v200_draft.schema import OEMETADATA_V200_SCHEMA + import string + + def get_string(s): + return string.printable + s + string.printable + + assert get_string(OEMETADATA_V200_SCHEMA["$schema"]) == get_string( + "http://json-schema.org/draft-07/schema#" + ) + + # assert get_string(OEMETADATA_V160_SCHEMA["$id"]) == get_string( + # "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/metadata/latest/schema.json" + # ) + + +def test_schema_against_metaschema_which_should_succeed(): + import jsonschema + from metadata.v200_draft.schema import OEMETADATA_V200_SCHEMA + from metadata.metaschema.draft07.schema import OEMETADATA_METASCHEMA_DRAFT07_SCHEMA + + assert ( + jsonschema.validate( + OEMETADATA_V200_SCHEMA, OEMETADATA_METASCHEMA_DRAFT07_SCHEMA + ) + is None + ) diff --git a/tests/metadata/v200/test_template.py b/tests/metadata/v200/test_template.py new file mode 100644 index 00000000..664853f3 --- /dev/null +++ b/tests/metadata/v200/test_template.py @@ -0,0 +1,10 @@ +def test_if_template_json_loads_successfully(): + from metadata.v200_draft.template import OEMETADATA_V200_TEMPLATE + + +def test_template_against_schema_which_should_succeed(): + import jsonschema + from metadata.v200_draft.template import OEMETADATA_V200_TEMPLATE + from metadata.v200_draft.schema import OEMETADATA_V200_SCHEMA + + assert jsonschema.validate(OEMETADATA_V200_TEMPLATE, OEMETADATA_V200_SCHEMA) == None From 8eae47ca4403ebf6f831b7d7803d386346907417 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 11:54:28 +0200 Subject: [PATCH 13/33] update changelog #144 #143 --- CHANGELOG.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61d3b984..3efcf01e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,9 +31,22 @@ Here is a template for new release sections ### Added +- Added oemetadata version 2.0.0: [#???](https://github.com/OpenEnergyPlatform/oemetadata/pull/) + - This includes restructured oemetadata: We now store metadata for each resource that is described in the oemetdata. A resource describes a files (CSV) or database table. Before it was not possible to add metadata to each resource. This change also alines the oemetadata specification with the requirements form frictionless datapackage v1. + +- Introduce a schema build system: [#???](https://github.com/OpenEnergyPlatform/oemetadata/pull/) + - The build files (schema & script) are maintained for each version (starting form v1.6.0) within the new directory called "metadata/v200/build_source" + - The schema is rather long and complex. We split the long schema.json into modules. The modules are assembled in a json file that specifies the structure of the final schema.json and it is called schema_structure.json. + - We use json schema $ref elements to reference the schema modules and we provide code to resolve the reference´s and generate the complete schema.json. + +- Add code to generate a example.json based on the schema.json. We read the example values for each of the fields specified in the schema and generate the example. [#???](https://github.com/OpenEnergyPlatform/oemetadata/pull/) + ### Changed +- Remove comment field as it holds information on how to fill out the metadata and therefore should not be part of the actual oemetadata but the documentation. [#???](https://github.com/OpenEnergyPlatform/oemetadata/pull/) + ### Removed + - ## [1.6.0] - Release - Introduce badges in json schema - 2023-05-30 @@ -44,11 +57,13 @@ Here is a template for new release sections - Add CITATION.cff with list of authors [(#111)](https://github.com/OpenEnergyPlatform/oemetadata/pull/111) ### Changed + - Separate examples from descripton and put into its own key-value pair [PR#117] - Add issue and PR templates [(#116)](https://github.com/OpenEnergyPlatform/oemetadata/pull/116) - Update context field [PR#114] ### Removed + - ## [1.5.2] - Release - Fix missing json files in pypi package, Improve context.jsonld - 2022-11-18 @@ -59,11 +74,13 @@ Here is a template for new release sections ### Added ### Changed + - Update context.json in latest & v151 to ensure ontologically annotated metadata can be sparqled #99 ## [1.5.1] - Release - Ontology-Ready - 2022-02-21 ### Added + - Use [GitHub projects](https://github.com/OpenEnergyPlatform/oemetadata/projects) to organise releases - Add new example table to show connection to OEO - Add test for latest directory to CI [PR#74] @@ -71,6 +88,7 @@ Here is a template for new release sections - Add release version directory for oem-v151 ### Changed + - Update ``subject`` to work with OEO - Rename and update ``isAbout`` to work with OEO - Rename and update ``valueReference`` to work with OEO @@ -82,35 +100,41 @@ Here is a template for new release sections ## [1.5.0] - Release - Get Some Semantics - 2021-11-18 ### Added + - Add keys for linked data compatibility: ``@context``, ``@id``, ``subject``, ``is_about``, ``value_reference`` -- Add context.json file +- Add context.json file - Add licence information to README.md ### Changed + - Clarify instructions for dealing with non-applicable keys (null) and missing values ("todo") - Make key 13.2 ``timeseries`` a list -- Relocate development information from README.md to CONTRIBUTING.md +- Relocate development information from README.md to CONTRIBUTING.md - Update all .json files to v1.5.0 - Reintroduce automated tests (CI) by switching form travis-ci to github actions [PR#63] - Updated schema.json for v1.5.0 now includes the new key ``title`` which describes the title of the curent field [PR#56] adapted from [PR#43] ### Removed + - Delete future directory ## [1.4.1] Minor Release - Repo Upgrade - 2021-01-18 ### Added + - Add directory for v1.4.1 - Add tests for v1.4.1 - Add current section to Changelog, documenting all changes in current branch and stage for release - Extend black options, COMMAND tox -v now shows exactly what code must be reformatted ### Changed + - Rename repository from "metadata" to "oemetadata" ## [1.4.0] Release - It'll be a standard - 2021-01-11 ### Added + - Add ``timeseries`` to ``temporal`` - Add ``context`` object for project information - Add ``object`` to ``contributors`` to decide between data and metadata @@ -126,6 +150,7 @@ Here is a template for new release sections - Add ``_comment`` ### Changed + - Rename ``url`` to ``path`` according to datapackage standard ## [1.0.1] Initial Release - Hello OEMetadata - 2019-11-07 @@ -137,4 +162,3 @@ Here is a template for new release sections - Python implementation and tests for schema, example, template of v1.3.0 - Python implementation and tests for schema, example, template of v1.4.0 - Implementation of metaschema (draft07) and test of metaschema - From 61751fc50c535600b292fb5a6f0128b86228aab2 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 11:57:17 +0200 Subject: [PATCH 14/33] specify the schema.json structure. use $ref elements to link the schema module files #143 --- .../build_source/schema_structure.json | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 metadata/v200_draft/build_source/schema_structure.json diff --git a/metadata/v200_draft/build_source/schema_structure.json b/metadata/v200_draft/build_source/schema_structure.json new file mode 100644 index 00000000..1322f8d3 --- /dev/null +++ b/metadata/v200_draft/build_source/schema_structure.json @@ -0,0 +1,52 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/oemetadata/latest/schema.json", + "description": "Open Energy Plaftorm (OEP) metadata schema latest", + "type": "object", + "properties": { + "generalCollection": { + "$ref": "general_collection.json#" + }, + "resources": { + "description": "A collection of related data resource descriptions and metadata. This may include relational data models which are technically related", + "type": "array", + "items": { + "jsonLd": { + "$ref": "json_ld.json#" + }, + "general": { + "$ref": "general.json#" + }, + "context": { + "$ref": "context.json#" + }, + "spatial": { + "$ref": "spatial.json#" + }, + "temporal": { + "$ref": "temporal.json#" + }, + "sources": { + "$ref": "sources.json#" + }, + "licenses": { + "$ref": "licences.json#" + }, + "contribution": { + "$ref": "contribution.json#" + }, + "resource": { + "$ref": "resource.json#" + }, + "review": { + "$ref": "review.json#" + } + }, + "title": "Resources" + }, + "meta": { + "$ref": "meta.json#" + } + }, + "additionalProperties": true +} \ No newline at end of file From d9df1f3ef7e5ef9204a2199dc3fab27f0cfee60c Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 11:59:13 +0200 Subject: [PATCH 15/33] add schema modules (retrieved from schema.json) that are not aggregated or modified in any way #143 --- .../build_source/schemas/context.json | 100 +++++++++++++++ .../build_source/schemas/contribution.json | 74 +++++++++++ .../build_source/schemas/licences.json | 72 +++++++++++ .../v200_draft/build_source/schemas/meta.json | 67 ++++++++++ .../build_source/schemas/review.json | 38 ++++++ .../build_source/schemas/sources.json | 117 ++++++++++++++++++ .../build_source/schemas/spatial.json | 46 +++++++ .../build_source/schemas/temporal.json | 93 ++++++++++++++ 8 files changed, 607 insertions(+) create mode 100644 metadata/v200_draft/build_source/schemas/context.json create mode 100644 metadata/v200_draft/build_source/schemas/contribution.json create mode 100644 metadata/v200_draft/build_source/schemas/licences.json create mode 100644 metadata/v200_draft/build_source/schemas/meta.json create mode 100644 metadata/v200_draft/build_source/schemas/review.json create mode 100644 metadata/v200_draft/build_source/schemas/sources.json create mode 100644 metadata/v200_draft/build_source/schemas/spatial.json create mode 100644 metadata/v200_draft/build_source/schemas/temporal.json diff --git a/metadata/v200_draft/build_source/schemas/context.json b/metadata/v200_draft/build_source/schemas/context.json new file mode 100644 index 00000000..7d6e2762 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/context.json @@ -0,0 +1,100 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/context.json", + "type": "object", + "properties": { + "context": { + "description": "An Object that describes the general setting, environment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project.", + "example": "https://openenergy-platform.org/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "A URL of the project's documentation.", + "example": "https://openenergy-platform.org/about/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Documentation" + }, + "sourceCode": { + "description": "A URL of the projects source code.", + "example": "https://github.com/OpenEnergyPlatform", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Source Code" + }, + "contact": { + "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "E-Mail Contact", + "format": "email" + }, + "grantNo": { + "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", + "example": "01AB2345", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded project this is the funding agency, which can be a governmental or a company.", + "example": "Bundesministerium für Wirtschaft und Klimaschutz", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "A URL to the logo or image of the funding agency.", + "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "A URL to the logo of the agency publishing the data.", + "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Publisher logo", + "format": "uri" + } + }, + "badge": "Gold", + "title": "Context", + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/contribution.json b/metadata/v200_draft/build_source/schemas/contribution.json new file mode 100644 index 00000000..d5590929 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/contribution.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/contribution.json", + "type": "object", + "properties": { + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization).", + "example": "John Doe", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", + "example": "2016-06-16", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed.", + "example": "data and metadata", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Object" + }, + "comment": { + "description": "Free text comment on what has been done.", + "example": "Fix typo in the title.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Comment" + } + }, + "badge": "Bronze", + "title": "Contributors", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Contributors" + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/licences.json b/metadata/v200_draft/build_source/schemas/licences.json new file mode 100644 index 00000000..5d370ae6 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/licences.json @@ -0,0 +1,72 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/licences.json", + "type": "object", + "properties": { + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "The SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", + "example": "© Reiner Lemoine Institut", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Licenses" + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/meta.json b/metadata/v200_draft/build_source/schemas/meta.json new file mode 100644 index 00000000..dcdb88e0 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/meta.json @@ -0,0 +1,67 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/meta.json", + "type": "object", + "properties": { + "metaMetadata": { + "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you’re filling out your metadata.", + "type": "object", + "properties": { + "metadataVersion": { + "description": "Type and version number of the metadata.", + "example": "OEM-2.0.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Metadata version" + }, + "metadataLicense": { + "description": "Object describing the license of the provided metadata.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier", + "example": "CC0-1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Name" + }, + "title": { + "description": "Official (human readable) license title.", + "example": "Creative Commons Zero v1.0 Universal", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Title" + }, + "path": { + "description": "Url or path string, that is a fully qualified HTTP address.", + "example": "https://creativecommons.org/publicdomain/zero/1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + } + }, + "badge": null, + "title": "Metadata license", + "additionalProperties": false + } + }, + "additionalProperties": false, + "title": "Meta Metadata", + "options": { + "hidden": true + } + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/review.json b/metadata/v200_draft/build_source/schemas/review.json new file mode 100644 index 00000000..bbf2f588 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/review.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/review.json", + "type": "object", + "properties": { + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", + "type": "object", + "properties": { + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", + "example": "https://www.example.com", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + }, + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", + "example": "Platinum", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Badge" + } + }, + "additionalProperties": false, + "title": "Review", + "options": { + "hidden": true + } + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/sources.json b/metadata/v200_draft/build_source/schemas/sources.json new file mode 100644 index 00000000..06aa6186 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/sources.json @@ -0,0 +1,117 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/sources.json", + "type": "object", + "properties": { + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "A human readable title of the source, a document title or organisation name.", + "example": "IPCC Fifth Assessment Report", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "description": { + "description": "A free text description of the data set.", + "example": "Scientific climate change report by the UN", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Description" + }, + "path": { + "description": "A URL to the original source.", + "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path", + "format": "uri" + }, + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "THe SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A link to the license text.", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", + "example": "© Intergovernmental Panel on Climate Change 2014", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses" + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "badge": "Bronze", + "title": "Sources", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Sources" + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/spatial.json b/metadata/v200_draft/build_source/schemas/spatial.json new file mode 100644 index 00000000..0d09c68d --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/spatial.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/spatial.json", + "type": "object", + "properties": { + "spatial": { + "description": "An object that describes the spatial context of the data it contains.", + "type": "object", + "properties": { + "location": { + "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", + "example": "52.433509, 13.535855", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Location" + }, + "extent": { + "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", + "example": "Europe", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", + "example": "3 m", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + } + }, + "badge": "Silver", + "title": "Spatial", + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/metadata/v200_draft/build_source/schemas/temporal.json b/metadata/v200_draft/build_source/schemas/temporal.json new file mode 100644 index 00000000..ee57959c --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/temporal.json @@ -0,0 +1,93 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/temporal.json", + "type": "object", + "properties": { + "temporal": { + "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", + "example": "2016-01-01", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", + "type": "array", + "items": { + "type": "object", + "properties": { + "start": { + "description": "The beginning point in time of a time series.", + "example": "2019-02-06T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Start", + "format": "date-time" + }, + "end": { + "description": "The end point in time of a time series.", + "example": "2019-02-07T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "End", + "format": "date-time" + }, + "resolution": { + "description": "The time span between individual points of information in a time series.", + "example": " 30 s", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + }, + "alignment": { + "description": "An indicator whether stamps in a time series are left, right or middle.", + "example": "left", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Alignment" + }, + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current.", + "example": "sum", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Aggregation type" + } + }, + "badge": "Silver", + "title": "Timeseries", + "additionalProperties": false + }, + "badge": "Silver", + "title": "Timeseries" + } + }, + "badge": "Silver", + "title": "Temporal", + "additionalProperties": false + } + } +} \ No newline at end of file From aca7f3ce81944d36df96c5a2fe64335147c05498 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 12:00:41 +0200 Subject: [PATCH 16/33] add schema module that specifies new metadata fields for the top level of the schema: describe the oemetadata collection/resources (includes 1:n resources) #143 --- .../schemas/general_collection.json | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 metadata/v200_draft/build_source/schemas/general_collection.json diff --git a/metadata/v200_draft/build_source/schemas/general_collection.json b/metadata/v200_draft/build_source/schemas/general_collection.json new file mode 100644 index 00000000..a1510dfa --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/general_collection.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/general_collection.json", + "type": "object", + "properties": { + "name": { + "description": "Collection name", + "example": "my_oep_collection", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Collection name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "collectionId": { + "description": "A Uniform Resource Identifier (URI) that links the resource collection.", + "example": "https://todo", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Collection identifier", + "readonly": true + } + } +} \ No newline at end of file From 2901b7c810f95d2b50c7c9977c899225aea88720 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 14:28:54 +0200 Subject: [PATCH 17/33] Implement scripts to generate the schema / example ... move scripts to version specific source_build directory #143 --- .../scripts}/create_example.py | 0 .../scripts/generate_example_from_schema.py | 110 ++++++++++++++++++ .../scripts}/resolve_schema_refs.py | 38 +++--- scripts/generate_example_from_schema.py | 92 --------------- 4 files changed, 132 insertions(+), 108 deletions(-) rename metadata/v200_draft/{ => build_source/scripts}/create_example.py (100%) create mode 100644 metadata/v200_draft/build_source/scripts/generate_example_from_schema.py rename {scripts => metadata/v200_draft/build_source/scripts}/resolve_schema_refs.py (82%) delete mode 100644 scripts/generate_example_from_schema.py diff --git a/metadata/v200_draft/create_example.py b/metadata/v200_draft/build_source/scripts/create_example.py similarity index 100% rename from metadata/v200_draft/create_example.py rename to metadata/v200_draft/build_source/scripts/create_example.py diff --git a/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py b/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py new file mode 100644 index 00000000..9ec794d2 --- /dev/null +++ b/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Title: create example from json schema +Description: Create example from json schema. +Author: jh-RLI +Email: jonas.huber@rl-institut.de +Date: 2024-05-30 +Version: 1.0.0 +""" + +# Standard Library Imports +# import os +from os.path import dirname + +import sys +import json +import logging + +# from datetime import datetime +from pathlib import Path + +from jsonschema import validate, ValidationError + +# Configuration +LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +logger = logging.getLogger(__name__) + +# Constants +BASE_PATH = Path("metadata/") +VERSION = "v200_draft" +VERSION_PATH = BASE_PATH / VERSION +SCHEMA_BUILD_PATH = VERSION_PATH / "build_source" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "schema_structure.json" +SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" +EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" +EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" + + +def generate_example(schema): + if isinstance(schema, bool): + return {} if schema else None + + if "type" not in schema and "properties" not in schema and "items" not in schema: + return None + + schema_type = schema.get("type") + + if isinstance(schema_type, list): + schema_type = schema_type[0] + + if "example" in schema: + example = schema["example"] + # Convert example string to actual type if necessary + if schema_type == "array" and isinstance(example, str): + try: + example = json.loads(example.replace("'", '"')) + except json.JSONDecodeError: + pass + return example + + if schema_type == "object" or "properties" in schema: + example = {} + properties = schema.get("properties", {}) + for prop, prop_schema in properties.items(): + example[prop] = generate_example(prop_schema) + additional_properties = schema.get("additionalProperties", True) + if isinstance(additional_properties, dict): + example["additional_property"] = generate_example(additional_properties) + return example + + if schema_type == "array": + item_schema = schema.get("items", {}) + return [generate_example(item_schema)] + + if schema_type == "string": + return "" + + if schema_type == "number": + return 0 + + if schema_type == "integer": + return 0 + + if schema_type == "boolean": + return False + + return None + + +def main(): + schema_file_path = RESOLVED_SCHEMA_FILE_NAME + + with open(schema_file_path, "r", encoding="utf-8") as schema_file: + schema = json.load(schema_file) + + example = generate_example(schema) + + example_file_path = EXAMPLE_PATH + with open(example_file_path, "w", encoding="utf-8") as example_file: + json.dump(example, example_file, indent=2, ensure_ascii=False) + + print(f"Example JSON generated and saved to {example_file_path}") + + +if __name__ == "__main__": + main() diff --git a/scripts/resolve_schema_refs.py b/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py similarity index 82% rename from scripts/resolve_schema_refs.py rename to metadata/v200_draft/build_source/scripts/resolve_schema_refs.py index bd3400a5..0b5e86a9 100644 --- a/scripts/resolve_schema_refs.py +++ b/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py @@ -38,10 +38,10 @@ BASE_PATH = Path("metadata/") VERSION = "v200_draft" VERSION_PATH = BASE_PATH / VERSION -SCHEMA_BUILD_PATH = VERSION_PATH / "build" -MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "main_schema.json" +SCHEMA_BUILD_PATH = VERSION_PATH / "build_source" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "schema_structure.json" SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" -RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "schema.json" EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" @@ -55,7 +55,7 @@ def setup(): # Load the main schema def load_schema(schema_path): - with open(schema_path, "r") as file: + with open(schema_path, "r", encoding="utf-8") as file: return json.load(file) @@ -112,7 +112,9 @@ def resolve_references(schema, registry, base_uri): print( f"Resolved reference {ref_uri} to {ref_schema.contents}" ) # Debugging - return resolve_references(ref_schema.contents, registry, base_uri) + return ref_schema.contents[ + "properties" + ] # Return only the properties except KeyError as e: raise ValueError(f"Reference {ref_uri} could not be resolved: {e}") else: @@ -125,16 +127,20 @@ def resolve_references(schema, registry, base_uri): return schema # Resolve the top-level properties - resolved_properties = {} - for prop, value in schema["properties"].items(): - if "$ref" in value: - resolved_value = resolve_references(value, registry, base_uri) - resolved_properties.update(resolved_value["properties"]) - else: - resolved_properties[prop] = resolve_references(value, registry, base_uri) - - # Replace the properties in the schema with the resolved properties - schema["properties"] = resolved_properties + def resolve_top_level_properties(schema, registry, base_uri): + resolved_properties = {} + for prop, value in schema["properties"].items(): + if isinstance(value, dict) and "properties" in value: + resolved_value = resolve_references( + value["properties"], registry, base_uri + ) + resolved_properties[prop] = resolved_value + else: + resolved_value = resolve_references(value, registry, base_uri) + resolved_properties[prop] = resolved_value + return resolved_properties + + schema["properties"] = resolve_top_level_properties(schema, registry, base_uri) return schema @@ -164,7 +170,7 @@ def main(debug): resolved_schema = resolve_and_merge(MAIN_SCHEMA_PATH, debug) # Save the resolved schema to a new file - with open(RESOLVED_SCHEMA_FILE_NAME, "w") as output_file: + with open(RESOLVED_SCHEMA_FILE_NAME, "w", encoding="utf-8") as output_file: json.dump(resolved_schema, output_file, indent=2) # Load the expected schema and validate diff --git a/scripts/generate_example_from_schema.py b/scripts/generate_example_from_schema.py deleted file mode 100644 index c878dc62..00000000 --- a/scripts/generate_example_from_schema.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -""" -Title: create example from json schema -Description: Create example from json schema. -Author: jh-RLI -Email: jonas.huber@rl-institut.de -Date: 2024-05-30 -Version: 1.0.0 -""" - -# Standard Library Imports -# import os -from os.path import dirname - -import sys -import json -import logging - -# from datetime import datetime -from pathlib import Path - -from jsonschema import validate, ValidationError - -# Configuration -LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" -logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) -logger = logging.getLogger(__name__) - -# Constants -BASE_PATH = Path("metadata/") -VERSION = "v200_draft" -VERSION_PATH = BASE_PATH / VERSION -SCHEMA_BUILD_PATH = VERSION_PATH / "build" -MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "main_schema.json" -SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" -RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" -EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" -EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" - - -def generate_example(schema): - if "example" in schema: - return schema["example"] - if "const" in schema: - return schema["const"] - if "enum" in schema: - return schema["enum"][0] - if schema.get("type") == "object": - obj = {} - for key, value in schema.get("properties", {}).items(): - obj[key] = generate_example(value) - return obj - if schema.get("type") == "array": - example_items = schema.get("example", []) - if not example_items: - example_items = [generate_example(schema["items"])] - return example_items - if "type" in schema: - if schema["type"] == "string": - return schema.get("example", "") - if schema["type"] == "number": - return schema.get("example", 0) - if schema["type"] == "boolean": - return schema.get("example", False) - if schema["type"] == "null": - return None - return None - - -def create_example_json(schema_file_path, output_file_path): - with open(schema_file_path, "r") as schema_file: - schema = json.load(schema_file) - - example_json = generate_example(schema) - - with open(output_file_path, "w") as output_file: - json.dump(example_json, output_file, indent=4) - print(f"{output_file_path} has been created.") - - try: - validate(instance=example_json, schema=schema) - print(f"The generated example JSON is valid according to the schema.") - except ValidationError as e: - print(f"The generated example JSON is not valid: {e.message}") - - -schema_file_path = RESOLVED_SCHEMA_FILE_NAME -output_file_path = EXAMPLE_PATH - -create_example_json(schema_file_path, output_file_path) From 6e595691240e6100168764bb1f923f100064343b Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 14:31:30 +0200 Subject: [PATCH 18/33] Add schema build approach for current latest version (prepare for release of v1.6.1 #143 --- metadata/latest/build_source/main_schema.json | 42 + .../latest/build_source/schemas/context.json | 100 ++ .../build_source/schemas/contribution.json | 74 ++ .../latest/build_source/schemas/general.json | 128 ++ .../latest/build_source/schemas/json_ld.json | 28 + .../latest/build_source/schemas/licences.json | 72 ++ .../latest/build_source/schemas/meta.json | 67 ++ .../build_source/schemas/resources.json | 340 ++++++ .../latest/build_source/schemas/review.json | 38 + .../latest/build_source/schemas/sources.json | 117 ++ .../latest/build_source/schemas/spatial.json | 46 + .../latest/build_source/schemas/temporal.json | 93 ++ .../scripts/resolve_schema_refs.py | 187 +++ metadata/latest/res_schema.json | 1035 +++++++++++++++++ 14 files changed, 2367 insertions(+) create mode 100644 metadata/latest/build_source/main_schema.json create mode 100644 metadata/latest/build_source/schemas/context.json create mode 100644 metadata/latest/build_source/schemas/contribution.json create mode 100644 metadata/latest/build_source/schemas/general.json create mode 100644 metadata/latest/build_source/schemas/json_ld.json create mode 100644 metadata/latest/build_source/schemas/licences.json create mode 100644 metadata/latest/build_source/schemas/meta.json create mode 100644 metadata/latest/build_source/schemas/resources.json create mode 100644 metadata/latest/build_source/schemas/review.json create mode 100644 metadata/latest/build_source/schemas/sources.json create mode 100644 metadata/latest/build_source/schemas/spatial.json create mode 100644 metadata/latest/build_source/schemas/temporal.json create mode 100644 metadata/latest/build_source/scripts/resolve_schema_refs.py create mode 100644 metadata/latest/res_schema.json diff --git a/metadata/latest/build_source/main_schema.json b/metadata/latest/build_source/main_schema.json new file mode 100644 index 00000000..b00bb080 --- /dev/null +++ b/metadata/latest/build_source/main_schema.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/oemetadata/latest/schema.json", + "description": "Open Energy Plaftorm (OEP) metadata schema latest", + "type": "object", + "properties": { + "jsonLd": { + "$ref": "json_ld.json#" + }, + "general": { + "$ref": "general.json#" + }, + "context": { + "$ref": "context.json#" + }, + "spatial": { + "$ref": "spatial.json#" + }, + "temporal": { + "$ref": "temporal.json#" + }, + "sources": { + "$ref": "sources.json#" + }, + "licenses": { + "$ref": "licences.json#" + }, + "contribution": { + "$ref": "contribution.json#" + }, + "resources": { + "$ref": "resources.json#" + }, + "review": { + "$ref": "review.json#" + }, + "meta": { + "$ref": "meta.json#" + } + }, + "additionalProperties": true +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/context.json b/metadata/latest/build_source/schemas/context.json new file mode 100644 index 00000000..d2618427 --- /dev/null +++ b/metadata/latest/build_source/schemas/context.json @@ -0,0 +1,100 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/context.json", + "type": "object", + "properties": { + "context": { + "description": "An Object that describes the general setting, evironment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project.", + "example": "https://openenergy-platform.org/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "A URL of the project's documentation.", + "example": "https://openenergy-platform.org/about/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Documentation" + }, + "sourceCode": { + "description": "A URL of the projects source code.", + "example": "https://github.com/OpenEnergyPlatform", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Source Code" + }, + "contact": { + "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "E-Mail Contact", + "format": "email" + }, + "grantNo": { + "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", + "example": "01AB2345", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded project this is the funding agency, which can be a governmental or a company.", + "example": "Bundesministerium für Wirtschaft und Klimaschutz", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "A URL to the logo or image of the funding agency.", + "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "A URL to the logo of the agency publishing the data.", + "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Publisher logo", + "format": "uri" + } + }, + "badge": "Gold", + "title": "Context", + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/contribution.json b/metadata/latest/build_source/schemas/contribution.json new file mode 100644 index 00000000..d5590929 --- /dev/null +++ b/metadata/latest/build_source/schemas/contribution.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/contribution.json", + "type": "object", + "properties": { + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization).", + "example": "John Doe", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", + "example": "2016-06-16", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed.", + "example": "data and metadata", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Object" + }, + "comment": { + "description": "Free text comment on what has been done.", + "example": "Fix typo in the title.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Comment" + } + }, + "badge": "Bronze", + "title": "Contributors", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Contributors" + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/general.json b/metadata/latest/build_source/schemas/general.json new file mode 100644 index 00000000..6fb49409 --- /dev/null +++ b/metadata/latest/build_source/schemas/general.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/general.json", + "type": "object", + "properties": { + "name": { + "description": "File name or database table name", + "example": "oep_metadata_table_example_v160", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", + "example": "https://example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "ID", + "readonly": true + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", + "example": "Example table used to illustrate the metadata structure and meaning.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "subject": { + "description": "Reference the topic of the resource in ontology terms", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The class label of the OEO term.", + "example": "energy", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "The URI of the class.", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "Subject", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "Subject" + }, + "language": { + "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", + "example": "[en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", + "example": "en-GB", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Language" + }, + "badge": "Gold", + "title": "Language" + }, + "keywords": { + "description": "A list of string keywords to assist users searching for the package in catalogs.", + "example": "[example, template, test]", + "type": "array", + "items": { + "description": "A keyword to assist users searching for the package in catalogs.", + "example": "template", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Keyword" + }, + "badge": "Silver", + "title": "Keywords" + }, + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", + "example": "2019-02-06", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Publication date", + "format": "date" + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/json_ld.json b/metadata/latest/build_source/schemas/json_ld.json new file mode 100644 index 00000000..d18b8326 --- /dev/null +++ b/metadata/latest/build_source/schemas/json_ld.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "json_ld.json#metadata/v200_draft/schemas/json_ld.json", + "type": "object", + "properties": { + "@id": { + "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", + "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@Id", + "readonly": true + }, + "@context": { + "description": "Explanation of metadata keys in ontology terms.", + "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@context" + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/licences.json b/metadata/latest/build_source/schemas/licences.json new file mode 100644 index 00000000..5d370ae6 --- /dev/null +++ b/metadata/latest/build_source/schemas/licences.json @@ -0,0 +1,72 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/licences.json", + "type": "object", + "properties": { + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "The SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", + "example": "© Reiner Lemoine Institut", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Licenses" + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/meta.json b/metadata/latest/build_source/schemas/meta.json new file mode 100644 index 00000000..c1dbd065 --- /dev/null +++ b/metadata/latest/build_source/schemas/meta.json @@ -0,0 +1,67 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/meta.json", + "type": "object", + "properties": { + "metaMetadata": { + "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you’re filling out your metadata.", + "type": "object", + "properties": { + "metadataVersion": { + "description": "Type and version number of the metadata.", + "example": "OEM-1.6.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Metadata version" + }, + "metadataLicense": { + "description": "Object describing the license of the provided metadata.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier", + "example": "CC0-1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Name" + }, + "title": { + "description": "Official (human readable) license title.", + "example": "Creative Commons Zero v1.0 Universal", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Title" + }, + "path": { + "description": "Url or path string, that is a fully qualified HTTP address.", + "example": "https://creativecommons.org/publicdomain/zero/1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + } + }, + "badge": null, + "title": "Metadata license", + "additionalProperties": false + } + }, + "additionalProperties": false, + "title": "Meta Metadata", + "options": { + "hidden": true + } + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/resources.json b/metadata/latest/build_source/schemas/resources.json new file mode 100644 index 00000000..faaa36d9 --- /dev/null +++ b/metadata/latest/build_source/schemas/resources.json @@ -0,0 +1,340 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/resources.json", + "type": "object", + "properties": { + "resources": { + "description": "Resources, described as a list of data resource format objects.", + "type": "array", + "items": { + "description": "The data resource format describes a data resource as an individual file or table.", + "type": "object", + "properties": { + "profile": { + "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", + "example": "tabular-data-resource", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Profile", + "options": { + "hidden": true + } + }, + "name": { + "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", + "example": "sandbox.example_table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name" + }, + "path": { + "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", + "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Path", + "options": { + "hidden": true + } + }, + "format": { + "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", + "example": "csv", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Format", + "options": { + "hidden": true + } + }, + "encoding": { + "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", + "example": "UTF-8", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Encoding", + "options": { + "hidden": true + } + }, + "schema": { + "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "type": "object", + "properties": { + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "type": "object", + "properties": { + "name": { + "description": "The name of the field. The string must be unique within it's scope", + "example": "year", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name", + "readonly": true + }, + "description": { + "description": "A text describing the field.", + "example": "Reference year for which the data were collected.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "type": { + "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", + "example": "geometry(Point, 4326)", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Type", + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "A class label of the OEO terms.", + "example": "wind energy converting unit", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "Path to the OEO class (URI)", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "isAbout", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "isAbout" + }, + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "description": "The name of the value in the column.", + "example": "onshore", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Value" + }, + "name": { + "description": "The class label of the OEO terms.", + "example": "onshore wind farm", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": " The URI of the OEO class", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "valueReference", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "valueReference" + }, + "unit": { + "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", + "example": "MW", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" + }, + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", + "example": "id", + "type": "array", + "items": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", + "example": "id", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Primary key" + }, + "badge": "Iron", + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { + "fields": { + "description": "The column (as list of items) in the table that is constrainted by the foreign key.", + "example": "version", + "type": "array", + "items": { + "description": "The column in the table that is constrainted by the foreign key.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table).", + "example": "schema.table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Resource" + }, + "fields": { + "description": "The foreign resource column.", + "example": "version", + "type": "array", + "items": { + "description": "The foreign resource column.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Field" + } + }, + "badge": "Iron", + "title": "Reference", + "additionalProperties": false + } + }, + "title": "Foreign Key", + "additionalProperties": false + }, + "badge": "Iron", + "title": "Foreign Keys" + } + }, + "title": "Schema", + "additionalProperties": false + }, + "dialect": { + "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + "type": "object", + "properties": { + "delimiter": { + "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", + "example": ",", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Delimiter" + }, + "decimalSeparator": { + "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", + "example": ".", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Decimal separator" + } + }, + "additionalProperties": false, + "title": "Dialect", + "options": { + "hidden": true + } + } + }, + "additionalProperties": false, + "title": "Resource" + }, + "title": "Resource" + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/review.json b/metadata/latest/build_source/schemas/review.json new file mode 100644 index 00000000..bbf2f588 --- /dev/null +++ b/metadata/latest/build_source/schemas/review.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/review.json", + "type": "object", + "properties": { + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", + "type": "object", + "properties": { + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", + "example": "https://www.example.com", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + }, + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", + "example": "Platinum", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Badge" + } + }, + "additionalProperties": false, + "title": "Review", + "options": { + "hidden": true + } + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/sources.json b/metadata/latest/build_source/schemas/sources.json new file mode 100644 index 00000000..06aa6186 --- /dev/null +++ b/metadata/latest/build_source/schemas/sources.json @@ -0,0 +1,117 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/sources.json", + "type": "object", + "properties": { + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "A human readable title of the source, a document title or organisation name.", + "example": "IPCC Fifth Assessment Report", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "description": { + "description": "A free text description of the data set.", + "example": "Scientific climate change report by the UN", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Description" + }, + "path": { + "description": "A URL to the original source.", + "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path", + "format": "uri" + }, + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "THe SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A link to the license text.", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", + "example": "© Intergovernmental Panel on Climate Change 2014", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses" + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "badge": "Bronze", + "title": "Sources", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Sources" + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/spatial.json b/metadata/latest/build_source/schemas/spatial.json new file mode 100644 index 00000000..0d09c68d --- /dev/null +++ b/metadata/latest/build_source/schemas/spatial.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/spatial.json", + "type": "object", + "properties": { + "spatial": { + "description": "An object that describes the spatial context of the data it contains.", + "type": "object", + "properties": { + "location": { + "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", + "example": "52.433509, 13.535855", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Location" + }, + "extent": { + "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", + "example": "Europe", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", + "example": "3 m", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + } + }, + "badge": "Silver", + "title": "Spatial", + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/schemas/temporal.json b/metadata/latest/build_source/schemas/temporal.json new file mode 100644 index 00000000..ee57959c --- /dev/null +++ b/metadata/latest/build_source/schemas/temporal.json @@ -0,0 +1,93 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/temporal.json", + "type": "object", + "properties": { + "temporal": { + "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", + "example": "2016-01-01", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", + "type": "array", + "items": { + "type": "object", + "properties": { + "start": { + "description": "The beginning point in time of a time series.", + "example": "2019-02-06T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Start", + "format": "date-time" + }, + "end": { + "description": "The end point in time of a time series.", + "example": "2019-02-07T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "End", + "format": "date-time" + }, + "resolution": { + "description": "The time span between individual points of information in a time series.", + "example": " 30 s", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + }, + "alignment": { + "description": "An indicator whether stamps in a time series are left, right or middle.", + "example": "left", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Alignment" + }, + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current.", + "example": "sum", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Aggregation type" + } + }, + "badge": "Silver", + "title": "Timeseries", + "additionalProperties": false + }, + "badge": "Silver", + "title": "Timeseries" + } + }, + "badge": "Silver", + "title": "Temporal", + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/metadata/latest/build_source/scripts/resolve_schema_refs.py b/metadata/latest/build_source/scripts/resolve_schema_refs.py new file mode 100644 index 00000000..bd3400a5 --- /dev/null +++ b/metadata/latest/build_source/scripts/resolve_schema_refs.py @@ -0,0 +1,187 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Title: Resolve schema $ref +Description: Resolve "$ref" elements in schema.json. +Author: jh-RLI +Email: jonas.huber@rl-institut.de +Date: 2024-05-30 +Version: 1.0.0 + +requires: "pip install jsonschema referencing" + +Usage: Script with additional arguments --debug for more detailed output. + Requires the folder structure introduced in oemetadata v2.0.0. +""" + +# Standard Library Imports +# import os +import sys +import json +import logging + +# from datetime import datetime +from pathlib import Path +from urllib.parse import urljoin +import argparse + +from referencing import Registry, Resource +from jsonschema import Draft7Validator + +# Configuration +LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +logger = logging.getLogger(__name__) + +# Constants +BASE_PATH = Path("metadata/") +VERSION = "v200_draft" +VERSION_PATH = BASE_PATH / VERSION +SCHEMA_BUILD_PATH = VERSION_PATH / "build" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "main_schema.json" +SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" +EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" + + +# Function Definitions +def setup(): + """ + Setup function to initialize resources or configurations. + """ + logger.info("Setup complete.") + + +# Load the main schema +def load_schema(schema_path): + with open(schema_path, "r") as file: + return json.load(file) + + +# Ensure the schema has the $schema field +def ensure_schema_field(schema): + if "$schema" not in schema: + schema["$schema"] = "http://json-schema.org/draft-07/schema#" + return schema + + +# Debugging function to print registry contents +def print_registry_contents(registry, debug): + if debug: + print("Registry Contents:") + for uri, resource in registry._resources.items(): + print(f"{uri}: {resource.contents}") + + +# Resolve and merge references using referencing library +def resolve_and_merge(schema_path, debug): + schema = load_schema(schema_path) + schema = ensure_schema_field(schema) + + # Create a registry and register the schemas + base_uri = MAIN_SCHEMA_PATH.resolve().parent.as_uri() + "/" + registry = Registry().with_resource(base_uri, Resource.from_contents(schema)) + + for schema_file in SCHEMA_REFS.glob("*.json"): + try: + with open(schema_file, "r") as file: + ref_schema = json.load(file) + ref_schema = ensure_schema_field(ref_schema) + schema_uri = urljoin(base_uri, schema_file.name) + registry = registry.with_resource( + schema_uri, Resource.from_contents(ref_schema) + ) + except json.JSONDecodeError as e: + logger.error(f"Error decoding JSON from {schema_file}: {e}") + continue + + # Print registry contents for debugging + print_registry_contents(registry, debug) + + # Resolve references in the schema + def resolve_references(schema, registry, base_uri): + if isinstance(schema, dict): + if "$ref" in schema: + ref_uri = urljoin(base_uri, schema["$ref"]) + if debug: + print(f"Resolving reference {ref_uri}") # Debugging + try: + ref_schema = registry[ref_uri] + if debug: + print( + f"Resolved reference {ref_uri} to {ref_schema.contents}" + ) # Debugging + return resolve_references(ref_schema.contents, registry, base_uri) + except KeyError as e: + raise ValueError(f"Reference {ref_uri} could not be resolved: {e}") + else: + return { + key: resolve_references(value, registry, base_uri) + for key, value in schema.items() + } + elif isinstance(schema, list): + return [resolve_references(item, registry, base_uri) for item in schema] + return schema + + # Resolve the top-level properties + resolved_properties = {} + for prop, value in schema["properties"].items(): + if "$ref" in value: + resolved_value = resolve_references(value, registry, base_uri) + resolved_properties.update(resolved_value["properties"]) + else: + resolved_properties[prop] = resolve_references(value, registry, base_uri) + + # Replace the properties in the schema with the resolved properties + schema["properties"] = resolved_properties + return schema + + +# Validate the schema +def validate_schema(resolved_schema, expected_schema): + validator = Draft7Validator(expected_schema) + errors = sorted(validator.iter_errors(resolved_schema), key=lambda e: e.path) + for error in errors: + print(f"Validation error at {list(error.path)}: {error.message}") + + +# Load expected schema (without refs) for validation +def load_expected_schema(expected_schema_path): + with open(expected_schema_path, "r", encoding="utf-8") as file: + return json.load(file) + + +def main(debug): + """ + Main function to execute the script's primary logic. + """ + try: + setup() + logger.info("Main execution started.") + + # Resolve and merge the schema + resolved_schema = resolve_and_merge(MAIN_SCHEMA_PATH, debug) + + # Save the resolved schema to a new file + with open(RESOLVED_SCHEMA_FILE_NAME, "w") as output_file: + json.dump(resolved_schema, output_file, indent=2) + + # Load the expected schema and validate + expected_schema = load_expected_schema(EXPECTED_SCHEMA_PATH) + validate_schema(resolved_schema, expected_schema) + + logger.info("Main execution finished.") + except Exception as e: + logger.error("An error occurred: %s", e) + sys.exit(1) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Resolve and merge JSON schema references." + ) + parser.add_argument("--debug", action="store_true", help="Enable debugging output") + args = parser.parse_args() + + main(args.debug) diff --git a/metadata/latest/res_schema.json b/metadata/latest/res_schema.json new file mode 100644 index 00000000..4f3f3cc6 --- /dev/null +++ b/metadata/latest/res_schema.json @@ -0,0 +1,1035 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/oemetadata/latest/schema.json", + "description": "Open Energy Plaftorm (OEP) metadata schema latest", + "type": "object", + "properties": { + "@id": { + "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", + "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@Id", + "readonly": true + }, + "@context": { + "description": "Explanation of metadata keys in ontology terms.", + "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@context" + }, + "name": { + "description": "File name or database table name", + "example": "oep_metadata_table_example_v160", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", + "example": "https://example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "ID", + "readonly": true + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", + "example": "Example table used to illustrate the metadata structure and meaning.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "subject": { + "description": "Reference the topic of the resource in ontology terms", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The class label of the OEO term.", + "example": "energy", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "The URI of the class.", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "Subject", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "Subject" + }, + "language": { + "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", + "example": "[en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", + "example": "en-GB", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Language" + }, + "badge": "Gold", + "title": "Language" + }, + "keywords": { + "description": "A list of string keywords to assist users searching for the package in catalogs.", + "example": "[example, template, test]", + "type": "array", + "items": { + "description": "A keyword to assist users searching for the package in catalogs.", + "example": "template", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Keyword" + }, + "badge": "Silver", + "title": "Keywords" + }, + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", + "example": "2019-02-06", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Publication date", + "format": "date" + }, + "context": { + "description": "An Object that describes the general setting, evironment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project.", + "example": "https://openenergy-platform.org/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "A URL of the project's documentation.", + "example": "https://openenergy-platform.org/about/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Documentation" + }, + "sourceCode": { + "description": "A URL of the projects source code.", + "example": "https://github.com/OpenEnergyPlatform", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Source Code" + }, + "contact": { + "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "E-Mail Contact", + "format": "email" + }, + "grantNo": { + "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", + "example": "01AB2345", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded project this is the funding agency, which can be a governmental or a company.", + "example": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "A URL to the logo or image of the funding agency.", + "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "A URL to the logo of the agency publishing the data.", + "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Publisher logo", + "format": "uri" + } + }, + "badge": "Gold", + "title": "Context", + "additionalProperties": false + }, + "spatial": { + "description": "An object that describes the spatial context of the data it contains.", + "type": "object", + "properties": { + "location": { + "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", + "example": "52.433509, 13.535855", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Location" + }, + "extent": { + "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", + "example": "Europe", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", + "example": "3 m", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + } + }, + "badge": "Silver", + "title": "Spatial", + "additionalProperties": false + }, + "temporal": { + "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", + "example": "2016-01-01", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", + "type": "array", + "items": { + "type": "object", + "properties": { + "start": { + "description": "The beginning point in time of a time series.", + "example": "2019-02-06T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Start", + "format": "date-time" + }, + "end": { + "description": "The end point in time of a time series.", + "example": "2019-02-07T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "End", + "format": "date-time" + }, + "resolution": { + "description": "The time span between individual points of information in a time series.", + "example": " 30 s", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + }, + "alignment": { + "description": "An indicator whether stamps in a time series are left, right or middle.", + "example": "left", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Alignment" + }, + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current.", + "example": "sum", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Aggregation type" + } + }, + "badge": "Silver", + "title": "Timeseries", + "additionalProperties": false + }, + "badge": "Silver", + "title": "Timeseries" + } + }, + "badge": "Silver", + "title": "Temporal", + "additionalProperties": false + }, + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "A human readable title of the source, a document title or organisation name.", + "example": "IPCC Fifth Assessment Report", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "description": { + "description": "A free text description of the data set.", + "example": "Scientific climate change report by the UN", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Description" + }, + "path": { + "description": "A URL to the original source.", + "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path", + "format": "uri" + }, + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "THe SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A link to the license text.", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", + "example": "\u00a9 Intergovernmental Panel on Climate Change 2014", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses" + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "badge": "Bronze", + "title": "Sources", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Sources" + }, + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "The SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", + "example": "\u00a9 Reiner Lemoine Institut", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Licenses" + }, + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization).", + "example": "John Doe", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", + "example": "2016-06-16", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed.", + "example": "data and metadata", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Object" + }, + "comment": { + "description": "Free text comment on what has been done.", + "example": "Fix typo in the title.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Comment" + } + }, + "badge": "Bronze", + "title": "Contributors", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Contributors" + }, + "resources": { + "description": "Resources, described as a list of data resource format objects.", + "type": "array", + "items": { + "description": "The data resource format describes a data resource as an individual file or table.", + "type": "object", + "properties": { + "profile": { + "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", + "example": "tabular-data-resource", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Profile", + "options": { + "hidden": true + } + }, + "name": { + "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", + "example": "sandbox.example_table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name" + }, + "path": { + "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", + "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Path", + "options": { + "hidden": true + } + }, + "format": { + "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", + "example": "csv", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Format", + "options": { + "hidden": true + } + }, + "encoding": { + "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", + "example": "UTF-8", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Encoding", + "options": { + "hidden": true + } + }, + "schema": { + "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "type": "object", + "properties": { + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "type": "object", + "properties": { + "name": { + "description": "The name of the field. The string must be unique within it's scope", + "example": "year", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name", + "readonly": true + }, + "description": { + "description": "A text describing the field.", + "example": "Reference year for which the data were collected.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "type": { + "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", + "example": "geometry(Point, 4326)", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Type", + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "A class label of the OEO terms.", + "example": "wind energy converting unit", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "Path to the OEO class (URI)", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "isAbout", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "isAbout" + }, + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "description": "The name of the value in the column.", + "example": "onshore", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Value" + }, + "name": { + "description": "The class label of the OEO terms.", + "example": "onshore wind farm", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": " The URI of the OEO class", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "valueReference", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "valueReference" + }, + "unit": { + "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", + "example": "MW", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" + }, + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", + "example": "id", + "type": "array", + "items": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", + "example": "id", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Primary key" + }, + "badge": "Iron", + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { + "fields": { + "description": "The column (as list of items) in the table that is constrainted by the foreign key.", + "example": "version", + "type": "array", + "items": { + "description": "The column in the table that is constrainted by the foreign key.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table).", + "example": "schema.table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Resource" + }, + "fields": { + "description": "The foreign resource column.", + "example": "version", + "type": "array", + "items": { + "description": "The foreign resource column.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Field" + } + }, + "badge": "Iron", + "title": "Reference", + "additionalProperties": false + } + }, + "title": "Foreign Key", + "additionalProperties": false + }, + "badge": "Iron", + "title": "Foreign Keys" + } + }, + "title": "Schema", + "additionalProperties": false + }, + "dialect": { + "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + "type": "object", + "properties": { + "delimiter": { + "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", + "example": ",", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Delimiter" + }, + "decimalSeparator": { + "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", + "example": ".", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Decimal separator" + } + }, + "additionalProperties": false, + "title": "Dialect", + "options": { + "hidden": true + } + } + }, + "additionalProperties": false, + "title": "Resource" + }, + "title": "Resource" + }, + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", + "type": "object", + "properties": { + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", + "example": "https://www.example.com", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + }, + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", + "example": "Platinum", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Badge" + } + }, + "additionalProperties": false, + "title": "Review", + "options": { + "hidden": true + } + }, + "metaMetadata": { + "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you\u2019re filling out your metadata.", + "type": "object", + "properties": { + "metadataVersion": { + "description": "Type and version number of the metadata.", + "example": "OEM-1.6.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Metadata version" + }, + "metadataLicense": { + "description": "Object describing the license of the provided metadata.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier", + "example": "CC0-1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Name" + }, + "title": { + "description": "Official (human readable) license title.", + "example": "Creative Commons Zero v1.0 Universal", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Title" + }, + "path": { + "description": "Url or path string, that is a fully qualified HTTP address.", + "example": "https://creativecommons.org/publicdomain/zero/1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + } + }, + "badge": null, + "title": "Metadata license", + "additionalProperties": false + } + }, + "additionalProperties": false, + "title": "Meta Metadata", + "options": { + "hidden": true + } + } + }, + "additionalProperties": true +} \ No newline at end of file From a438df67e12bbbe2cac81a6b1d0900c21e065748 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 14:33:13 +0200 Subject: [PATCH 19/33] add placeholder for example & template json files (populate later using the new scripts) #143 --- metadata/v200_draft/example.json | 73 ------------ metadata/v200_draft/template.json | 186 ------------------------------ 2 files changed, 259 deletions(-) diff --git a/metadata/v200_draft/example.json b/metadata/v200_draft/example.json index 8922de4d..e69de29b 100644 --- a/metadata/v200_draft/example.json +++ b/metadata/v200_draft/example.json @@ -1,73 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/feature/draft_updated_oem_ressourse_and_datapackge/metadata/v200_draft/schema.json", - "id": "https://openenergy-platform.org/dataedit/view/example_table_name", - "name": "example_table_name", - "title": "Example Table Name", - "description": "Example description", - "language": [ - "en" - ], - "keywords": [ - "example" - ], - "publicationDate": "2023-12-04", - "context": { - "homepage": "https://example.org", - "contact": "example@example.org" - }, - "spatial": { - "extent": "Germany", - "resolution": "100m" - }, - "temporal": { - "referenceDate": "2020-01-01", - "timeseries": [ - { - "start": "2019-02-06T10:12:04+00:00", - "end": " 2019-02-07T10:12:04+00:00", - "resolution": "1h", - "aggregationType": "current" - } - ] - }, - "sources": [ - { - "title": "IPCC Fifth Assessment Report", - "path": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", - "licenses": [ - { - "name": "CC-BY-4.0" - } - ] - } - ], - "licenses": [ - { - "name": "ODbL-1.0", - "title": "Open Data Commons Open Database License 1.0", - "path": "https://opendatacommons.org/licenses/odbl/1-0/index.html", - "attribution": "© Reiner Lemoine Institut" - } - ], - "contributors": [ - { - "title": "Jon Doe", - "email": "example@example.org", - "date": "2023-03-12" - } - ], - "schema": { - "fields": [ - { - "name": "id", - "type": "integer" - } - ] - }, - "metaMetadata": { - "metadataVersion": "OEP-2.0.0-draft", - "metadataLicense": { - "name": "CC0-1.0" - } - } -} \ No newline at end of file diff --git a/metadata/v200_draft/template.json b/metadata/v200_draft/template.json index c59a7c18..e69de29b 100644 --- a/metadata/v200_draft/template.json +++ b/metadata/v200_draft/template.json @@ -1,186 +0,0 @@ -{ - "name": null, - "resources": [ - { - "name": null, - "dialect": { - "delimiter": null, - "decimalSeparator": "." - }, - "profile": null, - "path": null, - "format": null, - "encoding": null, - "schema": { - "fields": [ - { - "name": null, - "description": null, - "type": null, - "unit": null, - "isAbout": [ - { - "name": null, - "path": null - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - }, - { - "name": null, - "description": null, - "type": null, - "unit": null, - "isAbout": [ - { - "name": null, - "path": null - } - ], - "valueReference": [ - { - "value": null, - "name": null, - "path": null - } - ] - } - ], - "primaryKey": [ - null - ], - "foreignKeys": [ - { - "fields": [ - null - ], - "reference": { - "resource": null, - "fields": [ - null - ] - } - } - ] - }, - "title": null, - "id": null, - "description": null, - "language": [ - null - ], - "subject": [ - { - "name": null, - "path": null - } - ], - "keywords": [ - null - ], - "publicationDate": null, - "context": { - "homepage": null, - "documentation": null, - "sourceCode": null, - "contact": null, - "grantNo": null, - "fundingAgency": null, - "fundingAgencyLogo": null, - "publisherLogo": null - }, - "spatial": { - "location": null, - "extent": null, - "resolution": null - }, - "temporal": { - "referenceDate": null, - "timeseries": [ - { - "start": null, - "end": null, - "resolution": null, - "alignment": null, - "aggregationType": null - }, - { - "start": null, - "end": null, - "resolution": null, - "alignment": null, - "aggregationType": null - } - ] - }, - "sources": [ - { - "title": null, - "description": null, - "path": null, - "licenses": [ - { - "name": null, - "title": null, - "path": null, - "instruction": null, - "attribution": null - } - ] - }, - { - "title": null, - "description": null, - "path": null, - "licenses": [ - { - "name": null, - "title": null, - "path": null, - "instruction": null, - "attribution": null - } - ] - } - ], - "licenses": [ - { - "name": null, - "title": null, - "path": null, - "instruction": null, - "attribution": null - } - ], - "contributors": [ - { - "title": null, - "email": null, - "date": null, - "object": null, - "comment": null - } - ], - "@id": null, - "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", - "review": { - "path": null, - "badge": null - }, - "metaMetadata": { - "metadataVersion": "2.0.0", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - } - } - ] -} \ No newline at end of file From b3e04d9ec6af3b6dc8f3412ac528a8ae525d1004 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 14:34:11 +0200 Subject: [PATCH 20/33] add schema module that aggregates all fields that provide general information about a resource #143 --- .../build_source/schemas/general.json | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 metadata/v200_draft/build_source/schemas/general.json diff --git a/metadata/v200_draft/build_source/schemas/general.json b/metadata/v200_draft/build_source/schemas/general.json new file mode 100644 index 00000000..6fb49409 --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/general.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/general.json", + "type": "object", + "properties": { + "name": { + "description": "File name or database table name", + "example": "oep_metadata_table_example_v160", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", + "example": "https://example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "ID", + "readonly": true + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", + "example": "Example table used to illustrate the metadata structure and meaning.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "subject": { + "description": "Reference the topic of the resource in ontology terms", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The class label of the OEO term.", + "example": "energy", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "The URI of the class.", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "Subject", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "Subject" + }, + "language": { + "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", + "example": "[en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", + "example": "en-GB", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Language" + }, + "badge": "Gold", + "title": "Language" + }, + "keywords": { + "description": "A list of string keywords to assist users searching for the package in catalogs.", + "example": "[example, template, test]", + "type": "array", + "items": { + "description": "A keyword to assist users searching for the package in catalogs.", + "example": "template", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Keyword" + }, + "badge": "Silver", + "title": "Keywords" + }, + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", + "example": "2019-02-06", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Publication date", + "format": "date" + } + } +} \ No newline at end of file From ff31c721e09e68c59af222cdbd358f9cd77b9443 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 14:34:54 +0200 Subject: [PATCH 21/33] Add schema module that provide fields for json ld (link to the energy databus) #143 --- .../build_source/schemas/json_ld.json | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 metadata/v200_draft/build_source/schemas/json_ld.json diff --git a/metadata/v200_draft/build_source/schemas/json_ld.json b/metadata/v200_draft/build_source/schemas/json_ld.json new file mode 100644 index 00000000..e96bf47f --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/json_ld.json @@ -0,0 +1,75 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "json_ld.json#metadata/v200_draft/schemas/json_ld.json", + "type": "object", + "properties": { + "@id": { + "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", + "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@Id", + "readonly": true + }, + "@context": { + "description": "Explanation of metadata keys in ontology terms.", + "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@context" + }, + "wasGeneratedBy": { + "description": "Specific fields to establish a link to the open energy databus (dbpedia databus).", + "title": "wasGeneratedBy", + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "uri", + "description": "The unique identifier for the wasGeneratedBy object.", + "example": "todo" + }, + "@type": { + "type": "string", + "enum": [ + "moss:OEMetadataMod" + ], + "description": "The type of the wasGeneratedBy object.", + "example": "moss:OEMetadataMod" + }, + "version": { + "type": "string", + "pattern": "^OEP-[0-9]+\\.[0-9]+\\.[0-9]+$", + "description": "The version of the metadata format.", + "example": "1.0.0" + }, + "used": { + "type": "string", + "format": "uri", + "description": "A reference to the resource used.", + "example": "todo" + }, + "license": { + "type": "string", + "format": "uri", + "description": "The license under which the resource is available.", + "example": "CC0" + } + }, + "required": [ + "@id", + "@type", + "version", + "used", + "license" + ], + "additionalProperties": false + } + } +} \ No newline at end of file From b36190044a733bb905ebc1dc492f00d5a9655534 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 14:35:41 +0200 Subject: [PATCH 22/33] Add schema module that provide fields to describe a single resource (file / database table) #143 --- .../build_source/schemas/resource.json | 334 ++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 metadata/v200_draft/build_source/schemas/resource.json diff --git a/metadata/v200_draft/build_source/schemas/resource.json b/metadata/v200_draft/build_source/schemas/resource.json new file mode 100644 index 00000000..3962c0fd --- /dev/null +++ b/metadata/v200_draft/build_source/schemas/resource.json @@ -0,0 +1,334 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "general.json#metadata/v200_draft/schemas/resource.json", + "type": "object", + "properties": { + "resource": { + "title": "Resource", + "description": "The data resource format describes a data resource as an individual file or table.", + "type": "object", + "properties": { + "profile": { + "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", + "example": "tabular-data-resource", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Profile", + "options": { + "hidden": true + } + }, + "name": { + "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", + "example": "sandbox.example_table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name" + }, + "path": { + "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", + "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Path", + "options": { + "hidden": true + } + }, + "format": { + "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", + "example": "csv", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Format", + "options": { + "hidden": true + } + }, + "encoding": { + "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", + "example": "UTF-8", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Encoding", + "options": { + "hidden": true + } + }, + "schema": { + "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "type": "object", + "properties": { + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "type": "object", + "properties": { + "name": { + "description": "The name of the field. The string must be unique within it's scope", + "example": "year", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name", + "readonly": true + }, + "description": { + "description": "A text describing the field.", + "example": "Reference year for which the data were collected.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "type": { + "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", + "example": "geometry(Point, 4326)", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Type", + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "A class label of the OEO terms.", + "example": "wind energy converting unit", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "Path to the OEO class (URI)", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "isAbout", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "isAbout" + }, + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "description": "The name of the value in the column.", + "example": "onshore", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Value" + }, + "name": { + "description": "The class label of the OEO terms.", + "example": "onshore wind farm", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": " The URI of the OEO class", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "valueReference", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "valueReference" + }, + "unit": { + "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", + "example": "MW", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" + }, + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", + "example": "id", + "type": "array", + "items": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", + "example": "id", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Primary key" + }, + "badge": "Iron", + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { + "fields": { + "description": "The column (as list of items) in the table that is constrainted by the foreign key.", + "example": "version", + "type": "array", + "items": { + "description": "The column in the table that is constrainted by the foreign key.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table).", + "example": "schema.table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Resource" + }, + "fields": { + "description": "The foreign resource column.", + "example": "version", + "type": "array", + "items": { + "description": "The foreign resource column.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Field" + } + }, + "badge": "Iron", + "title": "Reference", + "additionalProperties": false + } + }, + "title": "Foreign Key", + "additionalProperties": false + }, + "badge": "Iron", + "title": "Foreign Keys" + } + }, + "title": "Schema", + "additionalProperties": false + }, + "dialect": { + "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + "type": "object", + "properties": { + "delimiter": { + "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", + "example": ",", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Delimiter" + }, + "decimalSeparator": { + "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", + "example": ".", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Decimal separator" + } + }, + "additionalProperties": false, + "title": "Dialect", + "options": { + "hidden": true + } + } + } + } + } +} \ No newline at end of file From 5818cf004e437fa1c222ed53363dc4c41589b40d Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Wed, 5 Jun 2024 18:28:54 +0200 Subject: [PATCH 23/33] add demonstrator example & schema --- metadata/v200_draft/demo_gen_example.json | 141 +++ metadata/v200_draft/demo_gen_schema.json | 1108 +++++++++++++++++++++ 2 files changed, 1249 insertions(+) create mode 100644 metadata/v200_draft/demo_gen_example.json create mode 100644 metadata/v200_draft/demo_gen_schema.json diff --git a/metadata/v200_draft/demo_gen_example.json b/metadata/v200_draft/demo_gen_example.json new file mode 100644 index 00000000..ee1a8aea --- /dev/null +++ b/metadata/v200_draft/demo_gen_example.json @@ -0,0 +1,141 @@ +{ + "name": "my_oep_collection", + "title": "RLI - OEMetadata - Metadata example table", + "collectionId": "https://todo", + "resources": [ + { + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "wasGeneratedBy": { + "@id": "todo", + "@type": "moss:OEMetadataMod", + "version": "1.0.0", + "used": "todo", + "license": "CC0" + }, + "name": "oep_metadata_table_example_v160", + "title": "RLI - OEMetadata - Metadata example table", + "id": "https://example.com", + "description": "Example table used to illustrate the metadata structure and meaning.", + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + } + ], + "language": "[en-GB, de-DE, fr-FR]", + "keywords": "[example, template, test]", + "publicationDate": "2019-02-06", + "context": { + "homepage": "https://openenergy-platform.org/", + "documentation": "https://openenergy-platform.org/about/", + "sourceCode": "https://github.com/OpenEnergyPlatform", + "contact": "contact@example.com", + "grantNo": "01AB2345", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": "52.433509, 13.535855", + "extent": "Europe", + "resolution": "3 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2019-02-06T10:12:04+00:00", + "end": "2019-02-07T10:12:04+00:00", + "resolution": " 30 s", + "alignment": "left", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "IPCC Fifth Assessment Report", + "description": "Scientific climate change report by the UN", + "path": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "instruction": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "attribution": "© Intergovernmental Panel on Climate Change 2014" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "instruction": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "attribution": "© Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "John Doe", + "email": "contact@example.com", + "date": "2016-06-16", + "object": "data and metadata", + "comment": "Fix typo in the title." + } + ], + "resource": { + "profile": "tabular-data-resource", + "name": "sandbox.example_table", + "path": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "format": "csv", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "year", + "description": "Reference year for which the data were collected.", + "type": "geometry(Point, 4326)", + "isAbout": [ + { + "name": "wind energy converting unit", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000044" + } + ], + "valueReference": [ + { + "value": "onshore", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + } + ], + "unit": "MW" + } + ], + "primaryKey": "id", + "foreignKeys": [ + { + "fields": "version", + "reference": { + "resource": "schema.table", + "fields": "version" + } + } + ] + }, + "dialect": { + "delimiter": ",", + "decimalSeparator": "." + }, + "review": { + "path": "https://www.example.com", + "badge": "Platinum" + } + } + } + ], + "additionalProperties": {} +} \ No newline at end of file diff --git a/metadata/v200_draft/demo_gen_schema.json b/metadata/v200_draft/demo_gen_schema.json new file mode 100644 index 00000000..287edad4 --- /dev/null +++ b/metadata/v200_draft/demo_gen_schema.json @@ -0,0 +1,1108 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/oemetadata/latest/schema.json", + "description": "Open Energy Plaftorm (OEP) metadata schema latest", + "type": "object", + "properties": { + "name": { + "description": "Collection name", + "example": "my_oep_collection", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Collection name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "collectionId": { + "description": "A Uniform Resource Identifier (URI) that links the resource collection.", + "example": "https://todo", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Collection identifier", + "readonly": true + }, + "resources": { + "description": "A collection of related data resource descriptions and metadata. This may include relational data models which are technically related", + "type": "array", + "items": { + "type": "object", + "properties": { + "@id": { + "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", + "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@Id", + "readonly": true + }, + "@context": { + "description": "Explanation of metadata keys in ontology terms.", + "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@context" + }, + "wasGeneratedBy": { + "description": "Specific fields to establish a link to the open energy databus (dbpedia databus).", + "title": "wasGeneratedBy", + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "uri", + "description": "The unique identifier for the wasGeneratedBy object.", + "example": "todo" + }, + "@type": { + "type": "string", + "enum": [ + "moss:OEMetadataMod" + ], + "description": "The type of the wasGeneratedBy object.", + "example": "moss:OEMetadataMod" + }, + "version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$", + "description": "The version of the metadata format.", + "example": "1.0.0" + }, + "used": { + "type": "string", + "format": "uri", + "description": "A reference to the resource used.", + "example": "todo" + }, + "license": { + "type": "string", + "format": "uri", + "description": "The license under which the resource is available.", + "example": "CC0" + } + } + }, + "name": { + "description": "File name or database table name", + "example": "oep_metadata_table_example_v160", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", + "example": "https://example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "ID", + "readonly": true + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", + "example": "Example table used to illustrate the metadata structure and meaning.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "subject": { + "description": "Reference the topic of the resource in ontology terms", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The class label of the OEO term.", + "example": "energy", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "The URI of the class.", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "Subject", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "Subject" + }, + "language": { + "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", + "example": "[en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", + "example": "en-GB", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Language" + }, + "badge": "Gold", + "title": "Language" + }, + "keywords": { + "description": "A list of string keywords to assist users searching for the package in catalogs.", + "example": "[example, template, test]", + "type": "array", + "items": { + "description": "A keyword to assist users searching for the package in catalogs.", + "example": "template", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Keyword" + }, + "badge": "Silver", + "title": "Keywords" + }, + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", + "example": "2019-02-06", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Publication date", + "format": "date" + }, + "context": { + "description": "An Object that describes the general setting, environment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project.", + "example": "https://openenergy-platform.org/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "A URL of the project's documentation.", + "example": "https://openenergy-platform.org/about/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Documentation" + }, + "sourceCode": { + "description": "A URL of the projects source code.", + "example": "https://github.com/OpenEnergyPlatform", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Source Code" + }, + "contact": { + "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "E-Mail Contact", + "format": "email" + }, + "grantNo": { + "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", + "example": "01AB2345", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded project this is the funding agency, which can be a governmental or a company.", + "example": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "A URL to the logo or image of the funding agency.", + "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "A URL to the logo of the agency publishing the data.", + "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Publisher logo", + "format": "uri" + } + }, + "badge": "Gold", + "title": "Context", + "additionalProperties": false + }, + "spatial": { + "description": "An object that describes the spatial context of the data it contains.", + "type": "object", + "properties": { + "location": { + "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", + "example": "52.433509, 13.535855", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Location" + }, + "extent": { + "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", + "example": "Europe", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", + "example": "3 m", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + } + }, + "badge": "Silver", + "title": "Spatial", + "additionalProperties": false + }, + "temporal": { + "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", + "example": "2016-01-01", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", + "type": "array", + "items": { + "type": "object", + "properties": { + "start": { + "description": "The beginning point in time of a time series.", + "example": "2019-02-06T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Start", + "format": "date-time" + }, + "end": { + "description": "The end point in time of a time series.", + "example": "2019-02-07T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "End", + "format": "date-time" + }, + "resolution": { + "description": "The time span between individual points of information in a time series.", + "example": " 30 s", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + }, + "alignment": { + "description": "An indicator whether stamps in a time series are left, right or middle.", + "example": "left", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Alignment" + }, + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current.", + "example": "sum", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Aggregation type" + } + }, + "badge": "Silver", + "title": "Timeseries", + "additionalProperties": false + }, + "badge": "Silver", + "title": "Timeseries" + } + }, + "badge": "Silver", + "title": "Temporal", + "additionalProperties": false + }, + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "A human readable title of the source, a document title or organisation name.", + "example": "IPCC Fifth Assessment Report", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "description": { + "description": "A free text description of the data set.", + "example": "Scientific climate change report by the UN", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Description" + }, + "path": { + "description": "A URL to the original source.", + "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path", + "format": "uri" + }, + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "THe SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A link to the license text.", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", + "example": "\u00a9 Intergovernmental Panel on Climate Change 2014", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses" + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "badge": "Bronze", + "title": "Sources", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Sources" + }, + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "The SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", + "example": "\u00a9 Reiner Lemoine Institut", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Licenses" + }, + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization).", + "example": "John Doe", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", + "example": "2016-06-16", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed.", + "example": "data and metadata", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Object" + }, + "comment": { + "description": "Free text comment on what has been done.", + "example": "Fix typo in the title.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Comment" + } + }, + "badge": "Bronze", + "title": "Contributors", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Contributors" + }, + "resource": { + "description": "Describes the resource definition of the data. For example a CSV file or sql table definition.", + "type": "object", + "properties": { + "profile": { + "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", + "example": "tabular-data-resource", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Profile", + "options": { + "hidden": true + } + }, + "name": { + "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", + "example": "sandbox.example_table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name" + }, + "path": { + "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", + "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Path", + "options": { + "hidden": true + } + }, + "format": { + "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", + "example": "csv", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Format", + "options": { + "hidden": true + } + }, + "encoding": { + "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", + "example": "UTF-8", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Encoding", + "options": { + "hidden": true + } + }, + "schema": { + "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "type": "object", + "properties": { + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "type": "object", + "properties": { + "name": { + "description": "The name of the field. The string must be unique within it's scope", + "example": "year", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name", + "readonly": true + }, + "description": { + "description": "A text describing the field.", + "example": "Reference year for which the data were collected.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "type": { + "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", + "example": "geometry(Point, 4326)", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Type", + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "A class label of the OEO terms.", + "example": "wind energy converting unit", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "Path to the OEO class (URI)", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "isAbout", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "isAbout" + }, + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "description": "The name of the value in the column.", + "example": "onshore", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Value" + }, + "name": { + "description": "The class label of the OEO terms.", + "example": "onshore wind farm", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": " The URI of the OEO class", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "valueReference", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "valueReference" + }, + "unit": { + "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", + "example": "MW", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" + }, + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", + "example": "id", + "type": "array", + "items": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", + "example": "id", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Primary key" + }, + "badge": "Iron", + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { + "fields": { + "description": "The column (as list of items) in the table that is constrainted by the foreign key.", + "example": "version", + "type": "array", + "items": { + "description": "The column in the table that is constrainted by the foreign key.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table).", + "example": "schema.table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Resource" + }, + "fields": { + "description": "The foreign resource column.", + "example": "version", + "type": "array", + "items": { + "description": "The foreign resource column.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Field" + } + }, + "badge": "Iron", + "title": "Reference", + "additionalProperties": false + } + }, + "title": "Foreign Key", + "additionalProperties": false + }, + "badge": "Iron", + "title": "Foreign Keys" + } + }, + "title": "Schema", + "additionalProperties": false + }, + "dialect": { + "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + "type": "object", + "properties": { + "delimiter": { + "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", + "example": ",", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Delimiter" + }, + "decimalSeparator": { + "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", + "example": ".", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Decimal separator" + } + }, + "additionalProperties": false, + "title": "Dialect", + "options": { + "hidden": true + } + }, + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", + "type": "object", + "properties": { + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", + "example": "https://www.example.com", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + }, + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", + "example": "Platinum", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Badge" + } + }, + "additionalProperties": false, + "title": "Review", + "options": { + "hidden": true + } + } + } + } + }, + "title": "Resources" + }, + "metaMetadata": { + "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you\u2019re filling out your metadata.", + "type": "object", + "properties": { + "metadataVersion": { + "description": "Type and version number of the metadata.", + "example": "OEM-2.0.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Metadata version" + }, + "metadataLicense": { + "description": "Object describing the license of the provided metadata.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier", + "example": "CC0-1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Name" + }, + "title": { + "description": "Official (human readable) license title.", + "example": "Creative Commons Zero v1.0 Universal", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Title" + }, + "path": { + "description": "Url or path string, that is a fully qualified HTTP address.", + "example": "https://creativecommons.org/publicdomain/zero/1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + } + }, + "badge": null, + "title": "Metadata license", + "additionalProperties": false + } + }, + "additionalProperties": false, + "title": "Meta Metadata", + "options": { + "hidden": true + } + } + }, + "additionalProperties": true + } +} \ No newline at end of file From 6fda5f7c19eba4b59468fff901419699d48cda02 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 18 Jun 2024 13:25:08 +0200 Subject: [PATCH 24/33] update example for v2.0.0 #138 - add new trace field for traceability --- metadata/v200_draft/demo_gen_example.json | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/metadata/v200_draft/demo_gen_example.json b/metadata/v200_draft/demo_gen_example.json index ee1a8aea..4cf3fe39 100644 --- a/metadata/v200_draft/demo_gen_example.json +++ b/metadata/v200_draft/demo_gen_example.json @@ -78,15 +78,19 @@ "attribution": "© Reiner Lemoine Institut" } ], - "contributors": [ - { - "title": "John Doe", - "email": "contact@example.com", - "date": "2016-06-16", - "object": "data and metadata", - "comment": "Fix typo in the title." - } - ], + "trace": { + "contributors": [ + { + "title": "John Doe", + "email": "contact@example.com", + "date": "2016-06-16", + "object": "data and metadata", + "comment": "Fix typo in the title." + } + ], + "wasGeneratedBy": "", + "": "" + }, "resource": { "profile": "tabular-data-resource", "name": "sandbox.example_table", From 867ef9d2d13399896953702c05117e59eed369dd Mon Sep 17 00:00:00 2001 From: christian-rli Date: Tue, 18 Jun 2024 16:38:22 +0200 Subject: [PATCH 25/33] Add keys under 'trace' #138 --- metadata/v200_draft/demo_gen_example.json | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/metadata/v200_draft/demo_gen_example.json b/metadata/v200_draft/demo_gen_example.json index 4cf3fe39..2296ce94 100644 --- a/metadata/v200_draft/demo_gen_example.json +++ b/metadata/v200_draft/demo_gen_example.json @@ -79,6 +79,22 @@ } ], "trace": { + "alternateOf": "", + "checksum": "", + "dateModified": "", + "digtalObjectLocationAccessProtocol": "", + "digitalObjectType": "", + "hadPrimarySource": "", + "hasMetadata": "", + "isMetadataFor": "", + "policy": "", + "provenanceGraph": "", + "specializationOf": "", + "version": "", + "wasDerivedFrom": "", + "wasGeneratedBy": "", + "wasRevisionOf": "", + "wasQuotedFrom": "", "contributors": [ { "title": "John Doe", @@ -87,9 +103,7 @@ "object": "data and metadata", "comment": "Fix typo in the title." } - ], - "wasGeneratedBy": "", - "": "" + ] }, "resource": { "profile": "tabular-data-resource", @@ -142,4 +156,4 @@ } ], "additionalProperties": {} -} \ No newline at end of file +} From 99732edd8df7fe1a702b0ee4380a3bae4f109898 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 17:27:22 +0200 Subject: [PATCH 26/33] add tooling to generate schema & example json files (example generation is not fully functional) --- .../build_source/scripts/create_example.py | 4 +- .../generate_example_from_schema copy.py | 125 ++++++++++++++++++ .../scripts/generate_example_from_schema.py | 2 +- .../scripts/resolve_schema_refs.py | 28 +++- 4 files changed, 156 insertions(+), 3 deletions(-) rename metadata/{v200_draft => latest}/build_source/scripts/create_example.py (94%) create mode 100644 metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py diff --git a/metadata/v200_draft/build_source/scripts/create_example.py b/metadata/latest/build_source/scripts/create_example.py similarity index 94% rename from metadata/v200_draft/build_source/scripts/create_example.py rename to metadata/latest/build_source/scripts/create_example.py index b0f6c5c8..180826fb 100644 --- a/metadata/v200_draft/build_source/scripts/create_example.py +++ b/metadata/latest/build_source/scripts/create_example.py @@ -28,6 +28,8 @@ def generate_example(schema: dict) -> dict: dict: example object """ + schema = schema + if schema.get("const"): return schema["const"] if schema.get("examples"): @@ -55,4 +57,4 @@ def generate_example(schema: dict) -> dict: if __name__ == "__main__": pwd = dirname(__file__) - main(pwd + "/schema.json", pwd + "/example.json") + main(pwd + "/demo_gen_schema.json", pwd + "/example.json") diff --git a/metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py b/metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py new file mode 100644 index 00000000..aba14068 --- /dev/null +++ b/metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Title: create example from json schema +Description: Create example from json schema. +Author: jh-RLI +Email: jonas.huber@rl-institut.de +Date: 2024-05-30 +Version: 1.0.0 +""" + +# Standard Library Imports +# import os +from os.path import dirname + +import sys +import json +import logging + +from typing import Any, Dict, Union, List + +# from datetime import datetime +from pathlib import Path + +from jsonschema import validate, ValidationError + +# Configuration +LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +logger = logging.getLogger(__name__) + +# Constants +BASE_PATH = Path("metadata/") +VERSION = "v200_draft" +VERSION_PATH = BASE_PATH / VERSION +SCHEMA_BUILD_PATH = VERSION_PATH / "build_source" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "schema_structure.json" +SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "schema.json" +EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" +EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" + + +def read_schema(filename: str) -> Dict[str, Any]: + """Read a JSON schema from a file. + + Args: + filename (str): The path to the JSON schema file. + + Returns: + Dict[str, Any]: The JSON schema as a dictionary. + """ + pwd = dirname(__file__) + with open(pwd + filename, "r", encoding="utf-8") as file: + schema = json.load(file) + return schema + + +def generate_example( + schema: Dict[str, Any] +) -> Union[Dict[str, Any], List[Any], str, None]: + """Generate a JSON object from the schema using the example values provided. + + Args: + schema (Dict[str, Any]): The JSON schema. + + Returns: + Union[Dict[str, Any], List[Any], str, None]: A JSON object generated from the schema. + """ + if "example" in schema: + return schema["example"] + + schema_type = schema.get("type", None) + if isinstance(schema_type, list): + schema_type = schema_type[0] + + if schema_type == "object": + example_object = {} + properties = schema.get("properties", {}) + for key, value in properties.items(): + example_object[key] = generate_example(value) + return example_object + + elif schema_type == "array": + items = schema.get("items", {}) + return [generate_example(items)] + + elif schema_type == "string": + return "" + + elif schema_type == "null": + return None + + return None + + +def generate_json_from_schema(schema_file: str) -> Dict[str, Any]: + """Generate a JSON object that conforms to the schema read from a file. + + Args: + schema_file (str): The path to the JSON schema file. + + Returns: + Dict[str, Any]: A JSON object generated from the schema. + """ + schema = read_schema(schema_file) + return generate_example(schema) + + +def save_json(data: Dict[str, Any], filename: str) -> None: + """Save the given data as a JSON file. + + Args: + data (Dict[str, Any]): The JSON data to be saved. + filename (str): The filename where the JSON data will be saved. + """ + with open(filename, "w", encoding="utf-8") as file: + json.dump(data, file, ensure_ascii=False, indent=4) + + +if __name__ == "__main__": + schema_filename = "/res_schema.json" + json_data = generate_json_from_schema(schema_filename) + save_json(json_data, "oep_metadata.json") diff --git a/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py b/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py index 9ec794d2..9708cae0 100644 --- a/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py +++ b/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py @@ -35,7 +35,7 @@ SCHEMA_BUILD_PATH = VERSION_PATH / "build_source" MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "schema_structure.json" SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" -RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "res_schema.json" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "schema.json" EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" diff --git a/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py b/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py index 0b5e86a9..5d1631d0 100644 --- a/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py +++ b/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py @@ -137,13 +137,39 @@ def resolve_top_level_properties(schema, registry, base_uri): resolved_properties[prop] = resolved_value else: resolved_value = resolve_references(value, registry, base_uri) - resolved_properties[prop] = resolved_value + for i, v in resolved_value.items(): + if isinstance(v, dict) and i != "items": + resolved_properties[i] = v + + elif prop == "resources": + resolved_value = resolve_references(value, registry, base_uri) + resources = {} + for _k, _v in resolved_value["items"].items(): + resources.update(_v) + resolved_properties[prop] = resources + + else: + resolved_properties[prop] = resolved_value return resolved_properties schema["properties"] = resolve_top_level_properties(schema, registry, base_uri) return schema +# if isinstance(value, dict) and "properties" in value: +# resolved_value = resolve_references( +# value["properties"], registry, base_uri +# ) +# resolved_properties[prop] = resolved_value +# elif prop == "resources": +# resolved_value = resolve_references(value, registry, base_uri) +# for k,v in resolved_value["items"].items(): +# resolved_properties.update(v) + + +# else: +# resolved_value = resolve_references(value, registry, base_uri) +# resolved_properties[prop] = resolved_value # Validate the schema def validate_schema(resolved_schema, expected_schema): validator = Draft7Validator(expected_schema) From d56f399a73ec918223a30a50f8752e160aff7360 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 17:27:51 +0200 Subject: [PATCH 27/33] provide generated schema.json --- metadata/v200_draft/schema.json | 1729 +++++++++++++++++++------------ 1 file changed, 1054 insertions(+), 675 deletions(-) diff --git a/metadata/v200_draft/schema.json b/metadata/v200_draft/schema.json index 158b3600..fd7d650e 100644 --- a/metadata/v200_draft/schema.json +++ b/metadata/v200_draft/schema.json @@ -1,730 +1,1109 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/feature/draft_updated_oem_ressourse_and_datapackge/metadata/v200_draft/schema.json", - "description": "Open Energy Plaftorm (OEP) metadata schema v2.0.0-draft", - "type": "object", - "properties": { - "$schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/master/oemetadata/latest/schema.json", + "description": "Open Energy Plaftorm (OEP) metadata schema latest", + "type": "object", + "properties": { + "name": { + "description": "Collection name", + "example": "my_oep_collection", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Collection name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "collectionId": { + "description": "A Uniform Resource Identifier (URI) that links the resource collection.", + "example": "https://todo", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Collection identifier", + "readonly": true + }, + "resources": { + "@id": { + "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", + "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@Id", + "readonly": true + }, + "@context": { + "description": "Explanation of metadata keys in ontology terms.", + "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "@context" + }, + "wasGeneratedBy": { + "description": "Specific fields to establish a link to the open energy databus (dbpedia databus).", + "title": "wasGeneratedBy", + "type": "object", + "properties": { + "@id": { "type": "string", "format": "uri", - "const": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/feature/draft_updated_oem_ressourse_and_datapackge/metadata/v200_draft/schema.json", - "readonly": true - }, - "@context": { - "description": "Explanation of metadata keys in ontology terms. Example: https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "description": "The unique identifier for the wasGeneratedBy object.", + "example": "todo" + }, + "@type": { "type": "string", - "title": "@context" - }, - "@id": { - "description": "Uniform Resource Identifier (URI) that links the resource via the databus", + "enum": [ + "moss:OEMetadataMod" + ], + "description": "The type of the wasGeneratedBy object.", + "example": "moss:OEMetadataMod" + }, + "version": { "type": "string", - "title": "@Id", - "readonly": true - }, - "id": { - "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI). Example: https://example.com", + "pattern": "^OEP-[0-9]+\\.[0-9]+\\.[0-9]+$", + "description": "The version of the metadata format.", + "example": "1.0.0" + }, + "used": { "type": "string", - "title": "Id", - "readonly": true, - "examples": [ - "https://openenergy-platform.org/dataedit/view/example_table_name" - ] - }, - "name": { - "description": "File name or database table name. Example: oep_metadata_table_example_v15", + "format": "uri", + "description": "A reference to the resource used.", + "example": "todo" + }, + "license": { "type": "string", - "title": "Name", - "maxLength": 50, - "pattern": "[a-z][a-z_0-9]*", - "examples": [ - "example_table_name" - ] + "format": "uri", + "description": "The license under which the resource is available.", + "example": "CC0" + } }, - "title": { - "description": "Human readable title. Example: Metadata Example Table", - "type": "string", - "title": "Title", - "examples": [ - "Example Table Name" - ] + "required": [ + "@id", + "@type", + "version", + "used", + "license" + ], + "additionalProperties": false + }, + "name": { + "description": "File name or database table name", + "example": "oep_metadata_table_example_v160", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Name" + }, + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Title" + }, + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", + "example": "https://example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "ID", + "readonly": true + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", + "example": "Example table used to illustrate the metadata structure and meaning.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "subject": { + "description": "Reference the topic of the resource in ontology terms", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The class label of the OEO term.", + "example": "energy", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "The URI of the class.", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "Subject", + "additionalProperties": false }, - "description": { - "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata. Example: Example table used to illustrate the metadata structure and meaning", - "type": "string", - "title": "Description", - "examples": [ - "Example description" - ] + "badge": "Platinum", + "title": "Subject" + }, + "language": { + "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", + "example": "[en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", + "example": "en-GB", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Language" }, - "subject": { - "description": "Reference the topic of the resource in ontology terms", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "description": "Name of the OEO Class", - "type": "string", - "title": "Name" - }, - "path": { - "description": "Path to the OEO (URL)", - "type": "string", - "title": "Path", - "format": "uri" - } - }, - "additionalProperties": false, - "title": "Subject" - }, - "title": "Subject" + "badge": "Gold", + "title": "Language" + }, + "keywords": { + "description": "A list of string keywords to assist users searching for the package in catalogs.", + "example": "[example, template, test]", + "type": "array", + "items": { + "description": "A keyword to assist users searching for the package in catalogs.", + "example": "template", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Keyword" }, - "language": { - "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47). Example: [en-GB, de-DE, fr-FR]", - "type": "array", - "items": { - "type": "string", - "examples": [ - "en", - "en-US", - "de", - "de-DE", - "fr", - "fr-FR" - ], - "title": "Language" - }, - "title": "Language" + "badge": "Silver", + "title": "Keywords" + }, + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", + "example": "2019-02-06", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Publication date", + "format": "date" + }, + "context": { + "description": "An Object that describes the general setting, environment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project.", + "example": "https://openenergy-platform.org/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "A URL of the project's documentation.", + "example": "https://openenergy-platform.org/about/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Documentation" + }, + "sourceCode": { + "description": "A URL of the projects source code.", + "example": "https://github.com/OpenEnergyPlatform", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Source Code" + }, + "contact": { + "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "E-Mail Contact", + "format": "email" + }, + "grantNo": { + "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", + "example": "01AB2345", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded project this is the funding agency, which can be a governmental or a company.", + "example": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "A URL to the logo or image of the funding agency.", + "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "A URL to the logo of the agency publishing the data.", + "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Publisher logo", + "format": "uri" + } }, - "keywords": { - "description": "An array of string keywords to assist users searching for the package in catalogs. Example: [example, template, test]", + "badge": "Gold", + "title": "Context", + "additionalProperties": false + }, + "spatial": { + "description": "An object that describes the spatial context of the data it contains.", + "type": "object", + "properties": { + "location": { + "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", + "example": "52.433509, 13.535855", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Location" + }, + "extent": { + "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", + "example": "Europe", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", + "example": "3 m", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + } + }, + "badge": "Silver", + "title": "Spatial", + "additionalProperties": false + }, + "temporal": { + "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", + "example": "2016-01-01", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", "type": "array", "items": { - "type": "string", - "maxLength": 40, - "title": "Keyword", - "examples": [ - "example" - ] - }, - "title": "Keyword" - }, - "publicationDate": { - "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD). Example: 2019-02-06", - "type": "string", - "title": "Publication date", - "format": "date", - "examples": [ - "2023-12-04" - ] - }, - "context": { - "description": "Object. Contains name-value-pairs that describe the general setting, evironment or project leading to the creation or maintenance of this dataset.", - "type": "object", - "properties": { - "homepage": { - "description": "URL of project. Example: https://openenergy-platform.org/", - "type": "string", - "title": "Homepage", - "format": "uri", - "examples": [ - "https://example.org" - ] - }, - "documentation": { - "description": "URL of project documentation. Example: https://github.com/OpenEnergyPlatform/metadata/wiki/Metadata-Description", - "type": "string", - "title": "Documentation" - }, - "sourceCode": { - "description": "Url of project source code. Example: https://github.com/OpenEnergyPlatform", - "type": "string", - "title": "Source code" - }, - "contact": { - "description": "Reference to the creator or maintainer of the data set. Example: contact@example.com", - "type": "string", - "title": "E-Mail contact", - "format": "email", - "examples": [ - "example@example.org" - ] + "type": "object", + "properties": { + "start": { + "description": "The beginning point in time of a time series.", + "example": "2019-02-06T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Start", + "format": "date-time" }, - "grantNo": { - "description": "In a publicly funded Project: the identifying grant number. Example: 01AB2345", - "type": "string", - "title": "Grant no" + "end": { + "description": "The end point in time of a time series.", + "example": "2019-02-07T10:12:04+00:00", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "End", + "format": "date-time" }, - "fundingAgency": { - "description": "In a funded Project: The name of the funding agency. Example: Bundesministerium für Wirtschaft und Energie", - "type": "string", - "title": "Funding agency" + "resolution": { + "description": "The time span between individual points of information in a time series.", + "example": " 30 s", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" }, - "fundingAgencyLogo": { - "description": "In a publicly funded Project: A link to the Logo of the funding agency. Example: https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=poster&v=2", - "type": "string", - "title": "Funding agency logo", - "format": "uri" + "alignment": { + "description": "An indicator whether stamps in a time series are left, right or middle.", + "example": "left", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Alignment" }, - "publisherLogo": { - "description": "Link to the logo of the publishing institution. Example: https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", - "type": "string", - "title": "Publisher logo", - "format": "uri" + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current.", + "example": "sum", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Aggregation type" } + }, + "badge": "Silver", + "title": "Timeseries", + "additionalProperties": false }, - "additionalProperties": false, - "title": "Context" + "badge": "Silver", + "title": "Timeseries" + } }, - "spatial": { - "description": "Object. Contains name-value-pairs describing the spatial context of the contained data.", - "type": "object", - "properties": { - "location": { - "description": "In the case of data where the location can be described as a point. May come as coordinates, URI or addresses with street, house number and zip code. Example: 52.433509, 13.535855", - "type": "string", - "title": "Location" - }, - "extent": { - "description": "Covered area. May be the name of a region, or the geometry of a bounding box. Example: Europe", - "type": "string", - "title": "Extent", - "examples": [ - "Germany", - "Europe" - ] - }, - "resolution": { - "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size. Example: 30m", - "type": "string", - "title": "Resolution", - "examples": [ - "100m", - "NUTS-2" - ] - } + "badge": "Silver", + "title": "Temporal", + "additionalProperties": false + }, + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "A human readable title of the source, a document title or organisation name.", + "example": "IPCC Fifth Assessment Report", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" }, - "additionalProperties": false, - "title": "Spatial" - }, - "temporal": { - "description": "Temporal object. Time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", - "type": "object", - "properties": { - "referenceDate": { - "description": "Base year, month or day. Point in time for which the data is meant to be accurate. A census will generally have a reference year. A satellite image will have a reference date. Date Format is ISO 8601. Example: 2016-01-01", - "type": "string", - "title": "Reference date", - "format": "date", - "examples": [ - "2020-01-01" - ] - }, - "timeseries": { - "description": "Times series object in temporal object, contains start, end, resolution, alignment and aggregation type properties.", - "type": "array", - "items": { - "type": "object", - "properties": { - "start": { - "description": "The beginning point in time of a time series. Example: 2019-02-06T10:12:04+00:00", - "type": "string", - "title": "Start", - "format": "date-time", - "examples": [ - "2019-02-06T10:12:04+00:00" - ] - }, - "end": { - "description": "The end point in time of a time series. Example: 2019-02-07T10:12:04+00:00", - "type": "string", - "title": "End", - "format": "date-time", - "examples": [ - " 2019-02-07T10:12:04+00:00" - ] - }, - "resolution": { - "description": "The time span between individual points of information in a time series. Example: 30s", - "type": "string", - "title": "Resolution", - "examples": [ - "1h" - ] - }, - "alignment": { - "description": "Indicator whether stamps in a time series are left, right or middle. Example: left", - "type": "string", - "title": "Alignment", - "enum": [ - "left", - "right", - "middle" - ] - }, - "aggregationType": { - "description": "Indicates whether the values are a sum, average or current. Example: sum", - "type": "string", - "title": "Aggregation type", - "examples": [ - "current", - "sum", - "average" - ] - } - }, - "additionalProperties": false, - "title": "Timeseries" - }, - "title": "Timeseries" - } + "description": { + "description": "A free text description of the data set.", + "example": "Scientific climate change report by the UN", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Description" }, - "additionalProperties": false, - "title": "Temporal" - }, - "sources": { - "description": "List of source objects. Each object has all name-value-pairs.", - "type": "array", - "items": { - "description": "Source object in list of source objects. Each object has all name-value-pairs.", - "type": "object", - "properties": { - "title": { - "description": "Human readable title of the source, e.g. document title or organisation name. Example: IPCC Fifth Assessment Report", - "type": "string", - "title": "Title", - "examples": [ - "IPCC Fifth Assessment Report" - ] - }, - "description": { - "description": "Free text description of the data set. Example: Scientific climate change report by the UN", - "type": "string", - "title": "Description" - }, - "path": { - "description": "URL to original source. Example: https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", - "type": "string", - "title": "Path", - "format": "uri", - "examples": [ - "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf" - ] - }, - "licenses": { - "description": "The license(s) under which the source(s) is/are provided. List of objects.", - "type": "array", - "items": { - "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", - "type": "object", - "properties": { - "name": { - "description": "SPDX identifier: Example: ODbL-1.0", - "type": "string", - "title": "Name", - "examples": [ - "CC-BY-4.0" - ] - }, - "title": { - "description": "Official (human readable) title. Example: Open Data Commons Open Database License 1.0", - "type": "string", - "title": "Title" - }, - "path": { - "description": "A link to the license. Example: https://opendatacommons.org/licenses/odbl/1-0/index.html", - "type": "string", - "title": "Path" - }, - "instruction": { - "description": "Short description of rights and restrictions. Example: You are free to share and change, but you must attribute, and share derivations under the same license.", - "type": "string", - "title": "Instruction" - }, - "attribution": { - "description": "Copyrightholder of the source. Example: © Intergovernmental Panel on Climate Change 2014", - "type": "string", - "title": "Attribution" - } - }, - "title": "Licenses" - }, - "title": "Licenses" - } - }, - "additionalProperties": false, - "title": "Sources" + "path": { + "description": "A URL to the original source.", + "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path", + "format": "uri" }, - "title": "Sources" - }, - "licenses": { - "description": "The license(s) under which the described package is provided. List of objects.", - "type": "array", - "items": { - "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", "type": "object", "properties": { - "name": { - "description": "SPDX identifier. Example: ODbL-1.0", - "type": "string", - "title": "Name", - "examples": [ - "ODbL-1.0" - ] - }, - "title": { - "description": "Official (human readable) title. Example: Open Data Commons Open Database License 1.0", - "type": "string", - "title": "Title", - "examples": [ - "Open Data Commons Open Database License 1.0" - ] - }, - "path": { - "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details). Example: https://opendatacommons.org/licenses/odbl/1-0/index.html", - "type": "string", - "title": "Path", - "examples": [ - "https://opendatacommons.org/licenses/odbl/1-0/index.html" - ] - }, - "instruction": { - "description": "Short description of rights and restrictions. Example: You are free to share and change, but you must attribute, and share derivations under the same license.", - "type": "string", - "title": "Instruction" - }, - "attribution": { - "description": "Copyrightholder of the produced data set. Example: © Reiner Lemoine Institut", - "type": "string", - "title": "Attribution", - "examples": [ - "© Reiner Lemoine Institut" - ] - } + "name": { + "description": "THe SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A link to the license text.", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", + "example": "\u00a9 Intergovernmental Panel on Climate Change 2014", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } }, - "additionalProperties": false, + "badge": "Bronze", "title": "Licenses" + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "badge": "Bronze", + "title": "Sources", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Sources" + }, + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "The SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" }, - "title": "Licenses" + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", + "example": "\u00a9 Reiner Lemoine Institut", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses", + "additionalProperties": false }, - "contributors": { - "description": "The people or organizations who contributed to this data package. List of objects.", - "type": "array", - "items": { - "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", - "type": "object", - "properties": { - "title": { - "description": "Name/title of the contributor (name for a person, name or title for an organization). Example: Jon Doe", - "type": "string", - "title": "Title", - "examples": [ - "Jon Doe" - ] - }, - "email": { - "description": "E-mail address of the contributor. Example: contact@example.com", - "type": "string", - "title": "Email", - "format": "email", - "examples": [ - "example@example.org" - ] - }, - "date": { - "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601. Example: 2016-06-16", - "type": "string", - "title": "Date", - "format": "date", - "examples": [ - "2023-03-12" - ] - }, - "object": { - "description": "Target of contribution. Which part of the package was supplied/changed. Example: Metadata", - "type": "string", - "title": "Object" - }, - "comment": { - "description": "Free text comment on what's been done. Example: Fixed a typo in the title", - "type": "string", - "title": "Comment" - } - }, - "additionalProperties": false, - "title": "Contributors" + "badge": "Bronze", + "title": "Licenses" + }, + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization).", + "example": "John Doe", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", + "example": "2016-06-16", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed.", + "example": "data and metadata", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Object" }, - "title": "Contributors" + "comment": { + "description": "Free text comment on what has been done.", + "example": "Fix typo in the title.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Comment" + } + }, + "badge": "Bronze", + "title": "Contributors", + "additionalProperties": false }, - "schema": { + "badge": "Bronze", + "title": "Contributors" + }, + "resource": { + "title": "Resource", + "description": "The data resource format describes a data resource as an individual file or table.", + "type": "object", + "properties": { + "profile": { + "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", + "example": "tabular-data-resource", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Profile", + "options": { + "hidden": true + } + }, + "name": { + "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", + "example": "sandbox.example_table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name" + }, + "path": { + "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", + "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Path", + "options": { + "hidden": true + } + }, + "format": { + "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", + "example": "csv", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Format", + "options": { + "hidden": true + } + }, + "encoding": { + "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", + "example": "UTF-8", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Encoding", + "options": { + "hidden": true + } + }, + "schema": { "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", "type": "object", "properties": { - "fields": { - "description": "List of field objects.", - "type": "array", - "items": { - "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", + "type": "object", + "properties": { + "name": { + "description": "The name of the field. The string must be unique within it's scope", + "example": "year", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name", + "readonly": true + }, + "description": { + "description": "A text describing the field.", + "example": "Reference year for which the data were collected.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "type": { + "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", + "example": "geometry(Point, 4326)", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Type", + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { "type": "object", "properties": { - "name": { - "description": "Name string unique within its scope. Example: year", - "type": "string", - "title": "Name", - "maxLength": 50, - "pattern": "[a-z][a-z0-9_]*", - "examples": [ - "id" - ], - "readonly": true - }, - "description": { - "description": "Free-text describing the field. Example: Reference year for which the data were collected.", - "type": "string", - "title": "Description" - }, - "type": { - "description": "Data type of the field. In case of a geom-column in a database, also indicate the shape and CRS. Example: geometry(Point, 4326)", - "type": "string", - "title": "Type", - "examples": [ - "integer", - "string", - "number" - ], - "readonly": true - }, - "isAbout": { - "description": "Ontology URI to describe the column header", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "description": "Name of the Dataset", - "type": "string", - "title": "Name" - }, - "path": { - "description": "Path to the OEO (URL)", - "type": "string", - "title": "Path", - "format": "uri" - } - }, - "additionalProperties": false, - "title": "isAbout" - }, - "title": "isAbout" - }, - "valueReference": { - "description": "Ontology URI for an extended description of the values in the column", - "type": "array", - "items": { - "type": "object", - "properties": { - "value": { - "description": "The value this reference is assinged to.", - "type": "string", - "title": "Value" - }, - "name": { - "description": "Full name of the value", - "type": "string", - "title": "Name" - }, - "path": { - "description": "Path to the OEO", - "type": "string", - "title": "Path", - "format": "uri" - } - }, - "additionalProperties": false, - "title": "valueReference" - }, - "title": "valueReference" - }, - "unit": { - "description": "Unit, preferably SI-Unit, that values in this field are mapped to. Example: MW", - "type": "string", - "title": "Unit" - } + "name": { + "description": "A class label of the OEO terms.", + "example": "wind energy converting unit", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "Path to the OEO class (URI)", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } }, - "additionalProperties": false, - "title": "Field" - }, - "title": "Field", - "minItems": 1 - }, - "primaryKey": { - "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns. Example: id", - "type": "array", - "items": { - "type": "string", - "title": "Primary key" + "badge": "Platinum", + "title": "isAbout", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "isAbout" }, - "title": "Primary key" - }, - "foreignKeys": { - "description": "List of foreign keys.", - "type": "array", - "items": { - "description": "A foreign key is a field that refers to a column in another table.", + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { "type": "object", "properties": { - "fields": { - "description": "The column (as list of items) in the table that is constrainted by the foreign key. Example: version", - "type": "array", - "items": { - "type": "string", - "title": "Field" - }, - "title": "Fields" - }, - "reference": { - "description": "The reference to the foreign table.", - "type": "object", - "properties": { - "resource": { - "description": "The foreign resource (table). Example: schema.table", - "type": "string", - "title": "Resource" - }, - "fields": { - "description": "The foreign resource column. List of fields. Example: version", - "type": "array", - "items": { - "type": "string", - "title": "Field" - }, - "title": "Field" - } - }, - "additionalProperties": false, - "title": "Reference" - } + "value": { + "description": "The name of the value in the column.", + "example": "onshore", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Value" + }, + "name": { + "description": "The class label of the OEO terms.", + "example": "onshore wind farm", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": " The URI of the OEO class", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } }, - "additionalProperties": false, - "title": "Foreign Key" + "badge": "Platinum", + "title": "valueReference", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "valueReference" }, - "title": "Foreign Keys" - } - }, - "additionalProperties": false, - "title": "Schema" - }, - "review": { - "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", - "type": "object", - "properties": { - "path": { - "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review. Example: https://www.example.com", - "type": "string", - "title": "Path" + "unit": { + "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", + "example": "MW", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" }, - "badge": { - "description": "A badge of either Bronze, Silver, Gold or Platin is used to label the given metadata based on its quality. Example: Platin", - "type": "string", - "title": "Badge" - } - }, - "additionalProperties": false, - "title": "Review", - "options": { - "hidden": true - } - }, - "metaMetadata": { - "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you’re filling out your metadata.", - "type": "object", - "properties": { - "metadataVersion": { - "description": "Type and version number of the metadata", - "type": "string", - "title": "Metadata version", - "const": "OEP-2.0.0-draft", - "readonly": true + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", + "example": "id", + "type": "array", + "items": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", + "example": "id", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Primary key" }, - "metadataLicense": { - "description": "Object describing the license of the provided metadata.", - "type": "object", - "properties": { - "name": { - "description": "SPDX identifier. Example: CC0-1.0", - "type": "string", - "title": "Name", - "default": "CC0-1.0", - "examples": [ - "CC0-1.0", - "CC-BY-4.0" - ] - }, - "title": { - "description": "Official (human readable) license title. Example: Creative Commons Zero v1.0 Universal", - "type": "string", - "title": "Title", - "default": "Creative Commons Zero v1.0 Universal" + "badge": "Iron", + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { + "fields": { + "description": "The column (as list of items) in the table that is constrainted by the foreign key.", + "example": "version", + "type": "array", + "items": { + "description": "The column in the table that is constrainted by the foreign key.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table).", + "example": "schema.table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Resource" }, - "path": { - "description": "Url or path string, that is a fully qualified HTTP address. Example: https://creativecommons.org/publicdomain/zero/1.0/", - "type": "string", - "title": "Path", - "default": "https://creativecommons.org/publicdomain/zero/1.0/" + "fields": { + "description": "The foreign resource column.", + "example": "version", + "type": "array", + "items": { + "description": "The foreign resource column.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Field" } - }, - "additionalProperties": false, - "title": "Metadata license" - } + }, + "badge": "Iron", + "title": "Reference", + "additionalProperties": false + } + }, + "title": "Foreign Key", + "additionalProperties": false + }, + "badge": "Iron", + "title": "Foreign Keys" + } + }, + "title": "Schema", + "additionalProperties": false + }, + "dialect": { + "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + "type": "object", + "properties": { + "delimiter": { + "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", + "example": ",", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Delimiter" + }, + "decimalSeparator": { + "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", + "example": ".", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Decimal separator" + } }, "additionalProperties": false, - "title": "Meta metadata", + "title": "Dialect", "options": { - "hidden": true + "hidden": true } + } + } + }, + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", + "type": "object", + "properties": { + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", + "example": "https://www.example.com", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + }, + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", + "example": "Platinum", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Badge" + } }, - "_comment": { - "description": "Object. The “_comment”-section is used as a self-description of the final metadata-file. It is text, intended for humans and can include a link to the metadata documentation(s), required value formats and similar remarks. The comment section has no fix structure or mandatory values, but a useful self-description, similar to the one depicted here, is encouraged.", - "type": "object", - "properties": { - "metadata": { - "description": "Reference to the metadata documentation in use. Example: Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/organisation/wiki/metadata)", - "type": "string", - "title": "Metadata" - }, - "dates": { - "description": "Comment on data/time format. Example: Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", - "type": "string", - "title": "Dates" - }, - "units": { - "description": "Comment on units. Example: If you must use units in cells (which is discouraged), leave a space between numbers and units (100 m)", - "type": "string", - "title": "Units" - }, - "languages": { - "description": "Comment on language format. Example: Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", - "type": "string", - "title": "Languages" - }, - "licenses": { - "description": "Reference to license format. Example: License name must follow the SPDX License List (https://spdx.org/licenses/)", - "type": "string", - "title": "Licenses" - }, - "review": { - "description": "Reference to review documentation. Example: Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", - "type": "string", - "title": "Review" - }, - "todo": { - "description": "If an applicable value is not yet available and will be inserted later on use: 'todo' ", - "type": "string", - "title": "Todo" - } - }, - "title": "_comment" + "additionalProperties": false, + "title": "Review", + "options": { + "hidden": true } + } }, - "additionalProperties": false + "metaMetadata": { + "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you\u2019re filling out your metadata.", + "type": "object", + "properties": { + "metadataVersion": { + "description": "Type and version number of the metadata.", + "example": "OEM-2.0.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Metadata version" + }, + "metadataLicense": { + "description": "Object describing the license of the provided metadata.", + "type": "object", + "properties": { + "name": { + "description": "SPDX identifier", + "example": "CC0-1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Name" + }, + "title": { + "description": "Official (human readable) license title.", + "example": "Creative Commons Zero v1.0 Universal", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Title" + }, + "path": { + "description": "Url or path string, that is a fully qualified HTTP address.", + "example": "https://creativecommons.org/publicdomain/zero/1.0", + "type": [ + "string", + "null" + ], + "badge": null, + "title": "Path" + } + }, + "badge": null, + "title": "Metadata license", + "additionalProperties": false + } + }, + "additionalProperties": false, + "title": "Meta Metadata", + "options": { + "hidden": true + } + } + }, + "additionalProperties": true } \ No newline at end of file From 463e454ae505840b4a85e3c04103db24e067044d Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 19:05:11 +0200 Subject: [PATCH 28/33] add draft script to generate template from schema --- .../scripts/generate_template_from_schema.py | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 metadata/v200_draft/build_source/scripts/generate_template_from_schema.py diff --git a/metadata/v200_draft/build_source/scripts/generate_template_from_schema.py b/metadata/v200_draft/build_source/scripts/generate_template_from_schema.py new file mode 100644 index 00000000..d80ed968 --- /dev/null +++ b/metadata/v200_draft/build_source/scripts/generate_template_from_schema.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Title: create template from json schema +Description: Create template from json schema. +Author: jh-RLI +Email: jonas.huber@rl-institut.de +Date: 2024-05-30 +Version: 1.0.0 +""" + +# Standard Library Imports +# import os +from os.path import dirname + +import sys +import json +import logging + +# from datetime import datetime +from pathlib import Path + +from jsonschema import validate, ValidationError + +# Configuration +LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +logger = logging.getLogger(__name__) + +# Constants +BASE_PATH = Path("metadata/") +VERSION = "v200_draft" +VERSION_PATH = BASE_PATH / VERSION +SCHEMA_BUILD_PATH = VERSION_PATH / "build_source" +MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "schema_structure.json" +SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" +RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "schema.json" +EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" +TEMPLATE_PATH = VERSION_PATH / "template.json" + + +def generate_template(schema): + if isinstance(schema, bool): + return {} if schema else None + + if "type" not in schema and "properties" not in schema and "items" not in schema: + return None + + schema_type = schema.get("type") + + if isinstance(schema_type, list): + schema_type = schema_type[0] + + template = None + # Convert template string to actual type if necessary + # if schema_type == "array" and isinstance(template, str): + # try: + # template = json.loads(template.replace("'", '"')) + # except json.JSONDecodeError: + # pass + # return template + + if schema_type == "object" or "properties" in schema: + template = {} + properties = schema.get("properties", {}) + for prop, prop_schema in properties.items(): + template[prop] = generate_template(prop_schema) + additional_properties = schema.get("additionalProperties", True) + if isinstance(additional_properties, dict): + template["additional_property"] = generate_template(additional_properties) + return template + + if schema_type == "array": + item_schema = schema.get("items", {}) + return [generate_template(item_schema)] + + if schema_type == "string": + return "" + + if schema_type == "number": + return 0 + + if schema_type == "integer": + return 0 + + if schema_type == "boolean": + return False + + return None + + +def main(): + schema_file_path = RESOLVED_SCHEMA_FILE_NAME + + with open(schema_file_path, "r", encoding="utf-8") as schema_file: + schema = json.load(schema_file) + + template = generate_template(schema) + + template_file_path = TEMPLATE_PATH + with open(template_file_path, "w", encoding="utf-8") as template_file: + json.dump(template, template_file, indent=2, ensure_ascii=False) + + print(f"template JSON generated and saved to {template_file_path}") + + +if __name__ == "__main__": + main() From c62b0173a91f689b5b0d57fae8896eb3d3878626 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 19:05:29 +0200 Subject: [PATCH 29/33] update result file path and rename script --- .../generate_example_from_schema copy.py | 125 ------------------ .../scripts/generate_example_from_schema.py | 111 +++++++++------- 2 files changed, 63 insertions(+), 173 deletions(-) delete mode 100644 metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py diff --git a/metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py b/metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py deleted file mode 100644 index aba14068..00000000 --- a/metadata/v200_draft/build_source/scripts/generate_example_from_schema copy.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -""" -Title: create example from json schema -Description: Create example from json schema. -Author: jh-RLI -Email: jonas.huber@rl-institut.de -Date: 2024-05-30 -Version: 1.0.0 -""" - -# Standard Library Imports -# import os -from os.path import dirname - -import sys -import json -import logging - -from typing import Any, Dict, Union, List - -# from datetime import datetime -from pathlib import Path - -from jsonschema import validate, ValidationError - -# Configuration -LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" -logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) -logger = logging.getLogger(__name__) - -# Constants -BASE_PATH = Path("metadata/") -VERSION = "v200_draft" -VERSION_PATH = BASE_PATH / VERSION -SCHEMA_BUILD_PATH = VERSION_PATH / "build_source" -MAIN_SCHEMA_PATH = SCHEMA_BUILD_PATH / "schema_structure.json" -SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" -RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "schema.json" -EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" -EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" - - -def read_schema(filename: str) -> Dict[str, Any]: - """Read a JSON schema from a file. - - Args: - filename (str): The path to the JSON schema file. - - Returns: - Dict[str, Any]: The JSON schema as a dictionary. - """ - pwd = dirname(__file__) - with open(pwd + filename, "r", encoding="utf-8") as file: - schema = json.load(file) - return schema - - -def generate_example( - schema: Dict[str, Any] -) -> Union[Dict[str, Any], List[Any], str, None]: - """Generate a JSON object from the schema using the example values provided. - - Args: - schema (Dict[str, Any]): The JSON schema. - - Returns: - Union[Dict[str, Any], List[Any], str, None]: A JSON object generated from the schema. - """ - if "example" in schema: - return schema["example"] - - schema_type = schema.get("type", None) - if isinstance(schema_type, list): - schema_type = schema_type[0] - - if schema_type == "object": - example_object = {} - properties = schema.get("properties", {}) - for key, value in properties.items(): - example_object[key] = generate_example(value) - return example_object - - elif schema_type == "array": - items = schema.get("items", {}) - return [generate_example(items)] - - elif schema_type == "string": - return "" - - elif schema_type == "null": - return None - - return None - - -def generate_json_from_schema(schema_file: str) -> Dict[str, Any]: - """Generate a JSON object that conforms to the schema read from a file. - - Args: - schema_file (str): The path to the JSON schema file. - - Returns: - Dict[str, Any]: A JSON object generated from the schema. - """ - schema = read_schema(schema_file) - return generate_example(schema) - - -def save_json(data: Dict[str, Any], filename: str) -> None: - """Save the given data as a JSON file. - - Args: - data (Dict[str, Any]): The JSON data to be saved. - filename (str): The filename where the JSON data will be saved. - """ - with open(filename, "w", encoding="utf-8") as file: - json.dump(data, file, ensure_ascii=False, indent=4) - - -if __name__ == "__main__": - schema_filename = "/res_schema.json" - json_data = generate_json_from_schema(schema_filename) - save_json(json_data, "oep_metadata.json") diff --git a/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py b/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py index 9708cae0..8c0884d0 100644 --- a/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py +++ b/metadata/v200_draft/build_source/scripts/generate_example_from_schema.py @@ -18,6 +18,8 @@ import json import logging +from typing import Any, Dict, Union, List + # from datetime import datetime from pathlib import Path @@ -37,74 +39,87 @@ SCHEMA_REFS = SCHEMA_BUILD_PATH / "schemas" RESOLVED_SCHEMA_FILE_NAME = VERSION_PATH / "schema.json" EXPECTED_SCHEMA_PATH = VERSION_PATH / "schema.json" -EXAMPLE_PATH = VERSION_PATH / "resolved_example.json" +EXAMPLE_PATH = VERSION_PATH / "example.json" -def generate_example(schema): - if isinstance(schema, bool): - return {} if schema else None +def read_schema(filename: str) -> Dict[str, Any]: + """Read a JSON schema from a file. - if "type" not in schema and "properties" not in schema and "items" not in schema: - return None + Args: + filename (str): The path to the JSON schema file. + + Returns: + Dict[str, Any]: The JSON schema as a dictionary. + """ + pwd = dirname(__file__) + with open(pwd + filename, "r", encoding="utf-8") as file: + schema = json.load(file) + return schema + + +def generate_example( + schema: Dict[str, Any] +) -> Union[Dict[str, Any], List[Any], str, None]: + """Generate a JSON object from the schema using the example values provided. + + Args: + schema (Dict[str, Any]): The JSON schema. - schema_type = schema.get("type") + Returns: + Union[Dict[str, Any], List[Any], str, None]: A JSON object generated from the schema. + """ + if "example" in schema: + return schema["example"] + schema_type = schema.get("type", None) if isinstance(schema_type, list): schema_type = schema_type[0] - if "example" in schema: - example = schema["example"] - # Convert example string to actual type if necessary - if schema_type == "array" and isinstance(example, str): - try: - example = json.loads(example.replace("'", '"')) - except json.JSONDecodeError: - pass - return example - - if schema_type == "object" or "properties" in schema: - example = {} + if schema_type == "object": + example_object = {} properties = schema.get("properties", {}) - for prop, prop_schema in properties.items(): - example[prop] = generate_example(prop_schema) - additional_properties = schema.get("additionalProperties", True) - if isinstance(additional_properties, dict): - example["additional_property"] = generate_example(additional_properties) - return example - - if schema_type == "array": - item_schema = schema.get("items", {}) - return [generate_example(item_schema)] - - if schema_type == "string": - return "" + for key, value in properties.items(): + example_object[key] = generate_example(value) + return example_object - if schema_type == "number": - return 0 + elif schema_type == "array": + items = schema.get("items", {}) + return [generate_example(items)] - if schema_type == "integer": - return 0 + elif schema_type == "string": + return "" - if schema_type == "boolean": - return False + elif schema_type == "null": + return None return None -def main(): - schema_file_path = RESOLVED_SCHEMA_FILE_NAME +def generate_json_from_schema(schema_file: str) -> Dict[str, Any]: + """Generate a JSON object that conforms to the schema read from a file. + + Args: + schema_file (str): The path to the JSON schema file. - with open(schema_file_path, "r", encoding="utf-8") as schema_file: - schema = json.load(schema_file) + Returns: + Dict[str, Any]: A JSON object generated from the schema. + """ + schema = read_schema(schema_file) + return generate_example(schema) - example = generate_example(schema) - example_file_path = EXAMPLE_PATH - with open(example_file_path, "w", encoding="utf-8") as example_file: - json.dump(example, example_file, indent=2, ensure_ascii=False) +def save_json(data: Dict[str, Any], filename: Path) -> None: + """Save the given data as a JSON file. - print(f"Example JSON generated and saved to {example_file_path}") + Args: + data (Dict[str, Any]): The JSON data to be saved. + filename (str): The filename where the JSON data will be saved. + """ + with open(filename, "w", encoding="utf-8") as file: + json.dump(data, file, ensure_ascii=False, indent=4) if __name__ == "__main__": - main() + schema_filename = "/res_schema.json" + json_data = generate_json_from_schema(schema_filename) + save_json(json_data, EXAMPLE_PATH) From 472cae677abb68fa97bdd7d497f426e31be1da94 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 19:05:50 +0200 Subject: [PATCH 30/33] enhance schema resolve / generator script --- .../v200_draft/build_source/scripts/resolve_schema_refs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py b/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py index 5d1631d0..686e62f8 100644 --- a/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py +++ b/metadata/v200_draft/build_source/scripts/resolve_schema_refs.py @@ -145,8 +145,10 @@ def resolve_top_level_properties(schema, registry, base_uri): resolved_value = resolve_references(value, registry, base_uri) resources = {} for _k, _v in resolved_value["items"].items(): - resources.update(_v) - resolved_properties[prop] = resources + if isinstance(_v, dict): + resources.update(_v) + resolved_properties[prop] = resolved_value + resolved_properties[prop]["items"] = resources else: resolved_properties[prop] = resolved_value From 742129366839ef6fc73bca652fee695b42fc8f99 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 19:06:19 +0200 Subject: [PATCH 31/33] update schema & example and add template json files --- metadata/v200_draft/example.json | 140 +++ metadata/v200_draft/schema.json | 1721 +++++++++++++++-------------- metadata/v200_draft/template.json | 16 + 3 files changed, 1029 insertions(+), 848 deletions(-) diff --git a/metadata/v200_draft/example.json b/metadata/v200_draft/example.json index e69de29b..1800a31f 100644 --- a/metadata/v200_draft/example.json +++ b/metadata/v200_draft/example.json @@ -0,0 +1,140 @@ +{ + "name": "my_oep_collection", + "title": "RLI - OEMetadata - Metadata example table", + "collectionId": "https://todo", + "resources": [ + { + "@id": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", + "@context": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", + "wasGeneratedBy": { + "@id": "todo", + "@type": "moss:OEMetadataMod", + "version": "1.0.0", + "used": "todo", + "license": "CC0" + }, + "name": "oep_metadata_table_example_v160", + "title": "RLI - OEMetadata - Metadata example table", + "id": "https://example.com", + "description": "Example table used to illustrate the metadata structure and meaning.", + "subject": [ + { + "name": "energy", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000150" + } + ], + "language": "[en-GB, de-DE, fr-FR]", + "keywords": "[example, template, test]", + "publicationDate": "2019-02-06", + "context": { + "homepage": "https://openenergy-platform.org/", + "documentation": "https://openenergy-platform.org/about/", + "sourceCode": "https://github.com/OpenEnergyPlatform", + "contact": "contact@example.com", + "grantNo": "01AB2345", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png" + }, + "spatial": { + "location": "52.433509, 13.535855", + "extent": "Europe", + "resolution": "3 m" + }, + "temporal": { + "referenceDate": "2016-01-01", + "timeseries": [ + { + "start": "2019-02-06T10:12:04+00:00", + "end": "2019-02-07T10:12:04+00:00", + "resolution": " 30 s", + "alignment": "left", + "aggregationType": "sum" + } + ] + }, + "sources": [ + { + "title": "IPCC Fifth Assessment Report", + "description": "Scientific climate change report by the UN", + "path": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "instruction": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "attribution": "© Intergovernmental Panel on Climate Change 2014" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "instruction": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "attribution": "© Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "John Doe", + "email": "contact@example.com", + "date": "2016-06-16", + "object": "data and metadata", + "comment": "Fix typo in the title." + } + ], + "resource": { + "profile": "tabular-data-resource", + "name": "sandbox.example_table", + "path": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "format": "csv", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "year", + "description": "Reference year for which the data were collected.", + "type": "geometry(Point, 4326)", + "isAbout": [ + { + "name": "wind energy converting unit", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000044" + } + ], + "valueReference": [ + { + "value": "onshore", + "name": "onshore wind farm", + "path": "https://openenergy-platform.org/ontology/oeo/OEO_00000311" + } + ], + "unit": "MW" + } + ], + "primaryKey": "id", + "foreignKeys": [ + { + "fields": "version", + "reference": { + "resource": "schema.table", + "fields": "version" + } + } + ] + }, + "dialect": { + "delimiter": ",", + "decimalSeparator": "." + }, + "review": { + "path": "https://www.example.com", + "badge": "Platinum" + } + } + } + ] +} \ No newline at end of file diff --git a/metadata/v200_draft/schema.json b/metadata/v200_draft/schema.json index fd7d650e..317a39f9 100644 --- a/metadata/v200_draft/schema.json +++ b/metadata/v200_draft/schema.json @@ -36,922 +36,911 @@ "readonly": true }, "resources": { - "@id": { - "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", - "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", - "type": [ - "string", - "null" - ], - "badge": null, - "title": "@Id", - "readonly": true - }, - "@context": { - "description": "Explanation of metadata keys in ontology terms.", - "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", - "type": [ - "string", - "null" - ], - "badge": null, - "title": "@context" - }, - "wasGeneratedBy": { - "description": "Specific fields to establish a link to the open energy databus (dbpedia databus).", - "title": "wasGeneratedBy", - "type": "object", - "properties": { + "description": "A collection of related data resource descriptions and metadata. This may include relational data models which are technically related", + "type": "array", + "items": { + "jsonLd": { "@id": { - "type": "string", - "format": "uri", - "description": "The unique identifier for the wasGeneratedBy object.", - "example": "todo" - }, - "@type": { - "type": "string", - "enum": [ - "moss:OEMetadataMod" - ], - "description": "The type of the wasGeneratedBy object.", - "example": "moss:OEMetadataMod" - }, - "version": { - "type": "string", - "pattern": "^OEP-[0-9]+\\.[0-9]+\\.[0-9]+$", - "description": "The version of the metadata format.", - "example": "1.0.0" - }, - "used": { - "type": "string", - "format": "uri", - "description": "A reference to the resource used.", - "example": "todo" - }, - "license": { - "type": "string", - "format": "uri", - "description": "The license under which the resource is available.", - "example": "CC0" - } - }, - "required": [ - "@id", - "@type", - "version", - "used", - "license" - ], - "additionalProperties": false - }, - "name": { - "description": "File name or database table name", - "example": "oep_metadata_table_example_v160", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "Name" - }, - "title": { - "description": "A Human readable, full title , including author.", - "example": "RLI - OEMetadata - Metadata example table", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "Title" - }, - "id": { - "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", - "example": "https://example.com", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "ID", - "readonly": true - }, - "description": { - "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", - "example": "Example table used to illustrate the metadata structure and meaning.", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "Description" - }, - "subject": { - "description": "Reference the topic of the resource in ontology terms", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "description": "The class label of the OEO term.", - "example": "energy", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Name" - }, - "path": { - "description": "The URI of the class.", - "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Path", - "format": "uri" - } - }, - "badge": "Platinum", - "title": "Subject", - "additionalProperties": false - }, - "badge": "Platinum", - "title": "Subject" - }, - "language": { - "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", - "example": "[en-GB, de-DE, fr-FR]", - "type": "array", - "items": { - "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", - "example": "en-GB", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Language" - }, - "badge": "Gold", - "title": "Language" - }, - "keywords": { - "description": "A list of string keywords to assist users searching for the package in catalogs.", - "example": "[example, template, test]", - "type": "array", - "items": { - "description": "A keyword to assist users searching for the package in catalogs.", - "example": "template", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "Keyword" - }, - "badge": "Silver", - "title": "Keywords" - }, - "publicationDate": { - "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", - "example": "2019-02-06", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Publication date", - "format": "date" - }, - "context": { - "description": "An Object that describes the general setting, environment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", - "type": "object", - "properties": { - "homepage": { - "description": "URL of project.", - "example": "https://openenergy-platform.org/", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Homepage", - "format": "uri" - }, - "documentation": { - "description": "A URL of the project's documentation.", - "example": "https://openenergy-platform.org/about/", + "description": "A Uniform Resource Identifier (URI) that links the resource via the DBpedia Databus", + "example": "https://databus.dbpedia.org/kurzum/mastr/bnetza-mastr/01.04.00", "type": [ "string", "null" ], - "badge": "Gold", - "title": "Documentation" - }, - "sourceCode": { - "description": "A URL of the projects source code.", - "example": "https://github.com/OpenEnergyPlatform", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Source Code" - }, - "contact": { - "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", - "example": "contact@example.com", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "E-Mail Contact", - "format": "email" - }, - "grantNo": { - "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", - "example": "01AB2345", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Grant no" - }, - "fundingAgency": { - "description": "In a funded project this is the funding agency, which can be a governmental or a company.", - "example": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Funding agency" + "badge": null, + "title": "@Id", + "readonly": true }, - "fundingAgencyLogo": { - "description": "A URL to the logo or image of the funding agency.", - "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "@context": { + "description": "Explanation of metadata keys in ontology terms.", + "example": "https://raw.githubusercontent.com/LOD-GEOSS/databus-snippets/master/oep_metadata/context.jsonld", "type": [ "string", "null" ], - "badge": "Gold", - "title": "Funding agency logo", - "format": "uri" + "badge": null, + "title": "@context" }, - "publisherLogo": { - "description": "A URL to the logo of the agency publishing the data.", - "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", - "type": [ - "string", - "null" + "wasGeneratedBy": { + "description": "Specific fields to establish a link to the open energy databus (dbpedia databus).", + "title": "wasGeneratedBy", + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "uri", + "description": "The unique identifier for the wasGeneratedBy object.", + "example": "todo" + }, + "@type": { + "type": "string", + "enum": [ + "moss:OEMetadataMod" + ], + "description": "The type of the wasGeneratedBy object.", + "example": "moss:OEMetadataMod" + }, + "version": { + "type": "string", + "pattern": "^OEP-[0-9]+\\.[0-9]+\\.[0-9]+$", + "description": "The version of the metadata format.", + "example": "1.0.0" + }, + "used": { + "type": "string", + "format": "uri", + "description": "A reference to the resource used.", + "example": "todo" + }, + "license": { + "type": "string", + "format": "uri", + "description": "The license under which the resource is available.", + "example": "CC0" + } + }, + "required": [ + "@id", + "@type", + "version", + "used", + "license" ], - "badge": "Gold", - "title": "Publisher logo", - "format": "uri" + "additionalProperties": false } }, - "badge": "Gold", - "title": "Context", - "additionalProperties": false - }, - "spatial": { - "description": "An object that describes the spatial context of the data it contains.", - "type": "object", - "properties": { - "location": { - "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", - "example": "52.433509, 13.535855", + "general": { + "name": { + "description": "File name or database table name", + "example": "oep_metadata_table_example_v160", "type": [ "string", "null" ], "badge": "Silver", - "title": "Location" + "title": "Name" }, - "extent": { - "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", - "example": "Europe", + "title": { + "description": "A Human readable, full title , including author.", + "example": "RLI - OEMetadata - Metadata example table", "type": [ "string", "null" ], "badge": "Silver", - "title": "Extent" + "title": "Title" }, - "resolution": { - "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", - "example": "3 m", + "id": { + "description": "Uniform Resource Identifier (URI) that unambiguously identifies the resource. This can be a URL on the data set. It can also be a Digital Object Identifier (DOI).", + "example": "https://example.com", "type": [ "string", "null" ], - "badge": "Silver", - "title": "Resolution" - } - }, - "badge": "Silver", - "title": "Spatial", - "additionalProperties": false - }, - "temporal": { - "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", - "type": "object", - "properties": { - "referenceDate": { - "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", - "example": "2016-01-01", + "badge": "Bronze", + "title": "ID", + "readonly": true + }, + "description": { + "description": "A description of the package. It should be usable as summary information for the entire package that is described by the metadata.", + "example": "Example table used to illustrate the metadata structure and meaning.", "type": [ "string", "null" ], - "badge": "Bronze", - "title": "Reference date", - "format": "date" + "badge": "Silver", + "title": "Description" }, - "timeseries": { - "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", + "subject": { + "description": "Reference the topic of the resource in ontology terms", "type": "array", "items": { "type": "object", "properties": { - "start": { - "description": "The beginning point in time of a time series.", - "example": "2019-02-06T10:12:04+00:00", + "name": { + "description": "The class label of the OEO term.", + "example": "energy", "type": [ "string", "null" ], - "badge": "Silver", - "title": "Start", - "format": "date-time" - }, - "end": { - "description": "The end point in time of a time series.", - "example": "2019-02-07T10:12:04+00:00", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "End", - "format": "date-time" + "badge": "Platinum", + "title": "Name" }, - "resolution": { - "description": "The time span between individual points of information in a time series.", - "example": " 30 s", + "path": { + "description": "The URI of the class.", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000150", "type": [ "string", "null" ], - "badge": "Silver", - "title": "Resolution" - }, - "alignment": { - "description": "An indicator whether stamps in a time series are left, right or middle.", - "example": "left", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "Alignment" - }, - "aggregationType": { - "description": "Indicates whether the values are a sum, average or current.", - "example": "sum", - "type": [ - "string", - "null" - ], - "badge": "Silver", - "title": "Aggregation type" + "badge": "Platinum", + "title": "Path", + "format": "uri" } }, - "badge": "Silver", - "title": "Timeseries", + "badge": "Platinum", + "title": "Subject", "additionalProperties": false }, - "badge": "Silver", - "title": "Timeseries" - } - }, - "badge": "Silver", - "title": "Temporal", - "additionalProperties": false - }, - "sources": { - "description": "List of source objects. Each object has all name-value-pairs.", - "type": "array", - "items": { - "description": "Source object in list of source objects. Each object has all name-value-pairs.", - "type": "object", - "properties": { - "title": { - "description": "A human readable title of the source, a document title or organisation name.", - "example": "IPCC Fifth Assessment Report", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Title" - }, - "description": { - "description": "A free text description of the data set.", - "example": "Scientific climate change report by the UN", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Description" - }, - "path": { - "description": "A URL to the original source.", - "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Path", - "format": "uri" - }, - "licenses": { - "description": "The license(s) under which the source(s) is/are provided. List of objects.", - "type": "array", - "items": { - "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", - "type": "object", - "properties": { - "name": { - "description": "THe SPDX identifier.", - "example": "ODbL-1.0", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Name" - }, - "title": { - "description": "The official (human readable) title of the license.", - "example": "Open Data Commons Open Database License 1.0", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Title" - }, - "path": { - "description": "A link to the license text.", - "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Path" - }, - "instruction": { - "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", - "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Instruction" - }, - "attribution": { - "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", - "example": "\u00a9 Intergovernmental Panel on Climate Change 2014", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Attribution" - } - }, - "badge": "Bronze", - "title": "Licenses" - }, - "badge": "Bronze", - "title": "Licenses" - } + "badge": "Platinum", + "title": "Subject" }, - "badge": "Bronze", - "title": "Sources", - "additionalProperties": false - }, - "badge": "Bronze", - "title": "Sources" - }, - "licenses": { - "description": "The license(s) under which the described package is provided. List of objects.", - "type": "array", - "items": { - "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", - "type": "object", - "properties": { - "name": { - "description": "The SPDX identifier.", - "example": "ODbL-1.0", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Name" - }, - "title": { - "description": "The official (human readable) title of the license.", - "example": "Open Data Commons Open Database License 1.0", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Title" - }, - "path": { - "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", - "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Path" - }, - "instruction": { - "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", - "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "language": { + "description": "List of languages used within the described data structures (e.g. titles, descriptions). Standard: IETF (BCP47).", + "example": "[en-GB, de-DE, fr-FR]", + "type": "array", + "items": { + "description": "Language used within the described data structures (e.g. titles, descriptions). The language key can be repeated if more languages are used. Standard: IETF (BCP47)", + "example": "en-GB", "type": [ "string", "null" ], - "badge": "Bronze", - "title": "Instruction" + "badge": "Gold", + "title": "Language" }, - "attribution": { - "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", - "example": "\u00a9 Reiner Lemoine Institut", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Attribution" - } + "badge": "Gold", + "title": "Language" }, - "badge": "Bronze", - "title": "Licenses", - "additionalProperties": false - }, - "badge": "Bronze", - "title": "Licenses" - }, - "contributors": { - "description": "The people or organizations who contributed to this data package. List of objects.", - "type": "array", - "items": { - "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", - "type": "object", - "properties": { - "title": { - "description": "Name/title of the contributor (name for a person, name or title for an organization).", - "example": "John Doe", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Title" - }, - "email": { - "description": "E-mail address of the contributor.", - "example": "contact@example.com", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Email", - "format": "email" - }, - "date": { - "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", - "example": "2016-06-16", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Date", - "format": "date" - }, - "object": { - "description": "Target of contribution. Which part of the package was supplied/changed.", - "example": "data and metadata", + "keywords": { + "description": "A list of string keywords to assist users searching for the package in catalogs.", + "example": "[example, template, test]", + "type": "array", + "items": { + "description": "A keyword to assist users searching for the package in catalogs.", + "example": "template", "type": [ "string", "null" ], - "badge": "Bronze", - "title": "Object" + "badge": "Silver", + "title": "Keyword" }, - "comment": { - "description": "Free text comment on what has been done.", - "example": "Fix typo in the title.", - "type": [ - "string", - "null" - ], - "badge": "Bronze", - "title": "Comment" - } - }, - "badge": "Bronze", - "title": "Contributors", - "additionalProperties": false - }, - "badge": "Bronze", - "title": "Contributors" - }, - "resource": { - "title": "Resource", - "description": "The data resource format describes a data resource as an individual file or table.", - "type": "object", - "properties": { - "profile": { - "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", - "example": "tabular-data-resource", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Profile", - "options": { - "hidden": true - } - }, - "name": { - "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", - "example": "sandbox.example_table", - "type": [ - "string", - "null" - ], - "badge": "Iron", - "title": "Name" - }, - "path": { - "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", - "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Path", - "options": { - "hidden": true - } - }, - "format": { - "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", - "example": "csv", - "type": [ - "string", - "null" - ], - "badge": "Gold", - "title": "Format", - "options": { - "hidden": true - } + "badge": "Silver", + "title": "Keywords" }, - "encoding": { - "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", - "example": "UTF-8", + "publicationDate": { + "description": "Date of publishing. Date Format is ISO 8601 (YYYY-MM-DD)", + "example": "2019-02-06", "type": [ "string", "null" ], + "badge": "Bronze", + "title": "Publication date", + "format": "date" + } + }, + "context": { + "context": { + "description": "An Object that describes the general setting, environment or project leading to the creation or maintenance of this dataset. In science this can be the research project.", + "type": "object", + "properties": { + "homepage": { + "description": "URL of project.", + "example": "https://openenergy-platform.org/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Homepage", + "format": "uri" + }, + "documentation": { + "description": "A URL of the project's documentation.", + "example": "https://openenergy-platform.org/about/", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Documentation" + }, + "sourceCode": { + "description": "A URL of the projects source code.", + "example": "https://github.com/OpenEnergyPlatform", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Source Code" + }, + "contact": { + "description": "A reference to the creator or maintainer of the data set. This can be an email address or a GitHub handle.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "E-Mail Contact", + "format": "email" + }, + "grantNo": { + "description": "An identifying grant number. In case of a publicly funded project, this number is assigned by the funding agency.", + "example": "01AB2345", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Grant no" + }, + "fundingAgency": { + "description": "In a funded project this is the funding agency, which can be a governmental or a company.", + "example": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency" + }, + "fundingAgencyLogo": { + "description": "A URL to the logo or image of the funding agency.", + "example": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Funding agency logo", + "format": "uri" + }, + "publisherLogo": { + "description": "A URL to the logo of the agency publishing the data.", + "example": "https://reiner-lemoine-institut.de//wp-content/uploads/2015/09/rlilogo.png", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Publisher logo", + "format": "uri" + } + }, "badge": "Gold", - "title": "Encoding", - "options": { - "hidden": true - } - }, - "schema": { - "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "title": "Context", + "additionalProperties": false + } + }, + "spatial": { + "spatial": { + "description": "An object that describes the spatial context of the data it contains.", "type": "object", "properties": { - "fields": { - "description": "List of field objects.", + "location": { + "description": "A location of the data. In case of data where the location can be described as a point. May be specified as coordinates, URI or addresses with street, house number and zip code.", + "example": "52.433509, 13.535855", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Location" + }, + "extent": { + "description": "A covered area. May be the name of a region, or the geometry of a bounding box.", + "example": "Europe", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Extent" + }, + "resolution": { + "description": "Pixel size in case of a regular raster image. Reference to administrative level or other spatial division that is present as the smallest spatially distinguished unit size.", + "example": "3 m", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Resolution" + } + }, + "badge": "Silver", + "title": "Spatial", + "additionalProperties": false + } + }, + "temporal": { + "temporal": { + "description": "An object with the time period covered in the data. Temporal information should either contain a \"referenceDate\" or the keys describing a time series; in rare cases both.", + "type": "object", + "properties": { + "referenceDate": { + "description": "The base year, month or day. Point in time for which the data is meant to be accurate. The census data or a satellite image will have a reference date. Date Format is ISO 8601.", + "example": "2016-01-01", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Reference date", + "format": "date" + }, + "timeseries": { + "description": "A list of objects that describe the timeseries. It contains start, end, resolution, alignment and aggregation type properties.", "type": "array", "items": { - "description": "Field object. Every object describes a column and provides name, description, type and unit.", "type": "object", "properties": { - "name": { - "description": "The name of the field. The string must be unique within it's scope", - "example": "year", + "start": { + "description": "The beginning point in time of a time series.", + "example": "2019-02-06T10:12:04+00:00", "type": [ "string", "null" ], - "badge": "Iron", - "title": "Name", - "readonly": true + "badge": "Silver", + "title": "Start", + "format": "date-time" }, - "description": { - "description": "A text describing the field.", - "example": "Reference year for which the data were collected.", + "end": { + "description": "The end point in time of a time series.", + "example": "2019-02-07T10:12:04+00:00", "type": [ "string", "null" ], "badge": "Silver", - "title": "Description" + "title": "End", + "format": "date-time" }, - "type": { - "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", - "example": "geometry(Point, 4326)", + "resolution": { + "description": "The time span between individual points of information in a time series.", + "example": " 30 s", "type": [ "string", "null" ], - "badge": "Iron", - "title": "Type", - "readonly": true - }, - "isAbout": { - "description": "Ontology URI to describe the column header", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "description": "A class label of the OEO terms.", - "example": "wind energy converting unit", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Name" - }, - "path": { - "description": "Path to the OEO class (URI)", - "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Path", - "format": "uri" - } - }, - "badge": "Platinum", - "title": "isAbout", - "additionalProperties": false - }, - "badge": "Platinum", - "title": "isAbout" + "badge": "Silver", + "title": "Resolution" }, - "valueReference": { - "description": "Ontology URI for an extended description of the values in the column", - "type": "array", - "items": { - "type": "object", - "properties": { - "value": { - "description": "The name of the value in the column.", - "example": "onshore", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Value" - }, - "name": { - "description": "The class label of the OEO terms.", - "example": "onshore wind farm", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Name" - }, - "path": { - "description": " The URI of the OEO class", - "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", - "type": [ - "string", - "null" - ], - "badge": "Platinum", - "title": "Path", - "format": "uri" - } - }, - "badge": "Platinum", - "title": "valueReference", - "additionalProperties": false - }, - "badge": "Platinum", - "title": "valueReference" + "alignment": { + "description": "An indicator whether stamps in a time series are left, right or middle.", + "example": "left", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Alignment" }, - "unit": { - "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", - "example": "MW", + "aggregationType": { + "description": "Indicates whether the values are a sum, average or current.", + "example": "sum", "type": [ "string", "null" ], "badge": "Silver", - "title": "Unit" + "title": "Aggregation type" } }, - "additionalProperties": false, - "title": "Field" + "badge": "Silver", + "title": "Timeseries", + "additionalProperties": false }, - "title": "Field" - }, - "primaryKey": { - "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", - "example": "id", - "type": "array", - "items": { - "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", - "example": "id", + "badge": "Silver", + "title": "Timeseries" + } + }, + "badge": "Silver", + "title": "Temporal", + "additionalProperties": false + } + }, + "sources": { + "sources": { + "description": "List of source objects. Each object has all name-value-pairs.", + "type": "array", + "items": { + "description": "Source object in list of source objects. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "title": { + "description": "A human readable title of the source, a document title or organisation name.", + "example": "IPCC Fifth Assessment Report", "type": [ "string", "null" ], - "badge": "Iron", - "title": "Primary key" + "badge": "Bronze", + "title": "Title" }, - "badge": "Iron", - "title": "Primary key" - }, - "foreignKeys": { - "description": "List of foreign keys.", - "type": "array", - "items": { - "description": "A foreign key is a field that refers to a column in another table.", - "type": "object", - "properties": { - "fields": { - "description": "The column (as list of items) in the table that is constrainted by the foreign key.", - "example": "version", - "type": "array", - "items": { - "description": "The column in the table that is constrainted by the foreign key.", - "example": "version", + "description": { + "description": "A free text description of the data set.", + "example": "Scientific climate change report by the UN", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Description" + }, + "path": { + "description": "A URL to the original source.", + "example": "https://www.ipcc.ch/site/assets/uploads/2018/02/ipcc_wg3_ar5_full.pdf", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path", + "format": "uri" + }, + "licenses": { + "description": "The license(s) under which the source(s) is/are provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described source is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "THe SPDX identifier.", + "example": "ODbL-1.0", "type": [ "string", "null" ], - "badge": "Iron", - "title": "Field" + "badge": "Bronze", + "title": "Name" }, - "badge": "Iron", - "title": "Fields" + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A link to the license text.", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyright owner of the source. Copyright owner name must be acknowledged if attribution licenses are used.", + "example": "\u00a9 Intergovernmental Panel on Climate Change 2014", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } }, - "reference": { - "description": "The reference to the foreign table.", + "badge": "Bronze", + "title": "Licenses" + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "badge": "Bronze", + "title": "Sources", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Sources" + } + }, + "licenses": { + "licenses": { + "description": "The license(s) under which the described package is provided. List of objects.", + "type": "array", + "items": { + "description": "A license object under which the described package is provided. Each object has all name-value-pairs.", + "type": "object", + "properties": { + "name": { + "description": "The SPDX identifier.", + "example": "ODbL-1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Name" + }, + "title": { + "description": "The official (human readable) title of the license.", + "example": "Open Data Commons Open Database License 1.0", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "path": { + "description": "A url-or-path string, that is a fully qualified HTTP address, or a relative POSIX path (see the url-or-path definition in Data Resource for details).", + "example": "https://opendatacommons.org/licenses/odbl/1-0/index.html", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Path" + }, + "instruction": { + "description": "A short description of rights and restrictions. The use of tl;drLegal is recommended.", + "example": "You are free to share and change, but you must attribute, and share derivations under the same license. See https://tldrlegal.com/license/odc-open-database-license-(odbl) for further information.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Instruction" + }, + "attribution": { + "description": "The copyrightholder of the data set. If attribution licenses are used, that name must be acknowledged.", + "example": "\u00a9 Reiner Lemoine Institut", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Attribution" + } + }, + "badge": "Bronze", + "title": "Licenses", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Licenses" + } + }, + "contribution": { + "contributors": { + "description": "The people or organizations who contributed to this data package. List of objects.", + "type": "array", + "items": { + "description": "A person or organizations who contributed to this data package. Each object refers to one contributor. Every contributor must have a title and property. A path, email, role and organization properties are optional extras.", + "type": "object", + "properties": { + "title": { + "description": "Name/title of the contributor (name for a person, name or title for an organization).", + "example": "John Doe", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Title" + }, + "email": { + "description": "E-mail address of the contributor.", + "example": "contact@example.com", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Email", + "format": "email" + }, + "date": { + "description": "Date of the contribution. If the contribution took more than a day, use the date of the final contribiution. Date Format is ISO 8601.", + "example": "2016-06-16", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Date", + "format": "date" + }, + "object": { + "description": "Target of contribution. Which part of the package was supplied/changed.", + "example": "data and metadata", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Object" + }, + "comment": { + "description": "Free text comment on what has been done.", + "example": "Fix typo in the title.", + "type": [ + "string", + "null" + ], + "badge": "Bronze", + "title": "Comment" + } + }, + "badge": "Bronze", + "title": "Contributors", + "additionalProperties": false + }, + "badge": "Bronze", + "title": "Contributors" + } + }, + "resource": { + "resource": { + "title": "Resource", + "description": "The data resource format describes a data resource as an individual file or table.", + "type": "object", + "properties": { + "profile": { + "description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".", + "example": "tabular-data-resource", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Profile", + "options": { + "hidden": true + } + }, + "name": { + "description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:", + "example": "sandbox.example_table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name" + }, + "path": { + "description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.", + "example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Path", + "options": { + "hidden": true + } + }, + "format": { + "description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.", + "example": "csv", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Format", + "options": { + "hidden": true + } + }, + "encoding": { + "description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.", + "example": "UTF-8", + "type": [ + "string", + "null" + ], + "badge": "Gold", + "title": "Encoding", + "options": { + "hidden": true + } + }, + "schema": { + "description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.", + "type": "object", + "properties": { + "fields": { + "description": "List of field objects.", + "type": "array", + "items": { + "description": "Field object. Every object describes a column and provides name, description, type and unit.", "type": "object", "properties": { - "resource": { - "description": "The foreign resource (table).", - "example": "schema.table", + "name": { + "description": "The name of the field. The string must be unique within it's scope", + "example": "year", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Name", + "readonly": true + }, + "description": { + "description": "A text describing the field.", + "example": "Reference year for which the data were collected.", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Description" + }, + "type": { + "description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.", + "example": "geometry(Point, 4326)", "type": [ "string", "null" ], "badge": "Iron", - "title": "Resource" + "title": "Type", + "readonly": true + }, + "isAbout": { + "description": "Ontology URI to describe the column header", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "A class label of the OEO terms.", + "example": "wind energy converting unit", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": "Path to the OEO class (URI)", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "isAbout", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "isAbout" + }, + "valueReference": { + "description": "Ontology URI for an extended description of the values in the column", + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "description": "The name of the value in the column.", + "example": "onshore", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Value" + }, + "name": { + "description": "The class label of the OEO terms.", + "example": "onshore wind farm", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Name" + }, + "path": { + "description": " The URI of the OEO class", + "example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311", + "type": [ + "string", + "null" + ], + "badge": "Platinum", + "title": "Path", + "format": "uri" + } + }, + "badge": "Platinum", + "title": "valueReference", + "additionalProperties": false + }, + "badge": "Platinum", + "title": "valueReference" }, + "unit": { + "description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.", + "example": "MW", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Unit" + } + }, + "additionalProperties": false, + "title": "Field" + }, + "title": "Field" + }, + "primaryKey": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.", + "example": "id", + "type": "array", + "items": { + "description": "A primary key is a field or set of fields that uniquely identifies each row in the table.", + "example": "id", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Primary key" + }, + "badge": "Iron", + "title": "Primary key" + }, + "foreignKeys": { + "description": "List of foreign keys.", + "type": "array", + "items": { + "description": "A foreign key is a field that refers to a column in another table.", + "type": "object", + "properties": { "fields": { - "description": "The foreign resource column.", + "description": "The column (as list of items) in the table that is constrainted by the foreign key.", "example": "version", "type": "array", "items": { - "description": "The foreign resource column.", + "description": "The column in the table that is constrainted by the foreign key.", "example": "version", "type": [ "string", @@ -961,88 +950,124 @@ "title": "Field" }, "badge": "Iron", - "title": "Field" + "title": "Fields" + }, + "reference": { + "description": "The reference to the foreign table.", + "type": "object", + "properties": { + "resource": { + "description": "The foreign resource (table).", + "example": "schema.table", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Resource" + }, + "fields": { + "description": "The foreign resource column.", + "example": "version", + "type": "array", + "items": { + "description": "The foreign resource column.", + "example": "version", + "type": [ + "string", + "null" + ], + "badge": "Iron", + "title": "Field" + }, + "badge": "Iron", + "title": "Field" + } + }, + "badge": "Iron", + "title": "Reference", + "additionalProperties": false } }, - "badge": "Iron", - "title": "Reference", + "title": "Foreign Key", "additionalProperties": false - } + }, + "badge": "Iron", + "title": "Foreign Keys" + } + }, + "title": "Schema", + "additionalProperties": false + }, + "dialect": { + "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + "type": "object", + "properties": { + "delimiter": { + "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", + "example": ",", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Delimiter" }, - "title": "Foreign Key", - "additionalProperties": false + "decimalSeparator": { + "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", + "example": ".", + "type": [ + "string", + "null" + ], + "badge": "Silver", + "title": "Decimal separator" + } }, - "badge": "Iron", - "title": "Foreign Keys" + "additionalProperties": false, + "title": "Dialect", + "options": { + "hidden": true + } } - }, - "title": "Schema", - "additionalProperties": false - }, - "dialect": { - "description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".", + } + } + }, + "review": { + "review": { + "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", "type": "object", "properties": { - "delimiter": { - "description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).", - "example": ",", + "path": { + "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", + "example": "https://www.example.com", "type": [ "string", "null" ], - "badge": "Silver", - "title": "Delimiter" + "badge": null, + "title": "Path" }, - "decimalSeparator": { - "description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".", - "example": ".", + "badge": { + "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", + "example": "Platinum", "type": [ "string", "null" ], - "badge": "Silver", - "title": "Decimal separator" + "badge": null, + "title": "Badge" } }, "additionalProperties": false, - "title": "Dialect", + "title": "Review", "options": { "hidden": true } } } }, - "review": { - "description": "Data uploaded through the OEP needs to go through review. The review will cover the areas described here: https://github.com/OpenEnergyPlatform/data-preprocessing/wiki and carried out by a team of the platform. The review itself is documented at the specified path and a badge is rewarded with regards to completeness.", - "type": "object", - "properties": { - "path": { - "description": "A URL or path string, that should be a permanent http(s) address directly linking to the documented review.", - "example": "https://www.example.com", - "type": [ - "string", - "null" - ], - "badge": null, - "title": "Path" - }, - "badge": { - "description": "A badge of either Bronze, Silver, Gold or Platinum is used to label the given metadata based on its quality.", - "example": "Platinum", - "type": [ - "string", - "null" - ], - "badge": null, - "title": "Badge" - } - }, - "additionalProperties": false, - "title": "Review", - "options": { - "hidden": true - } - } + "title": "Resources" }, "metaMetadata": { "description": "Object. Description about the metadata themselves, their format, version and license. These fields should already be provided when you\u2019re filling out your metadata.", diff --git a/metadata/v200_draft/template.json b/metadata/v200_draft/template.json index e69de29b..06d0cf53 100644 --- a/metadata/v200_draft/template.json +++ b/metadata/v200_draft/template.json @@ -0,0 +1,16 @@ +{ + "name": "", + "title": "", + "collectionId": "", + "resources": [ + null + ], + "metaMetadata": { + "metadataVersion": "", + "metadataLicense": { + "name": "", + "title": "", + "path": "" + } + } +} \ No newline at end of file From 239687c230689dccdacf540597ea5da898739447 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 19:13:17 +0200 Subject: [PATCH 32/33] increase allowed line len --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index bc4a826e..4e3c49c1 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,4 @@ skipsdist = True deps = -r {toxinidir}/requirements.txt commands = pytest - black --check --line-length 150 --diff . + black --check --line-length 180 --diff . From 2927dd2e09fc66603464a5d17266c3e8f247cb07 Mon Sep 17 00:00:00 2001 From: Jonas Huber Date: Tue, 16 Jul 2024 19:16:52 +0200 Subject: [PATCH 33/33] remove line len check --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 4e3c49c1..f1a97c3a 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,3 @@ skipsdist = True deps = -r {toxinidir}/requirements.txt commands = pytest - black --check --line-length 180 --diff .