From 91fe42d5aaad7990478944d7d4f3ef058caaaeb3 Mon Sep 17 00:00:00 2001 From: Scott Black Date: Mon, 15 May 2023 10:42:31 -0600 Subject: [PATCH 01/11] remove unused schemas --- dspback/schemas/earthchem/__init__.py | 0 dspback/schemas/earthchem/defaults.json | 1 - dspback/schemas/earthchem/schema.json | 868 ----------------------- dspback/schemas/earthchem/uischema.json | 168 ----- dspback/schemas/hydroshare/defaults.json | 5 - dspback/schemas/hydroshare/schema.json | 775 -------------------- dspback/schemas/hydroshare/uischema.json | 254 ------- dspback/schemas/jsonld_conversion.py | 64 -- dspback/schemas/zenodo/__init__.py | 0 dspback/schemas/zenodo/defaults.json | 5 - dspback/schemas/zenodo/schema.json | 531 -------------- dspback/schemas/zenodo/uischema.json | 139 ---- 12 files changed, 2810 deletions(-) delete mode 100644 dspback/schemas/earthchem/__init__.py delete mode 100644 dspback/schemas/earthchem/defaults.json delete mode 100644 dspback/schemas/earthchem/schema.json delete mode 100644 dspback/schemas/earthchem/uischema.json delete mode 100644 dspback/schemas/hydroshare/defaults.json delete mode 100644 dspback/schemas/hydroshare/schema.json delete mode 100644 dspback/schemas/hydroshare/uischema.json delete mode 100644 dspback/schemas/jsonld_conversion.py delete mode 100644 dspback/schemas/zenodo/__init__.py delete mode 100644 dspback/schemas/zenodo/defaults.json delete mode 100644 dspback/schemas/zenodo/schema.json delete mode 100644 dspback/schemas/zenodo/uischema.json diff --git a/dspback/schemas/earthchem/__init__.py b/dspback/schemas/earthchem/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dspback/schemas/earthchem/defaults.json b/dspback/schemas/earthchem/defaults.json deleted file mode 100644 index 9e26dfe..0000000 --- a/dspback/schemas/earthchem/defaults.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/dspback/schemas/earthchem/schema.json b/dspback/schemas/earthchem/schema.json deleted file mode 100644 index 792952b..0000000 --- a/dspback/schemas/earthchem/schema.json +++ /dev/null @@ -1,868 +0,0 @@ -{ - "title": "Record", - "type": "object", - "properties": { - "title": { - "title": "Dataset Title", - "description": "A descriptive title of the dataset", - "type": "string" - }, - "datePublished": { - "title": "Release Date", - "description": "The date of the files contained in the resource to be allowed for downloading", - "type": "string", - "format": "date", - "options": { - "placeholder": "YYYY-MM-DD", - "max": { "amount": 2, "unit": "year" }, - "min": "today", - "default": { "amount": 3, "unit": "day" } - } - }, - "description": { - "title": "Abstract or Description", - "type": "string", - "description": "Describe measurements, location, and purpose of the dataset", - "maxLength": 250 - }, - "community": { - "title": "Community", - "type": "string", - "default": "CZNet", - "const": "CZNet", - "readOnly": true, - "options": { "hidden": true } - }, - "leadAuthor": { - "type": "object", - "title": "Lead Author", - "properties": { - "givenName": { - "title": "First Name", - "type": "string" - }, - "additionalName": { - "title": "Middle Name", - "type": "string" - }, - "familyName": { - "title": "Last Name", - "type": "string" - }, - "email": { - "type": "string", - "format": "email" - }, - "identifiers": { - "type": "array", - "items": { "$ref": "#/definitions/AuthorIdentifier" }, - "default": [] - } - }, - "required": [ - "familyName", - "givenName", - "email" - ] - }, - "contributors": { - "title": "Co-Authors", - "type": "array", - "maxItems": 3, - "items": { "$ref": "#/definitions/Contributor" } - }, - "type": { - "title": "Dataset Type", - "description": "The nature or genre of the resource", - "type": "string", - "default": "Dataset", - "enum": [ - "Collection", - "Dataset", - "Image", - "InteractiveResource", - "MovingImage", - "PhysicalObject", - "Service", - "Software", - "Sound", - "StillImage", - "Text" - ] - }, - "status": { - "title": "Submission status", - "type": "string", - "description": "Indication of the progress status of the resource.", - "default": "incomplete", - "options": { "hidden": true }, - "enum": [ - "incomplete", - "submitted" - ] - }, - "additionalTypes": { - "title": "Data Types", - "description": "The science domain of the content", - "type": "array", - "items": { - "type": "string", - "enum": [ - "Chemistry", - "Chemistry:ClumpedIsotope", - "Chemistry:Fluid", - "Chemistry:Gas", - "Chemistry:Rock", - "Chemistry:Sediment", - "Geochronology", - "Kinetics", - "ModelData", - "Petrography", - "Petrology", - "Petrology:Experimental", - "Petrology:Mineral", - "SampleInfo", - "SocialScience", - "Other" - ] - }, - "default": [], - "uniqueItems": true - }, - "keywords": { - "title": "Keywords", - "type": "array", - "description": "A list of non-geographic keywords. (e.g. volatiles, ultra-slow spreading ridges, mantle melting, CO2 fluxes)", - "default": ["CZNet"], - "minItems": 2, - "contains": { - "enum": ["CZNet"] - }, - "items": { - "type": "string" - } - }, - "language": { - "type": "string" - }, - "spatialCoverage": { - "$ref": "#/definitions/SpatialCoverage" - }, - "relatedResources": { - "title": "Related Resources", - "type": "array", - "items": { - "$ref": "#/definitions/RelatedResource" - } - }, - "fundings": { - "title": "Funding Source", - "description": "Source of grants/awards which have funded the resource", - "type": "array", - "items": { - "title": "Funding Source", - "options": { "flat": true }, - "required": [ - "identifier", - "funder" - ], - "anyOf": [ - { - "title": "Select one", - "options": { - "dropdown": true, - "flat": true, - "title": "Funder", - "description": "Name of the agency or organization that funded the creation of the resource" - }, - "anyOf": [ - { - "type": "object", - "title": "National Science Foundation", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "NSF" }, - "const": { "alternateName": "NSF" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/021nxhr62", - "const": "https://ror.org/021nxhr62", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Alfred P. Sloan Foundation", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "SLOAN" }, - "const": { "alternateName": "SLOAN" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/052csg198", - "const": "https://ror.org/052csg198", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "U.S. Department of Energy", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "DOE" }, - "const": { "alternateName": "DOE" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/01bj3aw27", - "const": "https://ror.org/01bj3aw27", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "National Aeronautics and Space Administration", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "NASA" }, - "const": { "alternateName": "NASA" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/027ka1x80", - "const": "https://ror.org/027ka1x80", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "European Research Council", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "ERC" }, - "const": { "alternateName": "ERC" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/0472cxd90", - "const": "https://ror.org/0472cxd90", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Deutsche Forschungsgemeinschaft", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "DFG" }, - "const": { "alternateName": "DFG" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/018mejw64", - "const": "https://ror.org/018mejw64", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "National Natural Science Foundation of China", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "NSFC" }, - "const": { "alternateName": "NSFC" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/01h0zpd94", - "const": "https://ror.org/01h0zpd94", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Australian Research Council", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "ARC" }, - "const": { "alternateName": "ARC" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/05mmh0f86", - "const": "https://ror.org/05mmh0f86", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Russian Science Foundation", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "RSCF" }, - "const": { "alternateName": "RSCF" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/03y2gwe85", - "const": "https://ror.org/03y2gwe85", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Natural Environment Research Council", - "properties": { - "identifier": { - "type": "string", - "title": "Award Number" - }, - "funder": { - "type": "object", - "options": { "hidden": true }, - "default": { "alternateName": "NERC" }, - "const": { "alternateName": "NERC" }, - "properties": { - "alternateName": { - "type": "string" - } - } - }, - "url": { - "type": "string", - "default": "https://ror.org/02b5d8509", - "const": "https://ror.org/02b5d8509", - "options": { "hidden": true } - } - } - } - ] - }, - { - "type": "object", - "title": "Other", - "properties": { - "identifier": { - "type": "string", - "title": "Funding Source", - "description": "Please enter other funding sources in the format of: Funding Source Name (012345)" - }, - "funder": { - "title": "Funder", - "description": "A person or organization that provides money for a particular purpose", - "type": "object", - "const": { "alternateName": "Other" }, - "default": { "alternateName": "Other" }, - "options": { "hidden": true }, - "properties": { - "alternateName": { - "type": "string" - } - } - } - } - } - ], - "errorMessage": { - "anyOf": "selected item is incomplete" - } - } - }, - "license": { - "$ref": "#/definitions/License" - } - }, - "required": [ - "datePublished", - "title", - "description", - "keywords", - "leadAuthor", - "spatialCoverage", - "additionalTypes", - "community", - "type", - "status" - ], - "definitions": { - "Affiliation": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "identifiers": { - "type": "array", - "items": { - "$ref": "#/definitions/Identifier" - } - } - }, - "title": "Affiliation" - }, - "Contributor": { - "type": "object", - "title": "Co-Author", - "properties": { - "givenName": { - "title": "First Name", - "type": "string" - }, - "additionalName": { - "title": "Middle Name", - "type": "string" - }, - "familyName": { - "title": "Last Name", - "type": "string" - }, - "email": { - "type": "string", - "format": "email" - }, - "identifiers": { - "type": "array", - "items": { "$ref": "#/definitions/AuthorIdentifier" } - } - }, - "required": [ - "familyName", - "givenName" - ] - }, - - "Cordinate": { - "type": "object", - "properties": { - "lat": { - "type": "number" - }, - "lon": { - "type": "number" - }, - "alt": { - "type": "number" - } - }, - "title": "Cordinate" - }, - "Feature": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "geometry": { - "$ref": "#/definitions/Geometry" - } - }, - "title": "Feature" - }, - "FileResponse": { - "type": "object", - "properties": { - "fileName": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "title": "FileResponse" - }, - "Geometry": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Point", - "LineString", - "Polygon" - ] - }, - "cordinates": { - "type": "array", - "items": { - "$ref": "#/definitions/Cordinate" - } - } - }, - "title": "Geometry" - }, - "Identifier": { - "type": "object", - "properties": { - "scheme": { - "type": "string" - }, - "identifier": { - "type": "string" - } - }, - "title": "Identifier" - }, - "AuthorIdentifier": { - "title": "Identifier", - "type": "object", - "properties": { - "scheme": { - "type": "string", - "default": "ORCID", - "const": "ORCID", - "readOnly": true, - "options": { "hidden": true } - }, - "schemeURI": { - "type": "string", - "default": "https://orcid.org/", - "const": "https://orcid.org/", - "readOnly": true, - "options": { "hidden": true } - }, - "identifier": { - "title": "ORCID", - "type": "string", - "pattern": "\\b\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]\\b", - "options": { - "placeholder": "e.g. '0000-0001-2345-6789'" - }, - "errorMessage": { - "pattern": "must match the ORCID pattern. e.g. '0000-0001-2345-6789'" - } - } - } - }, - "License": { - "title": "License", - "type": "object", - "options": { "dropdown": true, "flat": true }, - "anyOf": [ - { - "title": "(CC-BY-NC-SA-3.0) - Creative Commons Attribution-NonCommercial-Share Alike 3.0 United States", - "properties": { - "alternateName": { - "type": "string", - "default": "CC-BY-NC-SA-3.0", - "const": "CC-BY-NC-SA-3.0", - "options": { "hidden": true } - } - } - }, - { - "title": "(CC-BY-4.0) - Creative Commons Attribution 4.0 International", - "properties": { - "alternateName": { - "type": "string", - "default": "CC-BY-4.0", - "const": "CC-BY-4.0", - "options": { "hidden": true } - } - } - }, - { - "title": "(CC-BY-SA-4.0) - Creative Commons Attribution-ShareAlike 4.0 International", - "properties": { - "alternateName": { - "type": "string", - "default": "CC-BY-SA-4.0", - "const": "CC-BY-SA-4.0", - "options": { "hidden": true } - } - } - }, - { - "title": "(CC-BY-NC-SA-4.0) - Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", - "properties": { - "alternateName": { - "type": "string", - "default": "CC-BY-NC-SA-4.0", - "const": "CC-BY-NC-SA-4.0", - "options": { "hidden": true } - } - } - }, - { - "title": "(CC0-1.0) - Creative Commons No Rights Reserved", - "properties": { - "alternateName": { - "type": "string", - "default": "CC0-1.0", - "const": "CC0-1.0", - "options": { "hidden": true } - } - } - } - ], - "errorMessage": { - "anyOf": "selected item is incomplete" - } - }, - "RecordFile": { - "type": "object", - "properties": { - "checkum": { - "type": "string" - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - }, - "name": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "serverName": { - "type": "string" - }, - "size": { - "type": "integer", - "format": "int64" - }, - "uploadDate": { - "type": "string" - } - }, - "title": "RecordFile" - }, - "RelatedResource": { - "title": "Related Resource", - "type": "object", - "required": ["identifiers"], - "properties": { - "identifiers": { - "title": "Related Information", - "type": "array", - "items": { - "title": "Related Information", - "options": { "flat": true, "dropdown": true }, - "maxItems": 1, - "required": ["identifier"], - "anyOf": [ - { - "type": "object", - "title": "(DOI) - Publication DOI", - "description": "Select a related identifier from the dropdown", - "properties": { - "scheme": { - "type": "string", - "default": "DOI", - "const": "DOI", - "readOnly": true, - "options": { "hidden": true } - }, - "identifier": { - "type": "string", - "title": "Publication DOI", - "description": "Enter most relevant publication DOI(s). e.g. '10.016/j.epsl.2009.11.018'", - "options": { - "placeholder": "e.g. '10.016/j.epsl.2009.11.018'" - } - } - } - }, - { - "type": "object", - "title": "(IGSN) - International Geo Sample Number", - "description": "Select a related identifier from the dropdown", - "properties": { - "scheme": { - "type": "string", - "default": "IGSN", - "const": "IGSN", - "readOnly": true, - "options": { "hidden": true } - }, - "identifier": { - "type": "string", - "title": "IGSN", - "description": "Provide IGSNs for your samples separated by commas." - } - } - }, - { - "type": "object", - "title": "(R2R) - Cruise DOI", - "description": "Select a related identifier from the dropdown", - "properties": { - "scheme": { - "type": "string", - "default": "OCDOI", - "const": "OCDOI", - "readOnly": true, - "options": { "hidden": true } - }, - "identifier": { - "type": "string", - "title": "Cruise DOI", - "description": "Provide Cruise DOIs corresponding to your samples." - } - } - }, - { - "type": "object", - "title": "(SVN) - Smithsonian Volcano Number", - "description": "Select a related identifier from the dropdown", - "properties": { - "scheme": { - "type": "string", - "default": "VNum", - "const": "VNum", - "readOnly": true, - "options": { "hidden": true } - }, - "identifier": { - "type": "string", - "title": "Smithsonian Volcano Number", - "description": "Provide volcano numbers corresponding to your sample collection site." - } - } - } - ], - "errorMessage": { - "anyOf": "selected item is incomplete" - } - } - } - } - }, - "SpatialCoverage": { - "title": "Spatial Coverage Information", - "type": "object", - "properties": { - "coverage": { - "title": "Spatial Coverage", - "type": "string", - "enum": [ - "Global", - "Regional (Continents, Oceans)", - "Space/Planetary" - ] - }, - "keywords": { - "title": "Geographic Keywords", - "type": "array", - "items": { - "type": "string" - }, - "description": "Provide appropriate geographic keywords for searches. (e.g. Pacific Ocean, Aleutian Islands)" - } - }, - "required": ["coverage"] - } - } -} \ No newline at end of file diff --git a/dspback/schemas/earthchem/uischema.json b/dspback/schemas/earthchem/uischema.json deleted file mode 100644 index 9a4de33..0000000 --- a/dspback/schemas/earthchem/uischema.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "type": "VerticalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/status" - }, - { - "type": "Group", - "label": "Data File Release Information", - "description": "The maximum date in the future is two years forward from the date of dataset submission. Before the release date, its metadata will be available and searchable in the EarthChem Library, but the data file will not be available for download.", - "elements": [ - { - "type": "Control", - "scope": "#/properties/datePublished" - } - ] - }, - { - "type": "Group", - "label": "Basic Information", - "elements": [ - { - "type": "Control", - "scope": "#/properties/title" - }, - { - "type": "Control", - "scope": "#/properties/description", - "options": { - "multi": true - } - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/type" - }, - { - "type": "Control", - "scope": "#/properties/additionalTypes" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/keywords" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/community" - }, - { - "type": "Control", - "scope": "#/properties/leadAuthor", - "options": { - "detail": { - "type": "Object", - "elements": [ - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/givenName" - }, - { - "type": "Control", - "scope": "#/properties/additionalName" - }, - { - "type": "Control", - "scope": "#/properties/familyName" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/email" - }, - { - "type": "Control", - "scope": "#/properties/identifiers", - "options": { "useTableLayout": true } - } - ] - } - } - }, - { - "type": "Control", - "scope": "#/properties/contributors", - "options": { - "showSortButtons": true, - "restrict": true, - "elementLabelProp": ["givenName", "additionalName", "familyName"], - "detail": { - "type": "VerticalLayout", - "elements": [ - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/givenName" - }, - { - "type": "Control", - "scope": "#/properties/additionalName" - }, - { - "type": "Control", - "scope": "#/properties/familyName" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/email" - }, - { - "type": "Control", - "scope": "#/properties/identifiers", - "options": { "useTableLayout": true } - } - ] - } - } - }, - { - "type": "Control", - "scope": "#/properties/spatialCoverage" - }, - { - "type": "Control", - "scope": "#/properties/relatedResources", - "options": { - "elementLabelProp": "-", - "childLabelProp": "-", - "detail": { - "type": "Control", - "scope": "#/properties/identifiers", - "options": { - "restrict": true, - "elementLabelProp": "scheme", - "childLabelProp": "scheme" - } - } - } - }, - { - "type": "Control", - "scope": "#/properties/fundings", - "options": { - "elementLabelProp": "identifier", - "childLabelProp": "identifier" - } - }, - { - "type": "Control", - "scope": "#/properties/license" - } - ] -} \ No newline at end of file diff --git a/dspback/schemas/hydroshare/defaults.json b/dspback/schemas/hydroshare/defaults.json deleted file mode 100644 index 56b641c..0000000 --- a/dspback/schemas/hydroshare/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rights": { - "license": "Creative Commons Attribution CC BY" - } -} \ No newline at end of file diff --git a/dspback/schemas/hydroshare/schema.json b/dspback/schemas/hydroshare/schema.json deleted file mode 100644 index b7de32e..0000000 --- a/dspback/schemas/hydroshare/schema.json +++ /dev/null @@ -1,775 +0,0 @@ -{ - "title": "Resource Metadata", - "description": "A class used to represent the metadata for a resource", - "type": "object", - "properties": { - "title": { - "title": "Title", - "description": "A string containing the name given to a resource", - "maxLength": 300, - "type": "string" - }, - "abstract": { - "title": "Abstract", - "description": "A string containing a summary of a resource", - "type": "string" - }, - "subjects": { - "title": "Subject keywords", - "description": "A list of keyword strings expressing the topic of a resource", - "default": ["CZNet"], - "minItems": 2, - "contains": { - "enum": ["CZNet"] - }, - "type": "array", - "items": { - "type": "string" - } - }, - "creators": { - "title": "Creators", - "description": "A list of Creator objects indicating the entities responsible for creating a resource", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/Creator" - } - }, - "contributors": { - "title": "Contributors", - "description": "A list of Contributor objects indicating the entities that contributed to a resource", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/Contributor" - } - }, - "relations": { - "title": "Related resources", - "description": "A list of Relation objects representing resources related to a described resource", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/Relation" - } - }, - "additional_metadata": { - "title": "Additional metadata", - "description": "A dictionary containing key-value pair metadata associated with a resource", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/AdditionalMetadata" - } - }, - "rights": { - "title": "Rights", - "description": "An object containing information about rights held in and over a resource", - "required": [ - "statement", - "url" - ], - "anyOf": [ - { - "title": "Choose a License", - "options": { - "dropdown": true, - "flat": true, - "title": "License" - }, - "required": [ - "license" - ], - "default": { - "license": "Creative Commons Attribution CC BY", - "statement": "This resource is shared under the Creative Commons Attribution CC BY.", - "url": "http://creativecommons.org/licenses/by/4.0/" - }, - "anyOf": [ - { - "type": "object", - "title": "Creative Commons Attribution CC BY", - "properties": { - "license": { - "type": "string", - "const": "Creative Commons Attribution CC BY", - "default": "Creative Commons Attribution CC BY", - "options": { "hidden": true } - }, - "statement": { - "type": "string", - "const": "This resource is shared under the Creative Commons Attribution CC BY.", - "default": "This resource is shared under the Creative Commons Attribution CC BY.", - "options": { "hidden": true } - }, - "url": { - "type": "string", - "const": "http://creativecommons.org/licenses/by/4.0/", - "default": "http://creativecommons.org/licenses/by/4.0/", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Creative Commons Attribution-ShareAlike CC BY-SA", - "properties": { - "license": { - "type": "string", - "const": "Creative Commons Attribution-ShareAlike CC BY-SA", - "default": "Creative Commons Attribution-ShareAlike CC BY-SA", - "options": { "hidden": true } - }, - "statement": { - "type": "string", - "const": "This resource is shared under the Creative Commons Attribution-ShareAlike CC BY-SA.", - "default": "This resource is shared under the Creative Commons Attribution-ShareAlike CC BY-SA.", - "options": { "hidden": true } - }, - "url": { - "type": "string", - "const": "http://creativecommons.org/licenses/by-sa/4.0/", - "default": "http://creativecommons.org/licenses/by-sa/4.0/", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Creative Commons Attribution-NoDerivs CC BY-ND", - "properties": { - "license": { - "type": "string", - "const": "Creative Commons Attribution-NoDerivs CC BY-ND", - "default": "Creative Commons Attribution-NoDerivs CC BY-ND", - "options": { "hidden": true } - }, - "statement": { - "type": "string", - "const": "This resource is shared under the Creative Commons Attribution-NoDerivs CC BY-ND.", - "default": "This resource is shared under the Creative Commons Attribution-NoDerivs CC BY-ND.", - "options": { "hidden": true } - }, - "url": { - "type": "string", - "const": "http://creativecommons.org/licenses/by-nd/4.0/", - "default": "http://creativecommons.org/licenses/by-nd/4.0/", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA", - "properties": { - "license": { - "type": "string", - "const": "Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA", - "default": "Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA", - "options": { "hidden": true } - }, - "statement": { - "type": "string", - "const": "This resource is shared under the Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA.", - "default": "This resource is shared under the Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA.", - "options": { "hidden": true } - }, - "url": { - "type": "string", - "const": "http://creativecommons.org/licenses/by-nc-sa/4.0/", - "default": "http://creativecommons.org/licenses/by-nc-sa/4.0/", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Creative Commons Attribution-NoCommercial CC BY-NC", - "properties": { - "license": { - "type": "string", - "const": "Creative Commons Attribution-NoCommercial CC BY-NC", - "default": "Creative Commons Attribution-NoCommercial CC BY-NC", - "options": { "hidden": true } - }, - "statement": { - "type": "string", - "const": "This resource is shared under the Creative Commons Attribution-NoCommercial CC BY-NC.", - "default": "This resource is shared under the Creative Commons Attribution-NoCommercial CC BY-NC.", - "options": { "hidden": true } - }, - "url": { - "type": "string", - "const": "http://creativecommons.org/licenses/by-nc/4.0/", - "default": "http://creativecommons.org/licenses/by-nc/4.0/", - "options": { "hidden": true } - } - } - }, - { - "type": "object", - "title": "Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND", - "properties": { - "license": { - "type": "string", - "const": "Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND", - "default": "Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND", - "options": { "hidden": true } - - }, - "statement": { - "type": "string", - "const": "This resource is shared under the Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND.", - "default": "This resource is shared under the Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND.", - "options": { "hidden": true } - }, - "url": { - "type": "string", - "const": "http://creativecommons.org/licenses/by-nc/4.0/", - "default": "http://creativecommons.org/licenses/by-nc/4.0/", - "options": { "hidden": true } - } - } - } - ] - }, - { - "title": "Custom License", - "description": "An object containing information about rights held in an over a resource", - "type": "object", - "properties": { - "statement": { - "title": "Statement", - "description": "A string containing the text of the license or rights statement", - "type": "string" - }, - "url": { - "type": "string", - "title": "URL", - "description": "URL pointing to a description of the license or rights statement", - "minLength": 1, - "maxLength": 65536, - "pattern": "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$", - "errorMessage": { - "pattern": "must match format \"url\"" - } - } - } - } - ], - "errorMessage": { - "anyOf": "selected item is incomplete" - } - }, - "awards": { - "title": "Funding agency information", - "description": "A list of objects containing information about the funding agencies and awards associated with a resource", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/AwardInfo" - } - }, - "spatial_coverage": { - "title": "Spatial coverage", - "description": "An object containing information about the spatial topic of a resource, the spatial applicability of a resource, or jurisdiction under with a resource is relevant", - "anyOf": [ - { - "title": "Point Coverage Metadata", - "description": "A class used to represent geographic coverage metadata for a resource or aggregation expressed as a\npoint location", - "type": "object", - "options": { - "detail": { - "type": "VerticalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/name" - }, - { - "type": "MapLayout", - "options": { - "map": { "type": "point", "north": "north", "east": "east" } - }, - "elements": [ - { - "type": "Control", - "scope": "#/properties/east" - }, - { - "type": "Control", - "scope": "#/properties/north" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/units" - }, - { - "type": "Control", - "scope": "#/properties/projection" - } - ] - } - }, - "properties": { - "name": { - "title": "Name", - "description": "A string containing a name for the place associated with the geographic coverage", - "type": "string" - }, - "east": { - "title": "East", - "description": "The coordinate of the point location measured in the east direction (between -180 and 180)", - "exclusiveMinimum": -180, - "exclusiveMaximum": 180, - "type": "number" - }, - "north": { - "title": "North", - "description": " The coordinate of the point location measured in the north direction (between -90 and 90)", - "exclusiveMinimum": -90, - "exclusiveMaximum": 90, - "type": "number" - }, - "units": { - "title": "Units", - "description": "The units applying to the unlabelled numeric values of north and east", - "type": "string", - "default": "Decimal degrees", - "const": "Decimal degrees", - "readOnly": true - }, - "projection": { - "title": "Projection", - "description": "The name of the projection used with any parameters required, such as ellipsoid parameters, datum, standard parallels and meridians, zone, etc.", - "type": "string", - "default": "WGS 84 EPSG:4326", - "const": "WGS 84 EPSG:4326", - "readOnly": true - } - }, - "required": [ - "east", - "north" - ] - }, - { - "title": "Box Coverage Metadata", - "description": "A class used to represent geographic coverage metadata for a resource or aggregation expressed as a\nlatitude-longitude bounding box", - "type": "object", - "options": { - "detail": { - "type": "VerticalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/name" - }, - { - "type": "MapLayout", - "options": { - "map": { "type": "box", "northlimit": "northlimit", "eastlimit": "eastlimit", "southlimit": "southlimit", "westlimit": "westlimit" } - }, - "elements": [ - { - "type": "Control", - "scope": "#/properties/northlimit" - }, - { - "type": "Control", - "scope": "#/properties/eastlimit" - }, - { - "type": "Control", - "scope": "#/properties/southlimit" - }, - { - "type": "Control", - "scope": "#/properties/westlimit" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/units" - }, - { - "type": "Control", - "scope": "#/properties/projection" - } - - ] - } - }, - "properties": { - "name": { - "title": "Name", - "description": "A string containing a name for the place associated with the geographic coverage", - "type": "string" - }, - "northlimit": { - "title": "North limit", - "description": "A floating point value containing the constant coordinate for the northernmost face or edge of the bounding box (between -90 and 90)", - "exclusiveMinimum": -90, - "exclusiveMaximum": 90, - "type": "number" - }, - "eastlimit": { - "title": "East limit", - "description": "A floating point value containing the constant coordinate for the easternmost face or edge of the bounding box (between -180 and 180)", - "exclusiveMinimum": -180, - "exclusiveMaximum": 180, - "type": "number" - }, - "southlimit": { - "title": "South limit", - "description": "A floating point value containing the constant coordinate for the southernmost face or edge of the bounding box (between -90 and 90)", - "exclusiveMinimum": -90, - "exclusiveMaximum": 90, - "type": "number" - }, - "westlimit": { - "title": "West limit", - "description": "A floating point value containing the constant coordinate for the westernmost face or edge of the bounding box (between -180 and 180)", - "exclusiveMinimum": -180, - "exclusiveMaximum": 180, - "type": "number" - }, - "units": { - "title": "Units", - "description": "A string containing the units applying to the unlabelled numeric values of northlimit, eastlimit, southlimit, and westlimit", - "type": "string", - "default": "Decimal degrees", - "const": "Decimal degrees", - "readOnly": true - }, - "projection": { - "title": "Projection", - "description": "A string containing the name of the projection used with any parameters required, such as ellipsoid parameters, datum, standard parallels and meridians, zone, etc.", - "type": "string", - "default": "WGS 84 EPSG:4326", - "const": "WGS 84 EPSG:4326", - "readOnly": true - } - }, - "required": [ - "northlimit", - "eastlimit", - "southlimit", - "westlimit" - ] - } - ], - "errorMessage": { - "anyOf": "selected item is incomplete" - } - }, - "period_coverage": { - "title": "Temporal coverage", - "description": "An object containing information about the temporal topic or applicability of a resource", - "$ref": "#/definitions/PeriodCoverage" - }, - "publisher": { - "title": "Publisher", - "description": "An object containing information about the publisher of a resource", - "allOf": [ - { - "$ref": "#/definitions/Publisher" - } - ] - }, - "citation": { - "title": "Citation", - "description": "A string containing the biblilographic citation for a resource", - "type": "string", - "readOnly": true - } - }, - "required": [ - "title", - "abstract", - "subjects", - "awards", - "rights" - ], - "definitions": { - "Creator": { - "title": "Creator Metadata", - "description": "A class used to represent the metadata associated with a creator of a resource", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "A string containing the name of the creator", - "maxLength": 100, - "type": "string", - "options": { - "placeholder": "e.g. 'Horsburgh, Jeffery S.'" - } - }, - "phone": { - "title": "Phone", - "description": "A string containing a phone number for the creator", - "maxLength": 25, - "type": "string", - "options": { - "placeholder": "Phone: e.g., (435) 797-2946" - } - }, - "address": { - "title": "Address", - "description": "A string containing an address for the creator", - "maxLength": 250, - "type": "string", - "options": { - "placeholder": "e.g., 8200 Old Main Hill, Logan, UT 84322-8200" - } - }, - "organization": { - "title": "Organization", - "description": "A string containing the name of the organization with which the creator is affiliated", - "maxLength": 200, - "type": "string", - "options": { - "placeholder": "e.g. 'Utah State University'" - } - }, - "email": { - "title": "Email", - "description": "A string containing an email address for the creator", - "type": "string", - "format": "email", - "options": { - "placeholder": "e.g. 'jeff.horsburgh@usu.edu'" - } - }, - "homepage": { - "$ref": "#/definitions/UrlPattern" - }, - "profile_url": { - "$ref": "#/definitions/ProfileUrlPattern" - } - }, - "required": ["name"] - }, - "Contributor": { - "title": "Contributor Metadata", - "description": "A class used to represent the metadata associated with a contributor to a resource", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "A string containing the name of the contributor", - "type": "string", - "maxLength": 100, - "options": { - "placeholder": "e.g. 'Horsburgh, Jeffery S.'" - } - }, - "phone": { - "title": "Phone", - "description": "A string containing a phone number for the contributor", - "maxLength": 25, - "type": "string", - "options": { - "placeholder": "Phone: e.g., (435) 797-2946" - } - }, - "address": { - "title": "Address", - "description": "A string containing an address for the contributor", - "maxLength": 250, - "type": "string", - "options": { - "placeholder": "e.g., 8200 Old Main Hill, Logan, UT 84322-8200" - } - }, - "organization": { - "title": "Organization", - "description": "A string containing the name of the organization with which the contributor is affiliated", - "maxLength": 200, - "type": "string", - "options": { - "placeholder": "e.g. 'Utah State University'" - } - }, - "email": { - "title": "Email", - "description": "A string containing an email address for the contributor", - "type": "string", - "format": "email", - "options": { - "placeholder": "e.g. 'jeff.horsburgh@usu.edu'" - } - }, - "homepage": { - "$ref": "#/definitions/UrlPattern" - }, - "profile_url": { - "$ref": "#/definitions/ProfileUrlPattern" - } - }, - "required": ["name"] - }, - "Relation": { - "title": "Related Resource Metadata", - "description": "A class used to represent the metadata associated with a resource related to the resource being described", - "type": "object", - "properties": { - "type": { - "title": "RelationType", - "description": "An enumeration.", - "enum": [ - "The content of this resource is part of", - "This resource includes", - "The content of this resource was created by a related App or software program", - "The content of this resource was created by", - "This resource updates and replaces a previous version", - "This resource has been replaced by a newer version", - "This resource is described by", - "This resource conforms to established standard described by", - "This resource has a related resource in another format", - "This resource is a different format of", - "This resource is required by", - "This resource requires", - "This resource is referenced by", - "The content of this resource references", - "This resource replaces", - "The content of this resource is derived from" - ], - "type": "string" - }, - "value": { - "title": "Value", - "description": "String expressing the Full text citation, URL link for, or description of the related resource", - "maxLength": 500, - "type": "string" - } - }, - "required": [ - "type", - "value" - ] - }, - "AdditionalMetadata": { - "title": "Key-Value", - "description": "A key-value pair", - "type": "object", - "properties": { - "key": { - "title": "Key", - "type": "string" - }, - "value": { - "title": "Value", - "type": "string" - } - }, - "required": [ - "key", - "value" - ] - }, - "AwardInfo": { - "title": "Funding Agency Metadata", - "description": "A class used to represent the metadata associated with funding agency credits for a resource", - "type": "object", - "properties": { - "funding_agency_name": { - "title": "Agency name", - "description": "A string containing the name of the funding agency or organization", - "type": "string" - }, - "title": { - "title": "Award title", - "description": "A string containing the title of the project or award", - "type": "string" - }, - "number": { - "title": "Award number", - "description": "A string containing the award number or other identifier", - "type": "string" - }, - "funding_agency_url": { - "$ref": "#/definitions/UrlPattern" - } - }, - "required": [ - "funding_agency_name", - "number", - "title" - ] - }, - "PeriodCoverage": { - "title": "Period coverage", - "description": "A class used to represent temporal coverage metadata for a resource or aggregation", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "A string containing a name for the time interval", - "type": "string" - }, - "start": { - "title": "Start", - "description": "A datetime object containing the instant corresponding to the commencement of the time interval", - "type": "string", - "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" } - }, - "end": { - "title": "End", - "description": "A datetime object containing the instant corresponding to the termination of the time interval", - "type": "string", - "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" } - } - }, - "required": [ - "start", - "end" - ] - }, - "Publisher": { - "title": "Publisher Metadata", - "description": "A class used to represent the metadata associated with the publisher of a resource", - "type": "object", - "properties": { - "name": { - "title": "Publisher name", - "description": "A string containing the name of the publisher", - "maxLength": 200, - "type": "string" - }, - "url": { - "title": "Publisher URL", - "description": "An object containing a URL that points to the publisher website", - "minLength": 1, - "maxLength": 65536, - "$ref": "#/definitions/UrlPattern" - } - }, - "required": [ - "name", - "url" - ] - }, - "UrlPattern": { - "type": "string", - "pattern": "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$", - "errorMessage": { - "pattern": "must match format \"url\"" - } - }, - "ProfileUrlPattern": { - "type": "string", - "pattern": "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?hydroshare\\.org\\/user\\/\\d+\\/?$", - "errorMessage": { - "pattern": "must match profile link format. e.g. \"https://www.hydroshare.org/user/10/\"" - } - } - } -} \ No newline at end of file diff --git a/dspback/schemas/hydroshare/uischema.json b/dspback/schemas/hydroshare/uischema.json deleted file mode 100644 index dda79dc..0000000 --- a/dspback/schemas/hydroshare/uischema.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "type": "VerticalLayout", - "elements": [ - { - "type": "Group", - "label": "Basic Information", - "elements": [ - { - "type": "Control", - "scope": "#/properties/title" - }, - { - "type": "Control", - "scope": "#/properties/abstract", - "options": { - "multi": true, - "trim": true - } - }, - { - "type": "Control", - "scope": "#/properties/subjects" - } - ] - }, - { - "type": "Control", - "scope": "#/properties/creators", - "options": { - "elementLabelProp": ["name"], - "detail": { - "type": "VerticalLayout", - "elements": [ - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/name" - }, - { - "type": "Control", - "scope": "#/properties/email" - } - ] - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/organization" - }, - { - "type": "Control", - "scope": "#/properties/address" - } - ] - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/phone" - }, - { - "type": "Control", - "scope": "#/properties/homepage", - "options": { - "description": "URL for a website associated with the creator" - } - }, - { - "type": "Control", - "scope": "#/properties/profile_url", - "options": { - "placeholder": "e.g. 'https://www.hydroshare.org/user/10/'", - "description": "A URL for the creator's HydroShare profile" - } - } - ] - } - ] - } - } - }, - { - "type": "Control", - "scope": "#/properties/contributors", - "options": { - "elementLabelProp": ["name"], - "detail": { - "type": "VerticalLayout", - "elements": [ - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/name" - }, - { - "type": "Control", - "scope": "#/properties/email" - } - ] - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/organization" - }, - { - "type": "Control", - "scope": "#/properties/address" - } - ] - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/phone" - }, - { - "type": "Control", - "scope": "#/properties/homepage", - "options": { - "description": "URL for a website associated with the contributor" - } - }, - { - "type": "Control", - "scope": "#/properties/profile_url", - "options": { - "placeholder": "e.g. 'https://www.hydroshare.org/user/10/'", - "description": "A URL for the contributor's HydroShare profile" - } - } - ] - } - ] - } - } - }, - { - "type": "Control", - "label": "Spatial coverage", - "scope": "#/properties/spatial_coverage" - }, - { - "type": "Control", - "scope": "#/properties/period_coverage", - "options": { - "detail": { - "type": "Object", - "label": "Period coverage", - "elements": [ - { - "type": "Control", - "scope": "#/properties/name" - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/start" - }, - { - "type": "Control", - "scope": "#/properties/end" - } - ] - } - ] - } - } - }, - { - "type": "Control", - "scope": "#/properties/additional_metadata", - "options": { "useTableLayout": true } - }, - { - "type": "Control", - "scope": "#/properties/relations", - "options": { - "useTableLayout": true - } - }, - { - "type": "Control", - "scope": "#/properties/awards", - "options": { - "elementLabelProp": ["funding_agency_name"], - "detail": { - "type": "VerticalLayout", - "elements": [ - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/funding_agency_name" - }, - { - "type": "Control", - "scope": "#/properties/title" - } - ] - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/number" - }, - { - "type": "Control", - "scope": "#/properties/funding_agency_url", - "options": { - "label": "Agency URL", - "description": "URL for a website describing the funding award" - } - } - ] - } - ] - } - } - }, - { - "label": "Rights", - "type": "Control", - "scope": "#/properties/rights" - }, - { - "type": "Control", - "scope": "#/properties/citation", - "rule": { - "effect": "DISABLE", - "condition": { - "scope": "#/properties/citation" - } - } - } - ] -} \ No newline at end of file diff --git a/dspback/schemas/jsonld_conversion.py b/dspback/schemas/jsonld_conversion.py deleted file mode 100644 index 76c5fa0..0000000 --- a/dspback/schemas/jsonld_conversion.py +++ /dev/null @@ -1,64 +0,0 @@ -from geojson import Feature, Point, Polygon - -from dspback.schemas.earthchem.model import Record -from dspback.schemas.hydroshare.model import ResourceMetadata - - -def hs_convert_to_jsonld(metadata: ResourceMetadata): - def to_geojson(sc): - if hasattr(sc, 'northlimit'): - return Feature(geometry=Polygon([sc.northlimit, sc.southlimit, sc.eastlimit, sc.westlimit])) - else: - return Feature(geometry=Point([float(sc.east), float(sc.north)])) - pass - - def to_funder(f): - return { - '@type': 'Grant', - 'identifier': f.number, - 'name': f.title, - 'funder': {'@type': 'Organization', 'name': f.funding_agency_name, 'identifier': f.funding_agency_url}, - } - - return { - '@type': 'Dataset', - 'provider': {'name': "HydroShare"}, - 'name': metadata.title, - 'description': metadata.abstract, - 'keywords': metadata.subjects, - 'temporalCoverage': {'start': metadata.period_coverage.start, 'end': metadata.period_coverage.end}, - 'spatialCoverage': {'geojson': [to_geojson(metadata.spatial_coverage)]}, - 'creator': {'@list': [{'name': creator.name} for creator in metadata.creators]}, - 'license': {'@type': 'CreativeWork', 'text': metadata.rights.statement, 'url': metadata.rights.url}, - 'funding': [to_funder(award) for award in metadata.awards], - # not in the json metadata - 'datePublished': None, - } - - -def ecl_convert_to_jsonld(metadata: Record): - def to_name(author): - name = '' - if author.givenName: - name = author.givenName + ' ' - if author.additionalName: - name = name + author.additionalName + ' ' - if author.familyName: - name = name + author.familyName - return name.strip() - - return { - '@type': 'Dataset', - 'provider': {'name': "EarthChem Library"}, - 'name': metadata.title, - 'description': metadata.description, - 'keywords': metadata.keywords, - 'creator': { - '@list': [{'name': to_name(contributor)} for contributor in metadata.leadAuthor + metadata.contributors] - }, - 'license': {'@type': 'CreativeWork', 'url': metadata.license}, - 'datePublished': metadata.datePublished, - #'temporalCoverage': {'start': metadata.period_coverage.start, - # 'end': metadata.period_coverage.end}, - #'spatialCoverage': {'geojson': [to_geojson(metadata.spatial_coverage)]}, - } diff --git a/dspback/schemas/zenodo/__init__.py b/dspback/schemas/zenodo/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dspback/schemas/zenodo/defaults.json b/dspback/schemas/zenodo/defaults.json deleted file mode 100644 index 69c2cb2..0000000 --- a/dspback/schemas/zenodo/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "upload_type": "dataset", - "access_right": "open" - -} \ No newline at end of file diff --git a/dspback/schemas/zenodo/schema.json b/dspback/schemas/zenodo/schema.json deleted file mode 100644 index 9e90c98..0000000 --- a/dspback/schemas/zenodo/schema.json +++ /dev/null @@ -1,531 +0,0 @@ -{ - "title": "Zenodo Datasets Schema for CZ Net v1.0.0", - "type": "object", - "properties": { - "access_conditions": { - "title": "Access conditions", - "type": "string", - "description": "Conditions under which access is given if record is restricted." - }, - "access_right": { - "title": "Access right", - "type": "string", - "description": "Access right for record", - "default": "open", - "enum": [ - "open", - "embargoed" - ] - }, - "communities": { - "title": "Communities", - "type": "array", - "description": "List of community identifiers.", - "uniqueItems": true, - "items": { - "title": "Community identifier", - "type": "object", - "properties": { - "identifier": { - "title": "Identifier", - "type": "string", - "description": "The community identifier" - } - }, - "default": [{ "identifier": "czdata" }], - "contains": { - "enum": [{ "identifier": "czdata" }] - } - } - }, - "contributors": { - "title": "Contributors", - "type": "array", - "description": "Contributors in order of importance.", - "items": { - "title": "Contributor", - "type": "object", - "additionalProperties": false, - "properties": { - "affiliation": { - "title": "Affiliation", - "type": "string", - "description": "Affiliation for the purpose of this specific record." - }, - "name": { - "title": "Full name", - "type": "string", - "description": "Full name of person or organisation. Personal name format: family, given.", - "options": { - "placeholder": "e.g. 'Horsburgh, Jeffery S.'" - } - }, - "orcid": { - "title": "ORCID", - "description": "ORCID identifier for contributor.", - "type": "string", - "pattern": "\\b\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]\\b", - "options": { - "placeholder": "e.g. '0000-0001-2345-6789'" - }, - "errorMessage": { - "pattern": "must match the ORCID pattern. e.g. '0000-0001-2345-6789'" - } - }, - "type": { - "title": "Contribution type", - "type": "string", - "enum": [ - "ContactPerson", - "DataCollector", - "DataCurator", - "DataManager", - "Distributor", - "Editor", - "HostingInstitution", - "Other", - "Producer", - "ProjectLeader", - "ProjectManager", - "ProjectMember", - "RegistrationAgency", - "RegistrationAuthority", - "RelatedPerson", - "Researcher", - "ResearchGroup", - "RightsHolder", - "Sponsor", - "Supervisor", - "WorkPackageLeader" - ] - } - }, - "required": [ - "name", - "affiliation", - "type" - ] - } - }, - "creators": { - "title": "Creators", - "type": "array", - "description": "Creators of record in order of importance.", - "items": { - "title": "Creator", - "type": "object", - "additionalProperties": false, - "properties": { - "affiliation": { - "title": "Affiliation", - "type": "string", - "description": "Affiliation for the purpose of this specific record." - }, - "name": { - "title": "Full name", - "type": "string", - "description": "Full name of person or organisation. Personal name format: family, given.", - "options": { - "placeholder": "e.g. 'Horsburgh, Jeffery S.'" - } - }, - "orcid": { - "title": "ORCID", - "description": "ORCID identifier for creator.", - "type": "string", - "pattern": "\\b\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]\\b", - "options": { - "placeholder": "e.g. '0000-0001-2345-6789'" - }, - "errorMessage": { - "pattern": "must match the ORCID pattern. e.g. '0000-0001-2345-6789'" - } - } - }, - "required": [ - "affiliation", - "name" - ] - } - }, - "description": { - "title": "Description/Abstract", - "type": "string", - "description": "Description/abstract for record.", - "options": { "stripHTML": true } - }, - "embargo_date": { - "title": "Embargo date", - "type": "string", - "format": "date", - "description": "Embargo date of record (ISO8601 formatted date)", - "options": { "placeholder": "YYYY-MM-DD", "min": { "amount": 1, "unit": "day" } }, - "if": { - "properties": { - "access_right": { - "const": "embargoed" - } - } - }, - "then": { - "required": [ - "embargo_date" - ] - } - }, - "notes": { - "title": "Funding Agency Metadata", - "description": "Add metadata associated with funding agency credits for a resource in the format provided. Please separate multiple entries with an empty line.", - "type": "string", - "default": "Funding Agency Name: \nAward Title: \nAward Number: \nFunding Agency URL: ", - "options": { "placeholder": "Funding Agency Name: \nAward Title: \nAward Number: \nFunding Agency URL: \n\nFunding Agency Name: \nAward Title: \nAward Number: \nFunding Agency URL: " } - }, - "keywords": { - "title": "Keywords", - "type": "array", - "description": "Free text keywords.", - "minItems": 2, - "uniqueItems": true, - "items": { - "title": "Keyword", - "type": "string" - }, - "default": ["CZNet"], - "contains": { - "enum": ["CZNet"] - } - }, - "license": { - "title": "License", - "type": "string", - "description": "License for embargoed/open access content.", - "options": { "hasAutoComplete": true, "placeholder": "Start typing a license name..." }, - "oneOf": [ - { "const": "AAL", "title": "Attribution Assurance Licenses"}, - { "const": "AFL-3.0", "title": "Academic Free License 3.0"}, - { "const": "AGPL-3.0", "title": "GNU Affero General Public License v3"}, - { "const": "APL-1.0", "title": "Adaptive Public License 1.0"}, - { "const": "APSL-2.0", "title": "Apple Public Source License 2.0"}, - { "const": "Against-DRM", "title": "Against DRM"}, - { "const": "Apache-1.1", "title": "Apache Foundation"}, - { "const": "Apache-2.0", "title": "Apache Software License 2.0"}, - { "const": "Artistic-2.0", "title": "Artistic License 2.0"}, - { "const": "BSD-2-Clause", "title": "BSD 2-Clause \"Simplified\" or \"FreeBSD\" License (BSD-2-Clause)"}, - { "const": "BSD-3-Clause", "title": "BSD 3-Clause \"New\" or \"Revised\" License (BSD-3-Clause)"}, - { "const": "BSL-1.0", "title": "Boost Software License 1.0"}, - { "const": "BitTorrent-1.1", "title": "BitTorrent Open Source License 1.1"}, - { "const": "CATOSL-1.1", "title": "Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1)"}, - { "const": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0" }, - { "const": "CC-BY-NC-4.0", "title": "Creative Commons Attribution-NonCommercial 4.0" }, - { "const": "CC-BY-NC-ND-4.0", "title": "Attribution-NonCommercial-NoDerivatives 4.0 International" }, - { "const": "CC-BY-NC-SA-4.0", "title": "Attribution-NonCommercial-ShareAlike 4.0 International" }, - { "const": "CC-BY-ND-4.0", "title": "Attribution-NoDerivatives 4.0 International" }, - { "const": "CC-BY-SA-4.0", "title": "Creative Commons Attribution Share-Alike 4.0" }, - { "const": "CC0-1.0", "title": "CC0 1.0"}, - { "const": "CDDL-1.0", "title": "Common Development and Distribution License 1.0"}, - { "const": "CECILL-2.1", "title": "CeCILL License 2.1"}, - { "const": "CNRI-Python", "title": "CNRI Python License"}, - { "const": "CPAL-1.0", "title": "Common Public Attribution License 1.0"}, - { "const": "CUA-OPL-1.0", "title": "CUA Office Public License 1.0"}, - { "const": "DSL", "title": "Design Science License"}, - { "const": "ECL-2.0", "title": "Educational Community License 2.0"}, - { "const": "EFL-2.0", "title": "Eiffel Forum License 2.0"}, - { "const": "EPL-1.0", "title": "Eclipse Public License 1.0"}, - { "const": "EPL-2.0", "title": "Eclipse Public License 2.0"}, - { "const": "EUDatagrid", "title": "EU DataGrid Software License"}, - { "const": "EUPL-1.1", "title": "European Union Public License 1.1"}, - { "const": "Entessa", "title": "Entessa Public License"}, - { "const": "FAL-1.3", "title": "Free Art License 1.3"}, - { "const": "Fair", "title": "Fair License"}, - { "const": "Frameworx-1.0", "title": "Frameworx License 1.0"}, - { "const": "GFDL-1.3-no-cover-texts-no-invariant-sections", "title": "GNU Free Documentation License 1.3 with no cover texts and no invariant sections"}, - { "const": "GPL-2.0", "title": "GNU General Public License 2.0"}, - { "const": "GPL-3.0", "title": "GNU General Public License 3.0"}, - { "const": "HPND", "title": "Historical Permission Notice and Disclaimer"}, - { "const": "IPA", "title": "IPA Font License"}, - { "const": "IPL-1.0", "title": "IBM Public License 1.0"}, - { "const": "ISC", "title": "ISC License"}, - { "const": "Intel", "title": "Intel Open Source License"}, - { "const": "LGPL-2.1", "title": "GNU Lesser General Public License 2.1"}, - { "const": "LGPL-3.0", "title": "GNU Lesser General Public License 3.0"}, - { "const": "LO-FR-2.0", "title": "Open License 2.0"}, - { "const": "LPL-1.0", "title": "Lucent Public License (\"Plan9\") 1.0"}, - { "const": "LPL-1.02", "title": "Lucent Public License 1.02"}, - { "const": "LPPL-1.3c", "title": "LaTeX Project Public License 1.3c"}, - { "const": "MIT", "title": "MIT License"}, - { "const": "MPL-1.0", "title": "Mozilla Public License 1.0"}, - { "const": "MPL-1.1", "title": "Mozilla Public License 1.1"}, - { "const": "MPL-2.0", "title": "Mozilla Public License 2.0"}, - { "const": "MS-PL", "title": "Microsoft Public License"}, - { "const": "MS-RL", "title": "Microsoft Reciprocal License"}, - { "const": "MirOS", "title": "MirOS Licence"}, - { "const": "Motosoto", "title": "Motosoto License"}, - { "const": "Multics", "title": "Multics License"}, - { "const": "NASA-1.3", "title": "NASA Open Source Agreement 1.3"}, - { "const": "NCSA", "title": "University of Illinois/NCSA Open Source License"}, - { "const": "NGPL", "title": "Nethack General Public License"}, - { "const": "NPOSL-3.0", "title": "Non-Profit Open Software License 3.0"}, - { "const": "NTP", "title": "NTP License"}, - { "const": "Naumen", "title": "Naumen Public License"}, - { "const": "Nokia", "title": "Nokia Open Source License"}, - { "const": "OCLC-2.0", "title": "OCLC Research Public License 2.0"}, - { "const": "ODC-BY-1.0", "title": "Open Data Commons Attribution License 1.0"}, - { "const": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0"}, - { "const": "OFL-1.1", "title": "Open Font License 1.1"}, - { "const": "OGL-Canada-2.0", "title": "Open Government License 2.0 (Canada)"}, - { "const": "OGL-UK-1.0", "title": "Open Government Licence 1.0 (United Kingdom)"}, - { "const": "OGL-UK-2.0", "title": "Open Government Licence 2.0 (United Kingdom)"}, - { "const": "OGL-UK-3.0", "title": "Open Government Licence 3.0 (United Kingdom)"}, - { "const": "OGTSL", "title": "Open Group Test Suite License"}, - { "const": "OSL-3.0", "title": "Open Software License 3.0"}, - { "const": "PDDL-1.0", "title": "Open Data Commons Public Domain Dedication and Licence 1.0"}, - { "const": "PHP-3.0", "title": "PHP License 3.0"}, - { "const": "PostgreSQL", "title": "PostgreSQL License"}, - { "const": "Python-2.0", "title": "Python License 2.0"}, - { "const": "QPL-1.0", "title": "Q Public License 1.0"}, - { "const": "RPL-1.5", "title": "Reciprocal Public License 1.5"}, - { "const": "RPSL-1.0", "title": "RealNetworks Public Source License 1.0"}, - { "const": "RSCPL", "title": "Ricoh Source Code Public License"}, - { "const": "SISSL", "title": "Sun Industry Standards Source License 1.1"}, - { "const": "SPL-1.0", "title": "Sun Public License 1.0"}, - { "const": "SimPL-2.0", "title": "Simple Public License 2.0"}, - { "const": "Sleepycat", "title": "Sleepycat License"}, - { "const": "Talis", "title": "Talis Community License"}, - { "const": "Unlicense", "title": "Unlicense"}, - { "const": "VSL-1.0", "title": "Vovida Software License 1.0"}, - { "const": "W3C", "title": "W3C License"}, - { "const": "WXwindows", "title": "wxWindows Library License"}, - { "const": "Watcom-1.0", "title": "Sybase Open Watcom Public License 1.0"}, - { "const": "Xnet", "title": "X.Net License"}, - { "const": "ZPL-2.0", "title": "Zope Public License 2.0"}, - { "const": "Zlib", "title": "zlib/libpng license"}, - { "const": "dli-model-use", "title": "Statistics Canada: Data Liberation Initiative (DLI) - Model Data Use Licence"}, - { "const": "geogratis", "title": "Geogratis"}, - { "const": "hesa-withrights", "title": "Higher Education Statistics Agency Copyright with data.gov.uk rights"}, - { "const": "localauth-withrights", "title": "Local Authority Copyright with data.gov.uk rights"}, - { "const": "met-office-cp", "title": "Met Office UK Climate Projections Licence Agreement"}, - { "const": "mitre", "title": "MITRE Collaborative Virtual Workspace License (CVW License)"}, - { "const": "notspecified", "title": "License Not Specified"}, - { "const": "other-at", "title": "Other (Attribution)"}, - { "const": "other-closed", "title": "Other (Not Open)"}, - { "const": "other-nc", "title": "Other (Non-Commercial)"}, - { "const": "other-open", "title": "Other (Open)"}, - { "const": "other-pd", "title": "Other (Public Domain)"}, - { "const": "ukclickusepsi", "title": "UK Click Use PSI"}, - { "const": "ukcrown", "title": "UK Crown Copyright"}, - { "const": "ukcrown-withrights", "title": "UK Crown Copyright with data.gov.uk rights"}, - { "const": "ukpsi", "title": "UK PSI Public Sector Information"} - ], - "default": "CC-BY-4.0" - }, - "publication_date": { - "title": "Publication date", - "type": "string", - "description": "", - "format": "date" - }, - "references": { - "title": "References", - "type": "array", - "options": { "delimeter": false, "placeholder": "e.g. 'Cranmer, Kyle et al. (2014). Decouple software associated to arXiv:1401.0080.'" }, - "description": "Raw textual references for related publications and datasets when identifier is not known.", - "items": { - "title": "Reference string", - "type": "string", - "description": "A string providing the full reference for the related item." - } - }, - "related_identifiers": { - "title": "Related identifiers", - "type": "array", - "description": "Identifiers of related publications and datasets.", - "items": { - "type": "object", - "properties": { - "identifier": { - "title": "Identifier", - "type": "string", - "description": "Identifier of the related publication or dataset.", - "options": { - "placeholder": "e.g. '10.1234/foobar.567890'" - } - }, - "relation": { - "title": "Relationship type", - "type": "string", - "description": "The type of relationship between this item and the related item.", - "options": { "hasAutoComplete": true, "placeholder": "Start typing to autocomplete..." }, - "oneOf": [ - { "const": "isCitedBy", "title": "cites this upload"}, - { "const": "cites", "title": "is cited by this upload"}, - { "const": "isSupplementTo", "title": "is supplemented by this upload"}, - { "const": "isSupplementedBy", "title": "is a supplement to this upload"}, - { "const": "isContinuedBy", "title": "continues this upload"}, - { "const": "continues", "title": "is continued by this upload"}, - { "const": "isDescribedBy", "title": "describes this upload"}, - { "const": "describes", "title": "is described by this upload"}, - { "const": "hasMetadata", "title": "has additional metadata from this upload"}, - { "const": "isMetadataFor", "title": "is additional metadata for this upload"}, - { "const": "isNewVersionOf", "title": "is previous version of this upload"}, - { "const": "isPreviousVersionOf", "title": "is new version of this upload"}, - { "const": "isPartOf", "title": "has this upload as part"}, - { "const": "hasPart", "title": "is part of this upload"}, - { "const": "isReferencedBy", "title": "references this upload"}, - { "const": "references", "title": "is referenced by this upload"}, - { "const": "isDocumentedBy", "title": "documents this upload"}, - { "const": "documents", "title": "is documented by this upload"}, - { "const": "isCompiledBy", "title": "compiled/created this upload"}, - { "const": "compiles", "title": "is compiled/created by this upload"}, - { "const": "isVariantFormOf", "title": "is a variant or different form of this upload"}, - { "const": "isOrignialFormOf", "title": "is an original form of this upload"}, - { "const": "isIdenticalTo", "title": "is identical to this upload"}, - { "const": "isReviewedBy", "title": "reviews this upload"}, - { "const": "reviews", "title": "is reviewed by this upload"}, - { "const": "isDerivedFrom", "title": "is the source this upload is derived from"}, - { "const": "isSourceOf", "title": "has this upload as its source"}, - { "const": "requires", "title": "is required by this upload"}, - { "const": "isRequiredBy", "title": "requires this upload"}, - { "const": "isObsoletedBy", "title": "replaces this upload"}, - { "const": "obsoletes", "title": "is replaced by this upload"}, - { "const": "isPublishedIn", "title": "published this upload"} - ] - }, - "resource_type": { - "title": "Resource type", - "type": "string", - "description": "Resource type of the related identifier.", - "options": { }, - "oneOf": [ - { "const": "undefined", "title": "N/A" }, - { "const": "", "title": "", "divider": true }, - { "const": "", "title": "", "header": "Publication" }, - { "const": "publication-annotationcollection", "title": "Annotation collection" }, - { "const": "publication-book", "title": "Book" }, - { "const": "publication-section", "title": "Book section" }, - { "const": "publication-conferencepaper", "title": "Conference paper" }, - { "const": "publication-datamanagementplan", "title": "Data management plan" }, - { "const": "publication-article", "title": "Journal article" }, - { "const": "publication-other", "title": "Other" }, - { "const": "publication-patent", "title": "Patent" }, - { "const": "publication-preprint", "title": "Preprint" }, - { "const": "publication-deliverable", "title": "Project deliverable" }, - { "const": "publication-milestone", "title": "Project milestone" }, - { "const": "publication-proposal", "title": "Proposal" }, - { "const": "publication-report", "title": "Report" }, - { "const": "publication-softwaredocumentation", "title": "Software documentation" }, - { "const": "publication-taxonomictreatment", "title": "Taxonomic treatment" }, - { "const": "publication-technicalnote", "title": "Technical note" }, - { "const": "publication-thesis", "title": "Thesis" }, - { "const": "publication-workingpaper", "title": "Working paper" }, - { "const": "", "title": "", "divider": true }, - { "const": "", "title": "", "header": "Image" }, - { "const": "image-diagram", "title": "Diagram" }, - { "const": "image-drawing", "title": "Drawing" }, - { "const": "image-figure", "title": "Figure" }, - { "const": "image-other", "title": "Other" }, - { "const": "image-photo", "title": "Photo" }, - { "const": "image-plot", "title": "Plot" }, - { "const": "", "title": "", "divider": true }, - { "const": "lesson", "title": "Lesson" }, - { "const": "other", "title": "Other" }, - { "const": "physicalobject", "title": "Physical object" }, - { "const": "poster", "title": "Poster" }, - { "const": "presentation", "title": "Presentation" }, - { "const": "software", "title": "Software" }, - { "const": "video", "title": "Video/Audio" }, - { "const": "workflow", "title": "Workflow" } - ] - } - }, - "required": [ - "identifier", - "relation" - ] - } - }, - "resource_type": { - "title": "Resource type", - "type": "object", - "description": "Record resource type.", - "additionalProperties": false, - "properties": { - "openaire_subtype": { - "title": "OpenAIRE subtype", - "type": "string", - "description": "OpenAIRE-specific resource type." - }, - "subtype": { - "title": "Subtype", - "type": "string", - "description": "Specific resource type." - }, - "type": { - "title": "General resource type", - "type": "string", - "description": "General resource type.", - "default": "publication" - } - }, - "required": [ - "type" - ] - }, - "subjects": { - "title": "Subjects from specific vocabularies", - "type": "array", - "description": "Subjects from a taxonomy or controlled vocabulary.", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "identifier": { - "title": "Term identifier", - "type": "string", - "description": "Subjects term identifier (e.g., a URL)." - }, - "term": { - "title": "Subject term", - "type": "string", - "description": "Subject term value." - } - } - } - }, - "title": { - "title": "Title", - "type": "string", - "description": "Descriptive title for the record." - }, - "version": { - "title": "Version", - "type": "string", - "description": "Record version tag. Mostly relevant for software and dataset uploads. Any string will be accepted, but semantically-versioned tag is recommended." - }, - "upload_type": { - "additionalProperties": false, - "default": "dataset", - "description": "Record upload type.", - "enum": [ - "publication", - "poster", - "presentation", - "dataset", - "image", - "video", - "software", - "lesson", - "physicalobject", - "other" - ], - "type": "string" - } - }, - "required": [ - "title", - "description", - "keywords", - "notes", - "access_right", - "license" - ] -} \ No newline at end of file diff --git a/dspback/schemas/zenodo/uischema.json b/dspback/schemas/zenodo/uischema.json deleted file mode 100644 index 575acc1..0000000 --- a/dspback/schemas/zenodo/uischema.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "type": "VerticalLayout", - "elements": [ - { - "type": "Group", - "label": "Basic Information", - "elements": [ - { - "type": "Control", - "scope": "#/properties/title" - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/version" - }, - { - "type": "Control", - "scope": "#/properties/upload_type", - "rule": { - "effect": "DISABLE", - "condition": { - "scope": "#/properties/upload_type" - } - } - } - ] - }, - { - "type": "Control", - "scope": "#/properties/description", - "options": { - "multi": true - } - }, - { - "type": "Control", - "scope": "#/properties/keywords" - }, - { - "type": "Control", - "scope": "#/properties/communities", - "options": { "useTableLayout": true } - } - ] - }, - { - "type": "Control", - "scope": "#/properties/creators", - "options": { - "elementLabelProp": ["name"] - } - }, - { - "type": "Control", - "scope": "#/properties/contributors", - "options": { - "elementLabelProp": ["name"] - } - }, - { - "type": "Group", - "label": "Related Resource Information", - "elements":[ - { - "type": "Control", - "scope": "#/properties/references", - "options": { - "useArrayLayout": true, - "showSortButtons": true - } - }, - { - "type": "Control", - "scope": "#/properties/related_identifiers", - "options": { "useTableLayout": true } - } - ] - }, - { - "type": "Group", - "label": "License", - "elements": [ - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "VerticalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/access_right", - "options": { - "format": "radio" - } - }, - { - "type": "Control", - "scope": "#/properties/embargo_date", - "rule": { - "effect": "DISABLE", - "condition": { - "scope": "#/properties/access_right", - "schema": { - "enum": ["open"] - } - } - } - } - ] - }, - { - "type": "HorizontalLayout", - "elements": [ - { - "type": "Control", - "scope": "#/properties/license" - } - ] - } - ] - } - ] - }, - { - "type": "Control", - "scope": "#/properties/subjects" - }, - { - "type": "Control", - "scope": "#/properties/notes", - "options": { - "multi": true - } - } - ] -} \ No newline at end of file From 4954c6724b5a637260678e1259a7139363950227 Mon Sep 17 00:00:00 2001 From: Scott Black Date: Mon, 15 May 2023 10:46:09 -0600 Subject: [PATCH 02/11] Revert "remove unused schemas" This reverts commit 91fe42d5aaad7990478944d7d4f3ef058caaaeb3. --- dspback/schemas/earthchem/__init__.py | 0 dspback/schemas/earthchem/defaults.json | 1 + dspback/schemas/earthchem/schema.json | 868 +++++++++++++++++++++++ dspback/schemas/earthchem/uischema.json | 168 +++++ dspback/schemas/hydroshare/defaults.json | 5 + dspback/schemas/hydroshare/schema.json | 775 ++++++++++++++++++++ dspback/schemas/hydroshare/uischema.json | 254 +++++++ dspback/schemas/jsonld_conversion.py | 64 ++ dspback/schemas/zenodo/__init__.py | 0 dspback/schemas/zenodo/defaults.json | 5 + dspback/schemas/zenodo/schema.json | 531 ++++++++++++++ dspback/schemas/zenodo/uischema.json | 139 ++++ 12 files changed, 2810 insertions(+) create mode 100644 dspback/schemas/earthchem/__init__.py create mode 100644 dspback/schemas/earthchem/defaults.json create mode 100644 dspback/schemas/earthchem/schema.json create mode 100644 dspback/schemas/earthchem/uischema.json create mode 100644 dspback/schemas/hydroshare/defaults.json create mode 100644 dspback/schemas/hydroshare/schema.json create mode 100644 dspback/schemas/hydroshare/uischema.json create mode 100644 dspback/schemas/jsonld_conversion.py create mode 100644 dspback/schemas/zenodo/__init__.py create mode 100644 dspback/schemas/zenodo/defaults.json create mode 100644 dspback/schemas/zenodo/schema.json create mode 100644 dspback/schemas/zenodo/uischema.json diff --git a/dspback/schemas/earthchem/__init__.py b/dspback/schemas/earthchem/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dspback/schemas/earthchem/defaults.json b/dspback/schemas/earthchem/defaults.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/dspback/schemas/earthchem/defaults.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/dspback/schemas/earthchem/schema.json b/dspback/schemas/earthchem/schema.json new file mode 100644 index 0000000..792952b --- /dev/null +++ b/dspback/schemas/earthchem/schema.json @@ -0,0 +1,868 @@ +{ + "title": "Record", + "type": "object", + "properties": { + "title": { + "title": "Dataset Title", + "description": "A descriptive title of the dataset", + "type": "string" + }, + "datePublished": { + "title": "Release Date", + "description": "The date of the files contained in the resource to be allowed for downloading", + "type": "string", + "format": "date", + "options": { + "placeholder": "YYYY-MM-DD", + "max": { "amount": 2, "unit": "year" }, + "min": "today", + "default": { "amount": 3, "unit": "day" } + } + }, + "description": { + "title": "Abstract or Description", + "type": "string", + "description": "Describe measurements, location, and purpose of the dataset", + "maxLength": 250 + }, + "community": { + "title": "Community", + "type": "string", + "default": "CZNet", + "const": "CZNet", + "readOnly": true, + "options": { "hidden": true } + }, + "leadAuthor": { + "type": "object", + "title": "Lead Author", + "properties": { + "givenName": { + "title": "First Name", + "type": "string" + }, + "additionalName": { + "title": "Middle Name", + "type": "string" + }, + "familyName": { + "title": "Last Name", + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "identifiers": { + "type": "array", + "items": { "$ref": "#/definitions/AuthorIdentifier" }, + "default": [] + } + }, + "required": [ + "familyName", + "givenName", + "email" + ] + }, + "contributors": { + "title": "Co-Authors", + "type": "array", + "maxItems": 3, + "items": { "$ref": "#/definitions/Contributor" } + }, + "type": { + "title": "Dataset Type", + "description": "The nature or genre of the resource", + "type": "string", + "default": "Dataset", + "enum": [ + "Collection", + "Dataset", + "Image", + "InteractiveResource", + "MovingImage", + "PhysicalObject", + "Service", + "Software", + "Sound", + "StillImage", + "Text" + ] + }, + "status": { + "title": "Submission status", + "type": "string", + "description": "Indication of the progress status of the resource.", + "default": "incomplete", + "options": { "hidden": true }, + "enum": [ + "incomplete", + "submitted" + ] + }, + "additionalTypes": { + "title": "Data Types", + "description": "The science domain of the content", + "type": "array", + "items": { + "type": "string", + "enum": [ + "Chemistry", + "Chemistry:ClumpedIsotope", + "Chemistry:Fluid", + "Chemistry:Gas", + "Chemistry:Rock", + "Chemistry:Sediment", + "Geochronology", + "Kinetics", + "ModelData", + "Petrography", + "Petrology", + "Petrology:Experimental", + "Petrology:Mineral", + "SampleInfo", + "SocialScience", + "Other" + ] + }, + "default": [], + "uniqueItems": true + }, + "keywords": { + "title": "Keywords", + "type": "array", + "description": "A list of non-geographic keywords. (e.g. volatiles, ultra-slow spreading ridges, mantle melting, CO2 fluxes)", + "default": ["CZNet"], + "minItems": 2, + "contains": { + "enum": ["CZNet"] + }, + "items": { + "type": "string" + } + }, + "language": { + "type": "string" + }, + "spatialCoverage": { + "$ref": "#/definitions/SpatialCoverage" + }, + "relatedResources": { + "title": "Related Resources", + "type": "array", + "items": { + "$ref": "#/definitions/RelatedResource" + } + }, + "fundings": { + "title": "Funding Source", + "description": "Source of grants/awards which have funded the resource", + "type": "array", + "items": { + "title": "Funding Source", + "options": { "flat": true }, + "required": [ + "identifier", + "funder" + ], + "anyOf": [ + { + "title": "Select one", + "options": { + "dropdown": true, + "flat": true, + "title": "Funder", + "description": "Name of the agency or organization that funded the creation of the resource" + }, + "anyOf": [ + { + "type": "object", + "title": "National Science Foundation", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "NSF" }, + "const": { "alternateName": "NSF" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/021nxhr62", + "const": "https://ror.org/021nxhr62", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Alfred P. Sloan Foundation", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "SLOAN" }, + "const": { "alternateName": "SLOAN" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/052csg198", + "const": "https://ror.org/052csg198", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "U.S. Department of Energy", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "DOE" }, + "const": { "alternateName": "DOE" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/01bj3aw27", + "const": "https://ror.org/01bj3aw27", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "National Aeronautics and Space Administration", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "NASA" }, + "const": { "alternateName": "NASA" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/027ka1x80", + "const": "https://ror.org/027ka1x80", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "European Research Council", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "ERC" }, + "const": { "alternateName": "ERC" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/0472cxd90", + "const": "https://ror.org/0472cxd90", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Deutsche Forschungsgemeinschaft", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "DFG" }, + "const": { "alternateName": "DFG" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/018mejw64", + "const": "https://ror.org/018mejw64", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "National Natural Science Foundation of China", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "NSFC" }, + "const": { "alternateName": "NSFC" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/01h0zpd94", + "const": "https://ror.org/01h0zpd94", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Australian Research Council", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "ARC" }, + "const": { "alternateName": "ARC" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/05mmh0f86", + "const": "https://ror.org/05mmh0f86", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Russian Science Foundation", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "RSCF" }, + "const": { "alternateName": "RSCF" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/03y2gwe85", + "const": "https://ror.org/03y2gwe85", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Natural Environment Research Council", + "properties": { + "identifier": { + "type": "string", + "title": "Award Number" + }, + "funder": { + "type": "object", + "options": { "hidden": true }, + "default": { "alternateName": "NERC" }, + "const": { "alternateName": "NERC" }, + "properties": { + "alternateName": { + "type": "string" + } + } + }, + "url": { + "type": "string", + "default": "https://ror.org/02b5d8509", + "const": "https://ror.org/02b5d8509", + "options": { "hidden": true } + } + } + } + ] + }, + { + "type": "object", + "title": "Other", + "properties": { + "identifier": { + "type": "string", + "title": "Funding Source", + "description": "Please enter other funding sources in the format of: Funding Source Name (012345)" + }, + "funder": { + "title": "Funder", + "description": "A person or organization that provides money for a particular purpose", + "type": "object", + "const": { "alternateName": "Other" }, + "default": { "alternateName": "Other" }, + "options": { "hidden": true }, + "properties": { + "alternateName": { + "type": "string" + } + } + } + } + } + ], + "errorMessage": { + "anyOf": "selected item is incomplete" + } + } + }, + "license": { + "$ref": "#/definitions/License" + } + }, + "required": [ + "datePublished", + "title", + "description", + "keywords", + "leadAuthor", + "spatialCoverage", + "additionalTypes", + "community", + "type", + "status" + ], + "definitions": { + "Affiliation": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "identifiers": { + "type": "array", + "items": { + "$ref": "#/definitions/Identifier" + } + } + }, + "title": "Affiliation" + }, + "Contributor": { + "type": "object", + "title": "Co-Author", + "properties": { + "givenName": { + "title": "First Name", + "type": "string" + }, + "additionalName": { + "title": "Middle Name", + "type": "string" + }, + "familyName": { + "title": "Last Name", + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "identifiers": { + "type": "array", + "items": { "$ref": "#/definitions/AuthorIdentifier" } + } + }, + "required": [ + "familyName", + "givenName" + ] + }, + + "Cordinate": { + "type": "object", + "properties": { + "lat": { + "type": "number" + }, + "lon": { + "type": "number" + }, + "alt": { + "type": "number" + } + }, + "title": "Cordinate" + }, + "Feature": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "geometry": { + "$ref": "#/definitions/Geometry" + } + }, + "title": "Feature" + }, + "FileResponse": { + "type": "object", + "properties": { + "fileName": { + "type": "string" + }, + "message": { + "type": "string" + } + }, + "title": "FileResponse" + }, + "Geometry": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "Point", + "LineString", + "Polygon" + ] + }, + "cordinates": { + "type": "array", + "items": { + "$ref": "#/definitions/Cordinate" + } + } + }, + "title": "Geometry" + }, + "Identifier": { + "type": "object", + "properties": { + "scheme": { + "type": "string" + }, + "identifier": { + "type": "string" + } + }, + "title": "Identifier" + }, + "AuthorIdentifier": { + "title": "Identifier", + "type": "object", + "properties": { + "scheme": { + "type": "string", + "default": "ORCID", + "const": "ORCID", + "readOnly": true, + "options": { "hidden": true } + }, + "schemeURI": { + "type": "string", + "default": "https://orcid.org/", + "const": "https://orcid.org/", + "readOnly": true, + "options": { "hidden": true } + }, + "identifier": { + "title": "ORCID", + "type": "string", + "pattern": "\\b\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]\\b", + "options": { + "placeholder": "e.g. '0000-0001-2345-6789'" + }, + "errorMessage": { + "pattern": "must match the ORCID pattern. e.g. '0000-0001-2345-6789'" + } + } + } + }, + "License": { + "title": "License", + "type": "object", + "options": { "dropdown": true, "flat": true }, + "anyOf": [ + { + "title": "(CC-BY-NC-SA-3.0) - Creative Commons Attribution-NonCommercial-Share Alike 3.0 United States", + "properties": { + "alternateName": { + "type": "string", + "default": "CC-BY-NC-SA-3.0", + "const": "CC-BY-NC-SA-3.0", + "options": { "hidden": true } + } + } + }, + { + "title": "(CC-BY-4.0) - Creative Commons Attribution 4.0 International", + "properties": { + "alternateName": { + "type": "string", + "default": "CC-BY-4.0", + "const": "CC-BY-4.0", + "options": { "hidden": true } + } + } + }, + { + "title": "(CC-BY-SA-4.0) - Creative Commons Attribution-ShareAlike 4.0 International", + "properties": { + "alternateName": { + "type": "string", + "default": "CC-BY-SA-4.0", + "const": "CC-BY-SA-4.0", + "options": { "hidden": true } + } + } + }, + { + "title": "(CC-BY-NC-SA-4.0) - Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", + "properties": { + "alternateName": { + "type": "string", + "default": "CC-BY-NC-SA-4.0", + "const": "CC-BY-NC-SA-4.0", + "options": { "hidden": true } + } + } + }, + { + "title": "(CC0-1.0) - Creative Commons No Rights Reserved", + "properties": { + "alternateName": { + "type": "string", + "default": "CC0-1.0", + "const": "CC0-1.0", + "options": { "hidden": true } + } + } + } + ], + "errorMessage": { + "anyOf": "selected item is incomplete" + } + }, + "RecordFile": { + "type": "object", + "properties": { + "checkum": { + "type": "string" + }, + "description": { + "type": "string" + }, + "format": { + "type": "string" + }, + "name": { + "type": "string" + }, + "position": { + "type": "integer" + }, + "serverName": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "int64" + }, + "uploadDate": { + "type": "string" + } + }, + "title": "RecordFile" + }, + "RelatedResource": { + "title": "Related Resource", + "type": "object", + "required": ["identifiers"], + "properties": { + "identifiers": { + "title": "Related Information", + "type": "array", + "items": { + "title": "Related Information", + "options": { "flat": true, "dropdown": true }, + "maxItems": 1, + "required": ["identifier"], + "anyOf": [ + { + "type": "object", + "title": "(DOI) - Publication DOI", + "description": "Select a related identifier from the dropdown", + "properties": { + "scheme": { + "type": "string", + "default": "DOI", + "const": "DOI", + "readOnly": true, + "options": { "hidden": true } + }, + "identifier": { + "type": "string", + "title": "Publication DOI", + "description": "Enter most relevant publication DOI(s). e.g. '10.016/j.epsl.2009.11.018'", + "options": { + "placeholder": "e.g. '10.016/j.epsl.2009.11.018'" + } + } + } + }, + { + "type": "object", + "title": "(IGSN) - International Geo Sample Number", + "description": "Select a related identifier from the dropdown", + "properties": { + "scheme": { + "type": "string", + "default": "IGSN", + "const": "IGSN", + "readOnly": true, + "options": { "hidden": true } + }, + "identifier": { + "type": "string", + "title": "IGSN", + "description": "Provide IGSNs for your samples separated by commas." + } + } + }, + { + "type": "object", + "title": "(R2R) - Cruise DOI", + "description": "Select a related identifier from the dropdown", + "properties": { + "scheme": { + "type": "string", + "default": "OCDOI", + "const": "OCDOI", + "readOnly": true, + "options": { "hidden": true } + }, + "identifier": { + "type": "string", + "title": "Cruise DOI", + "description": "Provide Cruise DOIs corresponding to your samples." + } + } + }, + { + "type": "object", + "title": "(SVN) - Smithsonian Volcano Number", + "description": "Select a related identifier from the dropdown", + "properties": { + "scheme": { + "type": "string", + "default": "VNum", + "const": "VNum", + "readOnly": true, + "options": { "hidden": true } + }, + "identifier": { + "type": "string", + "title": "Smithsonian Volcano Number", + "description": "Provide volcano numbers corresponding to your sample collection site." + } + } + } + ], + "errorMessage": { + "anyOf": "selected item is incomplete" + } + } + } + } + }, + "SpatialCoverage": { + "title": "Spatial Coverage Information", + "type": "object", + "properties": { + "coverage": { + "title": "Spatial Coverage", + "type": "string", + "enum": [ + "Global", + "Regional (Continents, Oceans)", + "Space/Planetary" + ] + }, + "keywords": { + "title": "Geographic Keywords", + "type": "array", + "items": { + "type": "string" + }, + "description": "Provide appropriate geographic keywords for searches. (e.g. Pacific Ocean, Aleutian Islands)" + } + }, + "required": ["coverage"] + } + } +} \ No newline at end of file diff --git a/dspback/schemas/earthchem/uischema.json b/dspback/schemas/earthchem/uischema.json new file mode 100644 index 0000000..9a4de33 --- /dev/null +++ b/dspback/schemas/earthchem/uischema.json @@ -0,0 +1,168 @@ +{ + "type": "VerticalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/status" + }, + { + "type": "Group", + "label": "Data File Release Information", + "description": "The maximum date in the future is two years forward from the date of dataset submission. Before the release date, its metadata will be available and searchable in the EarthChem Library, but the data file will not be available for download.", + "elements": [ + { + "type": "Control", + "scope": "#/properties/datePublished" + } + ] + }, + { + "type": "Group", + "label": "Basic Information", + "elements": [ + { + "type": "Control", + "scope": "#/properties/title" + }, + { + "type": "Control", + "scope": "#/properties/description", + "options": { + "multi": true + } + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/type" + }, + { + "type": "Control", + "scope": "#/properties/additionalTypes" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/keywords" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/community" + }, + { + "type": "Control", + "scope": "#/properties/leadAuthor", + "options": { + "detail": { + "type": "Object", + "elements": [ + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/givenName" + }, + { + "type": "Control", + "scope": "#/properties/additionalName" + }, + { + "type": "Control", + "scope": "#/properties/familyName" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/email" + }, + { + "type": "Control", + "scope": "#/properties/identifiers", + "options": { "useTableLayout": true } + } + ] + } + } + }, + { + "type": "Control", + "scope": "#/properties/contributors", + "options": { + "showSortButtons": true, + "restrict": true, + "elementLabelProp": ["givenName", "additionalName", "familyName"], + "detail": { + "type": "VerticalLayout", + "elements": [ + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/givenName" + }, + { + "type": "Control", + "scope": "#/properties/additionalName" + }, + { + "type": "Control", + "scope": "#/properties/familyName" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/email" + }, + { + "type": "Control", + "scope": "#/properties/identifiers", + "options": { "useTableLayout": true } + } + ] + } + } + }, + { + "type": "Control", + "scope": "#/properties/spatialCoverage" + }, + { + "type": "Control", + "scope": "#/properties/relatedResources", + "options": { + "elementLabelProp": "-", + "childLabelProp": "-", + "detail": { + "type": "Control", + "scope": "#/properties/identifiers", + "options": { + "restrict": true, + "elementLabelProp": "scheme", + "childLabelProp": "scheme" + } + } + } + }, + { + "type": "Control", + "scope": "#/properties/fundings", + "options": { + "elementLabelProp": "identifier", + "childLabelProp": "identifier" + } + }, + { + "type": "Control", + "scope": "#/properties/license" + } + ] +} \ No newline at end of file diff --git a/dspback/schemas/hydroshare/defaults.json b/dspback/schemas/hydroshare/defaults.json new file mode 100644 index 0000000..56b641c --- /dev/null +++ b/dspback/schemas/hydroshare/defaults.json @@ -0,0 +1,5 @@ +{ + "rights": { + "license": "Creative Commons Attribution CC BY" + } +} \ No newline at end of file diff --git a/dspback/schemas/hydroshare/schema.json b/dspback/schemas/hydroshare/schema.json new file mode 100644 index 0000000..b7de32e --- /dev/null +++ b/dspback/schemas/hydroshare/schema.json @@ -0,0 +1,775 @@ +{ + "title": "Resource Metadata", + "description": "A class used to represent the metadata for a resource", + "type": "object", + "properties": { + "title": { + "title": "Title", + "description": "A string containing the name given to a resource", + "maxLength": 300, + "type": "string" + }, + "abstract": { + "title": "Abstract", + "description": "A string containing a summary of a resource", + "type": "string" + }, + "subjects": { + "title": "Subject keywords", + "description": "A list of keyword strings expressing the topic of a resource", + "default": ["CZNet"], + "minItems": 2, + "contains": { + "enum": ["CZNet"] + }, + "type": "array", + "items": { + "type": "string" + } + }, + "creators": { + "title": "Creators", + "description": "A list of Creator objects indicating the entities responsible for creating a resource", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Creator" + } + }, + "contributors": { + "title": "Contributors", + "description": "A list of Contributor objects indicating the entities that contributed to a resource", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Contributor" + } + }, + "relations": { + "title": "Related resources", + "description": "A list of Relation objects representing resources related to a described resource", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Relation" + } + }, + "additional_metadata": { + "title": "Additional metadata", + "description": "A dictionary containing key-value pair metadata associated with a resource", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/AdditionalMetadata" + } + }, + "rights": { + "title": "Rights", + "description": "An object containing information about rights held in and over a resource", + "required": [ + "statement", + "url" + ], + "anyOf": [ + { + "title": "Choose a License", + "options": { + "dropdown": true, + "flat": true, + "title": "License" + }, + "required": [ + "license" + ], + "default": { + "license": "Creative Commons Attribution CC BY", + "statement": "This resource is shared under the Creative Commons Attribution CC BY.", + "url": "http://creativecommons.org/licenses/by/4.0/" + }, + "anyOf": [ + { + "type": "object", + "title": "Creative Commons Attribution CC BY", + "properties": { + "license": { + "type": "string", + "const": "Creative Commons Attribution CC BY", + "default": "Creative Commons Attribution CC BY", + "options": { "hidden": true } + }, + "statement": { + "type": "string", + "const": "This resource is shared under the Creative Commons Attribution CC BY.", + "default": "This resource is shared under the Creative Commons Attribution CC BY.", + "options": { "hidden": true } + }, + "url": { + "type": "string", + "const": "http://creativecommons.org/licenses/by/4.0/", + "default": "http://creativecommons.org/licenses/by/4.0/", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Creative Commons Attribution-ShareAlike CC BY-SA", + "properties": { + "license": { + "type": "string", + "const": "Creative Commons Attribution-ShareAlike CC BY-SA", + "default": "Creative Commons Attribution-ShareAlike CC BY-SA", + "options": { "hidden": true } + }, + "statement": { + "type": "string", + "const": "This resource is shared under the Creative Commons Attribution-ShareAlike CC BY-SA.", + "default": "This resource is shared under the Creative Commons Attribution-ShareAlike CC BY-SA.", + "options": { "hidden": true } + }, + "url": { + "type": "string", + "const": "http://creativecommons.org/licenses/by-sa/4.0/", + "default": "http://creativecommons.org/licenses/by-sa/4.0/", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Creative Commons Attribution-NoDerivs CC BY-ND", + "properties": { + "license": { + "type": "string", + "const": "Creative Commons Attribution-NoDerivs CC BY-ND", + "default": "Creative Commons Attribution-NoDerivs CC BY-ND", + "options": { "hidden": true } + }, + "statement": { + "type": "string", + "const": "This resource is shared under the Creative Commons Attribution-NoDerivs CC BY-ND.", + "default": "This resource is shared under the Creative Commons Attribution-NoDerivs CC BY-ND.", + "options": { "hidden": true } + }, + "url": { + "type": "string", + "const": "http://creativecommons.org/licenses/by-nd/4.0/", + "default": "http://creativecommons.org/licenses/by-nd/4.0/", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA", + "properties": { + "license": { + "type": "string", + "const": "Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA", + "default": "Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA", + "options": { "hidden": true } + }, + "statement": { + "type": "string", + "const": "This resource is shared under the Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA.", + "default": "This resource is shared under the Creative Commons Attribution-NoCommercial-ShareAlike CC BY-NC-SA.", + "options": { "hidden": true } + }, + "url": { + "type": "string", + "const": "http://creativecommons.org/licenses/by-nc-sa/4.0/", + "default": "http://creativecommons.org/licenses/by-nc-sa/4.0/", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Creative Commons Attribution-NoCommercial CC BY-NC", + "properties": { + "license": { + "type": "string", + "const": "Creative Commons Attribution-NoCommercial CC BY-NC", + "default": "Creative Commons Attribution-NoCommercial CC BY-NC", + "options": { "hidden": true } + }, + "statement": { + "type": "string", + "const": "This resource is shared under the Creative Commons Attribution-NoCommercial CC BY-NC.", + "default": "This resource is shared under the Creative Commons Attribution-NoCommercial CC BY-NC.", + "options": { "hidden": true } + }, + "url": { + "type": "string", + "const": "http://creativecommons.org/licenses/by-nc/4.0/", + "default": "http://creativecommons.org/licenses/by-nc/4.0/", + "options": { "hidden": true } + } + } + }, + { + "type": "object", + "title": "Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND", + "properties": { + "license": { + "type": "string", + "const": "Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND", + "default": "Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND", + "options": { "hidden": true } + + }, + "statement": { + "type": "string", + "const": "This resource is shared under the Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND.", + "default": "This resource is shared under the Creative Commons Attribution-NoCommercial-NoDerivs CC BY-NC-ND.", + "options": { "hidden": true } + }, + "url": { + "type": "string", + "const": "http://creativecommons.org/licenses/by-nc/4.0/", + "default": "http://creativecommons.org/licenses/by-nc/4.0/", + "options": { "hidden": true } + } + } + } + ] + }, + { + "title": "Custom License", + "description": "An object containing information about rights held in an over a resource", + "type": "object", + "properties": { + "statement": { + "title": "Statement", + "description": "A string containing the text of the license or rights statement", + "type": "string" + }, + "url": { + "type": "string", + "title": "URL", + "description": "URL pointing to a description of the license or rights statement", + "minLength": 1, + "maxLength": 65536, + "pattern": "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$", + "errorMessage": { + "pattern": "must match format \"url\"" + } + } + } + } + ], + "errorMessage": { + "anyOf": "selected item is incomplete" + } + }, + "awards": { + "title": "Funding agency information", + "description": "A list of objects containing information about the funding agencies and awards associated with a resource", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/AwardInfo" + } + }, + "spatial_coverage": { + "title": "Spatial coverage", + "description": "An object containing information about the spatial topic of a resource, the spatial applicability of a resource, or jurisdiction under with a resource is relevant", + "anyOf": [ + { + "title": "Point Coverage Metadata", + "description": "A class used to represent geographic coverage metadata for a resource or aggregation expressed as a\npoint location", + "type": "object", + "options": { + "detail": { + "type": "VerticalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/name" + }, + { + "type": "MapLayout", + "options": { + "map": { "type": "point", "north": "north", "east": "east" } + }, + "elements": [ + { + "type": "Control", + "scope": "#/properties/east" + }, + { + "type": "Control", + "scope": "#/properties/north" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/units" + }, + { + "type": "Control", + "scope": "#/properties/projection" + } + ] + } + }, + "properties": { + "name": { + "title": "Name", + "description": "A string containing a name for the place associated with the geographic coverage", + "type": "string" + }, + "east": { + "title": "East", + "description": "The coordinate of the point location measured in the east direction (between -180 and 180)", + "exclusiveMinimum": -180, + "exclusiveMaximum": 180, + "type": "number" + }, + "north": { + "title": "North", + "description": " The coordinate of the point location measured in the north direction (between -90 and 90)", + "exclusiveMinimum": -90, + "exclusiveMaximum": 90, + "type": "number" + }, + "units": { + "title": "Units", + "description": "The units applying to the unlabelled numeric values of north and east", + "type": "string", + "default": "Decimal degrees", + "const": "Decimal degrees", + "readOnly": true + }, + "projection": { + "title": "Projection", + "description": "The name of the projection used with any parameters required, such as ellipsoid parameters, datum, standard parallels and meridians, zone, etc.", + "type": "string", + "default": "WGS 84 EPSG:4326", + "const": "WGS 84 EPSG:4326", + "readOnly": true + } + }, + "required": [ + "east", + "north" + ] + }, + { + "title": "Box Coverage Metadata", + "description": "A class used to represent geographic coverage metadata for a resource or aggregation expressed as a\nlatitude-longitude bounding box", + "type": "object", + "options": { + "detail": { + "type": "VerticalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/name" + }, + { + "type": "MapLayout", + "options": { + "map": { "type": "box", "northlimit": "northlimit", "eastlimit": "eastlimit", "southlimit": "southlimit", "westlimit": "westlimit" } + }, + "elements": [ + { + "type": "Control", + "scope": "#/properties/northlimit" + }, + { + "type": "Control", + "scope": "#/properties/eastlimit" + }, + { + "type": "Control", + "scope": "#/properties/southlimit" + }, + { + "type": "Control", + "scope": "#/properties/westlimit" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/units" + }, + { + "type": "Control", + "scope": "#/properties/projection" + } + + ] + } + }, + "properties": { + "name": { + "title": "Name", + "description": "A string containing a name for the place associated with the geographic coverage", + "type": "string" + }, + "northlimit": { + "title": "North limit", + "description": "A floating point value containing the constant coordinate for the northernmost face or edge of the bounding box (between -90 and 90)", + "exclusiveMinimum": -90, + "exclusiveMaximum": 90, + "type": "number" + }, + "eastlimit": { + "title": "East limit", + "description": "A floating point value containing the constant coordinate for the easternmost face or edge of the bounding box (between -180 and 180)", + "exclusiveMinimum": -180, + "exclusiveMaximum": 180, + "type": "number" + }, + "southlimit": { + "title": "South limit", + "description": "A floating point value containing the constant coordinate for the southernmost face or edge of the bounding box (between -90 and 90)", + "exclusiveMinimum": -90, + "exclusiveMaximum": 90, + "type": "number" + }, + "westlimit": { + "title": "West limit", + "description": "A floating point value containing the constant coordinate for the westernmost face or edge of the bounding box (between -180 and 180)", + "exclusiveMinimum": -180, + "exclusiveMaximum": 180, + "type": "number" + }, + "units": { + "title": "Units", + "description": "A string containing the units applying to the unlabelled numeric values of northlimit, eastlimit, southlimit, and westlimit", + "type": "string", + "default": "Decimal degrees", + "const": "Decimal degrees", + "readOnly": true + }, + "projection": { + "title": "Projection", + "description": "A string containing the name of the projection used with any parameters required, such as ellipsoid parameters, datum, standard parallels and meridians, zone, etc.", + "type": "string", + "default": "WGS 84 EPSG:4326", + "const": "WGS 84 EPSG:4326", + "readOnly": true + } + }, + "required": [ + "northlimit", + "eastlimit", + "southlimit", + "westlimit" + ] + } + ], + "errorMessage": { + "anyOf": "selected item is incomplete" + } + }, + "period_coverage": { + "title": "Temporal coverage", + "description": "An object containing information about the temporal topic or applicability of a resource", + "$ref": "#/definitions/PeriodCoverage" + }, + "publisher": { + "title": "Publisher", + "description": "An object containing information about the publisher of a resource", + "allOf": [ + { + "$ref": "#/definitions/Publisher" + } + ] + }, + "citation": { + "title": "Citation", + "description": "A string containing the biblilographic citation for a resource", + "type": "string", + "readOnly": true + } + }, + "required": [ + "title", + "abstract", + "subjects", + "awards", + "rights" + ], + "definitions": { + "Creator": { + "title": "Creator Metadata", + "description": "A class used to represent the metadata associated with a creator of a resource", + "type": "object", + "properties": { + "name": { + "title": "Name", + "description": "A string containing the name of the creator", + "maxLength": 100, + "type": "string", + "options": { + "placeholder": "e.g. 'Horsburgh, Jeffery S.'" + } + }, + "phone": { + "title": "Phone", + "description": "A string containing a phone number for the creator", + "maxLength": 25, + "type": "string", + "options": { + "placeholder": "Phone: e.g., (435) 797-2946" + } + }, + "address": { + "title": "Address", + "description": "A string containing an address for the creator", + "maxLength": 250, + "type": "string", + "options": { + "placeholder": "e.g., 8200 Old Main Hill, Logan, UT 84322-8200" + } + }, + "organization": { + "title": "Organization", + "description": "A string containing the name of the organization with which the creator is affiliated", + "maxLength": 200, + "type": "string", + "options": { + "placeholder": "e.g. 'Utah State University'" + } + }, + "email": { + "title": "Email", + "description": "A string containing an email address for the creator", + "type": "string", + "format": "email", + "options": { + "placeholder": "e.g. 'jeff.horsburgh@usu.edu'" + } + }, + "homepage": { + "$ref": "#/definitions/UrlPattern" + }, + "profile_url": { + "$ref": "#/definitions/ProfileUrlPattern" + } + }, + "required": ["name"] + }, + "Contributor": { + "title": "Contributor Metadata", + "description": "A class used to represent the metadata associated with a contributor to a resource", + "type": "object", + "properties": { + "name": { + "title": "Name", + "description": "A string containing the name of the contributor", + "type": "string", + "maxLength": 100, + "options": { + "placeholder": "e.g. 'Horsburgh, Jeffery S.'" + } + }, + "phone": { + "title": "Phone", + "description": "A string containing a phone number for the contributor", + "maxLength": 25, + "type": "string", + "options": { + "placeholder": "Phone: e.g., (435) 797-2946" + } + }, + "address": { + "title": "Address", + "description": "A string containing an address for the contributor", + "maxLength": 250, + "type": "string", + "options": { + "placeholder": "e.g., 8200 Old Main Hill, Logan, UT 84322-8200" + } + }, + "organization": { + "title": "Organization", + "description": "A string containing the name of the organization with which the contributor is affiliated", + "maxLength": 200, + "type": "string", + "options": { + "placeholder": "e.g. 'Utah State University'" + } + }, + "email": { + "title": "Email", + "description": "A string containing an email address for the contributor", + "type": "string", + "format": "email", + "options": { + "placeholder": "e.g. 'jeff.horsburgh@usu.edu'" + } + }, + "homepage": { + "$ref": "#/definitions/UrlPattern" + }, + "profile_url": { + "$ref": "#/definitions/ProfileUrlPattern" + } + }, + "required": ["name"] + }, + "Relation": { + "title": "Related Resource Metadata", + "description": "A class used to represent the metadata associated with a resource related to the resource being described", + "type": "object", + "properties": { + "type": { + "title": "RelationType", + "description": "An enumeration.", + "enum": [ + "The content of this resource is part of", + "This resource includes", + "The content of this resource was created by a related App or software program", + "The content of this resource was created by", + "This resource updates and replaces a previous version", + "This resource has been replaced by a newer version", + "This resource is described by", + "This resource conforms to established standard described by", + "This resource has a related resource in another format", + "This resource is a different format of", + "This resource is required by", + "This resource requires", + "This resource is referenced by", + "The content of this resource references", + "This resource replaces", + "The content of this resource is derived from" + ], + "type": "string" + }, + "value": { + "title": "Value", + "description": "String expressing the Full text citation, URL link for, or description of the related resource", + "maxLength": 500, + "type": "string" + } + }, + "required": [ + "type", + "value" + ] + }, + "AdditionalMetadata": { + "title": "Key-Value", + "description": "A key-value pair", + "type": "object", + "properties": { + "key": { + "title": "Key", + "type": "string" + }, + "value": { + "title": "Value", + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + }, + "AwardInfo": { + "title": "Funding Agency Metadata", + "description": "A class used to represent the metadata associated with funding agency credits for a resource", + "type": "object", + "properties": { + "funding_agency_name": { + "title": "Agency name", + "description": "A string containing the name of the funding agency or organization", + "type": "string" + }, + "title": { + "title": "Award title", + "description": "A string containing the title of the project or award", + "type": "string" + }, + "number": { + "title": "Award number", + "description": "A string containing the award number or other identifier", + "type": "string" + }, + "funding_agency_url": { + "$ref": "#/definitions/UrlPattern" + } + }, + "required": [ + "funding_agency_name", + "number", + "title" + ] + }, + "PeriodCoverage": { + "title": "Period coverage", + "description": "A class used to represent temporal coverage metadata for a resource or aggregation", + "type": "object", + "properties": { + "name": { + "title": "Name", + "description": "A string containing a name for the time interval", + "type": "string" + }, + "start": { + "title": "Start", + "description": "A datetime object containing the instant corresponding to the commencement of the time interval", + "type": "string", + "format": "date-time", + "options": { "placeholder": "YYYY-MM-DDTHH:MM" } + }, + "end": { + "title": "End", + "description": "A datetime object containing the instant corresponding to the termination of the time interval", + "type": "string", + "format": "date-time", + "options": { "placeholder": "YYYY-MM-DDTHH:MM" } + } + }, + "required": [ + "start", + "end" + ] + }, + "Publisher": { + "title": "Publisher Metadata", + "description": "A class used to represent the metadata associated with the publisher of a resource", + "type": "object", + "properties": { + "name": { + "title": "Publisher name", + "description": "A string containing the name of the publisher", + "maxLength": 200, + "type": "string" + }, + "url": { + "title": "Publisher URL", + "description": "An object containing a URL that points to the publisher website", + "minLength": 1, + "maxLength": 65536, + "$ref": "#/definitions/UrlPattern" + } + }, + "required": [ + "name", + "url" + ] + }, + "UrlPattern": { + "type": "string", + "pattern": "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$", + "errorMessage": { + "pattern": "must match format \"url\"" + } + }, + "ProfileUrlPattern": { + "type": "string", + "pattern": "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?hydroshare\\.org\\/user\\/\\d+\\/?$", + "errorMessage": { + "pattern": "must match profile link format. e.g. \"https://www.hydroshare.org/user/10/\"" + } + } + } +} \ No newline at end of file diff --git a/dspback/schemas/hydroshare/uischema.json b/dspback/schemas/hydroshare/uischema.json new file mode 100644 index 0000000..dda79dc --- /dev/null +++ b/dspback/schemas/hydroshare/uischema.json @@ -0,0 +1,254 @@ +{ + "type": "VerticalLayout", + "elements": [ + { + "type": "Group", + "label": "Basic Information", + "elements": [ + { + "type": "Control", + "scope": "#/properties/title" + }, + { + "type": "Control", + "scope": "#/properties/abstract", + "options": { + "multi": true, + "trim": true + } + }, + { + "type": "Control", + "scope": "#/properties/subjects" + } + ] + }, + { + "type": "Control", + "scope": "#/properties/creators", + "options": { + "elementLabelProp": ["name"], + "detail": { + "type": "VerticalLayout", + "elements": [ + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/name" + }, + { + "type": "Control", + "scope": "#/properties/email" + } + ] + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/organization" + }, + { + "type": "Control", + "scope": "#/properties/address" + } + ] + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/phone" + }, + { + "type": "Control", + "scope": "#/properties/homepage", + "options": { + "description": "URL for a website associated with the creator" + } + }, + { + "type": "Control", + "scope": "#/properties/profile_url", + "options": { + "placeholder": "e.g. 'https://www.hydroshare.org/user/10/'", + "description": "A URL for the creator's HydroShare profile" + } + } + ] + } + ] + } + } + }, + { + "type": "Control", + "scope": "#/properties/contributors", + "options": { + "elementLabelProp": ["name"], + "detail": { + "type": "VerticalLayout", + "elements": [ + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/name" + }, + { + "type": "Control", + "scope": "#/properties/email" + } + ] + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/organization" + }, + { + "type": "Control", + "scope": "#/properties/address" + } + ] + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/phone" + }, + { + "type": "Control", + "scope": "#/properties/homepage", + "options": { + "description": "URL for a website associated with the contributor" + } + }, + { + "type": "Control", + "scope": "#/properties/profile_url", + "options": { + "placeholder": "e.g. 'https://www.hydroshare.org/user/10/'", + "description": "A URL for the contributor's HydroShare profile" + } + } + ] + } + ] + } + } + }, + { + "type": "Control", + "label": "Spatial coverage", + "scope": "#/properties/spatial_coverage" + }, + { + "type": "Control", + "scope": "#/properties/period_coverage", + "options": { + "detail": { + "type": "Object", + "label": "Period coverage", + "elements": [ + { + "type": "Control", + "scope": "#/properties/name" + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/start" + }, + { + "type": "Control", + "scope": "#/properties/end" + } + ] + } + ] + } + } + }, + { + "type": "Control", + "scope": "#/properties/additional_metadata", + "options": { "useTableLayout": true } + }, + { + "type": "Control", + "scope": "#/properties/relations", + "options": { + "useTableLayout": true + } + }, + { + "type": "Control", + "scope": "#/properties/awards", + "options": { + "elementLabelProp": ["funding_agency_name"], + "detail": { + "type": "VerticalLayout", + "elements": [ + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/funding_agency_name" + }, + { + "type": "Control", + "scope": "#/properties/title" + } + ] + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/number" + }, + { + "type": "Control", + "scope": "#/properties/funding_agency_url", + "options": { + "label": "Agency URL", + "description": "URL for a website describing the funding award" + } + } + ] + } + ] + } + } + }, + { + "label": "Rights", + "type": "Control", + "scope": "#/properties/rights" + }, + { + "type": "Control", + "scope": "#/properties/citation", + "rule": { + "effect": "DISABLE", + "condition": { + "scope": "#/properties/citation" + } + } + } + ] +} \ No newline at end of file diff --git a/dspback/schemas/jsonld_conversion.py b/dspback/schemas/jsonld_conversion.py new file mode 100644 index 0000000..76c5fa0 --- /dev/null +++ b/dspback/schemas/jsonld_conversion.py @@ -0,0 +1,64 @@ +from geojson import Feature, Point, Polygon + +from dspback.schemas.earthchem.model import Record +from dspback.schemas.hydroshare.model import ResourceMetadata + + +def hs_convert_to_jsonld(metadata: ResourceMetadata): + def to_geojson(sc): + if hasattr(sc, 'northlimit'): + return Feature(geometry=Polygon([sc.northlimit, sc.southlimit, sc.eastlimit, sc.westlimit])) + else: + return Feature(geometry=Point([float(sc.east), float(sc.north)])) + pass + + def to_funder(f): + return { + '@type': 'Grant', + 'identifier': f.number, + 'name': f.title, + 'funder': {'@type': 'Organization', 'name': f.funding_agency_name, 'identifier': f.funding_agency_url}, + } + + return { + '@type': 'Dataset', + 'provider': {'name': "HydroShare"}, + 'name': metadata.title, + 'description': metadata.abstract, + 'keywords': metadata.subjects, + 'temporalCoverage': {'start': metadata.period_coverage.start, 'end': metadata.period_coverage.end}, + 'spatialCoverage': {'geojson': [to_geojson(metadata.spatial_coverage)]}, + 'creator': {'@list': [{'name': creator.name} for creator in metadata.creators]}, + 'license': {'@type': 'CreativeWork', 'text': metadata.rights.statement, 'url': metadata.rights.url}, + 'funding': [to_funder(award) for award in metadata.awards], + # not in the json metadata + 'datePublished': None, + } + + +def ecl_convert_to_jsonld(metadata: Record): + def to_name(author): + name = '' + if author.givenName: + name = author.givenName + ' ' + if author.additionalName: + name = name + author.additionalName + ' ' + if author.familyName: + name = name + author.familyName + return name.strip() + + return { + '@type': 'Dataset', + 'provider': {'name': "EarthChem Library"}, + 'name': metadata.title, + 'description': metadata.description, + 'keywords': metadata.keywords, + 'creator': { + '@list': [{'name': to_name(contributor)} for contributor in metadata.leadAuthor + metadata.contributors] + }, + 'license': {'@type': 'CreativeWork', 'url': metadata.license}, + 'datePublished': metadata.datePublished, + #'temporalCoverage': {'start': metadata.period_coverage.start, + # 'end': metadata.period_coverage.end}, + #'spatialCoverage': {'geojson': [to_geojson(metadata.spatial_coverage)]}, + } diff --git a/dspback/schemas/zenodo/__init__.py b/dspback/schemas/zenodo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dspback/schemas/zenodo/defaults.json b/dspback/schemas/zenodo/defaults.json new file mode 100644 index 0000000..69c2cb2 --- /dev/null +++ b/dspback/schemas/zenodo/defaults.json @@ -0,0 +1,5 @@ +{ + "upload_type": "dataset", + "access_right": "open" + +} \ No newline at end of file diff --git a/dspback/schemas/zenodo/schema.json b/dspback/schemas/zenodo/schema.json new file mode 100644 index 0000000..9e90c98 --- /dev/null +++ b/dspback/schemas/zenodo/schema.json @@ -0,0 +1,531 @@ +{ + "title": "Zenodo Datasets Schema for CZ Net v1.0.0", + "type": "object", + "properties": { + "access_conditions": { + "title": "Access conditions", + "type": "string", + "description": "Conditions under which access is given if record is restricted." + }, + "access_right": { + "title": "Access right", + "type": "string", + "description": "Access right for record", + "default": "open", + "enum": [ + "open", + "embargoed" + ] + }, + "communities": { + "title": "Communities", + "type": "array", + "description": "List of community identifiers.", + "uniqueItems": true, + "items": { + "title": "Community identifier", + "type": "object", + "properties": { + "identifier": { + "title": "Identifier", + "type": "string", + "description": "The community identifier" + } + }, + "default": [{ "identifier": "czdata" }], + "contains": { + "enum": [{ "identifier": "czdata" }] + } + } + }, + "contributors": { + "title": "Contributors", + "type": "array", + "description": "Contributors in order of importance.", + "items": { + "title": "Contributor", + "type": "object", + "additionalProperties": false, + "properties": { + "affiliation": { + "title": "Affiliation", + "type": "string", + "description": "Affiliation for the purpose of this specific record." + }, + "name": { + "title": "Full name", + "type": "string", + "description": "Full name of person or organisation. Personal name format: family, given.", + "options": { + "placeholder": "e.g. 'Horsburgh, Jeffery S.'" + } + }, + "orcid": { + "title": "ORCID", + "description": "ORCID identifier for contributor.", + "type": "string", + "pattern": "\\b\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]\\b", + "options": { + "placeholder": "e.g. '0000-0001-2345-6789'" + }, + "errorMessage": { + "pattern": "must match the ORCID pattern. e.g. '0000-0001-2345-6789'" + } + }, + "type": { + "title": "Contribution type", + "type": "string", + "enum": [ + "ContactPerson", + "DataCollector", + "DataCurator", + "DataManager", + "Distributor", + "Editor", + "HostingInstitution", + "Other", + "Producer", + "ProjectLeader", + "ProjectManager", + "ProjectMember", + "RegistrationAgency", + "RegistrationAuthority", + "RelatedPerson", + "Researcher", + "ResearchGroup", + "RightsHolder", + "Sponsor", + "Supervisor", + "WorkPackageLeader" + ] + } + }, + "required": [ + "name", + "affiliation", + "type" + ] + } + }, + "creators": { + "title": "Creators", + "type": "array", + "description": "Creators of record in order of importance.", + "items": { + "title": "Creator", + "type": "object", + "additionalProperties": false, + "properties": { + "affiliation": { + "title": "Affiliation", + "type": "string", + "description": "Affiliation for the purpose of this specific record." + }, + "name": { + "title": "Full name", + "type": "string", + "description": "Full name of person or organisation. Personal name format: family, given.", + "options": { + "placeholder": "e.g. 'Horsburgh, Jeffery S.'" + } + }, + "orcid": { + "title": "ORCID", + "description": "ORCID identifier for creator.", + "type": "string", + "pattern": "\\b\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]\\b", + "options": { + "placeholder": "e.g. '0000-0001-2345-6789'" + }, + "errorMessage": { + "pattern": "must match the ORCID pattern. e.g. '0000-0001-2345-6789'" + } + } + }, + "required": [ + "affiliation", + "name" + ] + } + }, + "description": { + "title": "Description/Abstract", + "type": "string", + "description": "Description/abstract for record.", + "options": { "stripHTML": true } + }, + "embargo_date": { + "title": "Embargo date", + "type": "string", + "format": "date", + "description": "Embargo date of record (ISO8601 formatted date)", + "options": { "placeholder": "YYYY-MM-DD", "min": { "amount": 1, "unit": "day" } }, + "if": { + "properties": { + "access_right": { + "const": "embargoed" + } + } + }, + "then": { + "required": [ + "embargo_date" + ] + } + }, + "notes": { + "title": "Funding Agency Metadata", + "description": "Add metadata associated with funding agency credits for a resource in the format provided. Please separate multiple entries with an empty line.", + "type": "string", + "default": "Funding Agency Name: \nAward Title: \nAward Number: \nFunding Agency URL: ", + "options": { "placeholder": "Funding Agency Name: \nAward Title: \nAward Number: \nFunding Agency URL: \n\nFunding Agency Name: \nAward Title: \nAward Number: \nFunding Agency URL: " } + }, + "keywords": { + "title": "Keywords", + "type": "array", + "description": "Free text keywords.", + "minItems": 2, + "uniqueItems": true, + "items": { + "title": "Keyword", + "type": "string" + }, + "default": ["CZNet"], + "contains": { + "enum": ["CZNet"] + } + }, + "license": { + "title": "License", + "type": "string", + "description": "License for embargoed/open access content.", + "options": { "hasAutoComplete": true, "placeholder": "Start typing a license name..." }, + "oneOf": [ + { "const": "AAL", "title": "Attribution Assurance Licenses"}, + { "const": "AFL-3.0", "title": "Academic Free License 3.0"}, + { "const": "AGPL-3.0", "title": "GNU Affero General Public License v3"}, + { "const": "APL-1.0", "title": "Adaptive Public License 1.0"}, + { "const": "APSL-2.0", "title": "Apple Public Source License 2.0"}, + { "const": "Against-DRM", "title": "Against DRM"}, + { "const": "Apache-1.1", "title": "Apache Foundation"}, + { "const": "Apache-2.0", "title": "Apache Software License 2.0"}, + { "const": "Artistic-2.0", "title": "Artistic License 2.0"}, + { "const": "BSD-2-Clause", "title": "BSD 2-Clause \"Simplified\" or \"FreeBSD\" License (BSD-2-Clause)"}, + { "const": "BSD-3-Clause", "title": "BSD 3-Clause \"New\" or \"Revised\" License (BSD-3-Clause)"}, + { "const": "BSL-1.0", "title": "Boost Software License 1.0"}, + { "const": "BitTorrent-1.1", "title": "BitTorrent Open Source License 1.1"}, + { "const": "CATOSL-1.1", "title": "Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1)"}, + { "const": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0" }, + { "const": "CC-BY-NC-4.0", "title": "Creative Commons Attribution-NonCommercial 4.0" }, + { "const": "CC-BY-NC-ND-4.0", "title": "Attribution-NonCommercial-NoDerivatives 4.0 International" }, + { "const": "CC-BY-NC-SA-4.0", "title": "Attribution-NonCommercial-ShareAlike 4.0 International" }, + { "const": "CC-BY-ND-4.0", "title": "Attribution-NoDerivatives 4.0 International" }, + { "const": "CC-BY-SA-4.0", "title": "Creative Commons Attribution Share-Alike 4.0" }, + { "const": "CC0-1.0", "title": "CC0 1.0"}, + { "const": "CDDL-1.0", "title": "Common Development and Distribution License 1.0"}, + { "const": "CECILL-2.1", "title": "CeCILL License 2.1"}, + { "const": "CNRI-Python", "title": "CNRI Python License"}, + { "const": "CPAL-1.0", "title": "Common Public Attribution License 1.0"}, + { "const": "CUA-OPL-1.0", "title": "CUA Office Public License 1.0"}, + { "const": "DSL", "title": "Design Science License"}, + { "const": "ECL-2.0", "title": "Educational Community License 2.0"}, + { "const": "EFL-2.0", "title": "Eiffel Forum License 2.0"}, + { "const": "EPL-1.0", "title": "Eclipse Public License 1.0"}, + { "const": "EPL-2.0", "title": "Eclipse Public License 2.0"}, + { "const": "EUDatagrid", "title": "EU DataGrid Software License"}, + { "const": "EUPL-1.1", "title": "European Union Public License 1.1"}, + { "const": "Entessa", "title": "Entessa Public License"}, + { "const": "FAL-1.3", "title": "Free Art License 1.3"}, + { "const": "Fair", "title": "Fair License"}, + { "const": "Frameworx-1.0", "title": "Frameworx License 1.0"}, + { "const": "GFDL-1.3-no-cover-texts-no-invariant-sections", "title": "GNU Free Documentation License 1.3 with no cover texts and no invariant sections"}, + { "const": "GPL-2.0", "title": "GNU General Public License 2.0"}, + { "const": "GPL-3.0", "title": "GNU General Public License 3.0"}, + { "const": "HPND", "title": "Historical Permission Notice and Disclaimer"}, + { "const": "IPA", "title": "IPA Font License"}, + { "const": "IPL-1.0", "title": "IBM Public License 1.0"}, + { "const": "ISC", "title": "ISC License"}, + { "const": "Intel", "title": "Intel Open Source License"}, + { "const": "LGPL-2.1", "title": "GNU Lesser General Public License 2.1"}, + { "const": "LGPL-3.0", "title": "GNU Lesser General Public License 3.0"}, + { "const": "LO-FR-2.0", "title": "Open License 2.0"}, + { "const": "LPL-1.0", "title": "Lucent Public License (\"Plan9\") 1.0"}, + { "const": "LPL-1.02", "title": "Lucent Public License 1.02"}, + { "const": "LPPL-1.3c", "title": "LaTeX Project Public License 1.3c"}, + { "const": "MIT", "title": "MIT License"}, + { "const": "MPL-1.0", "title": "Mozilla Public License 1.0"}, + { "const": "MPL-1.1", "title": "Mozilla Public License 1.1"}, + { "const": "MPL-2.0", "title": "Mozilla Public License 2.0"}, + { "const": "MS-PL", "title": "Microsoft Public License"}, + { "const": "MS-RL", "title": "Microsoft Reciprocal License"}, + { "const": "MirOS", "title": "MirOS Licence"}, + { "const": "Motosoto", "title": "Motosoto License"}, + { "const": "Multics", "title": "Multics License"}, + { "const": "NASA-1.3", "title": "NASA Open Source Agreement 1.3"}, + { "const": "NCSA", "title": "University of Illinois/NCSA Open Source License"}, + { "const": "NGPL", "title": "Nethack General Public License"}, + { "const": "NPOSL-3.0", "title": "Non-Profit Open Software License 3.0"}, + { "const": "NTP", "title": "NTP License"}, + { "const": "Naumen", "title": "Naumen Public License"}, + { "const": "Nokia", "title": "Nokia Open Source License"}, + { "const": "OCLC-2.0", "title": "OCLC Research Public License 2.0"}, + { "const": "ODC-BY-1.0", "title": "Open Data Commons Attribution License 1.0"}, + { "const": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0"}, + { "const": "OFL-1.1", "title": "Open Font License 1.1"}, + { "const": "OGL-Canada-2.0", "title": "Open Government License 2.0 (Canada)"}, + { "const": "OGL-UK-1.0", "title": "Open Government Licence 1.0 (United Kingdom)"}, + { "const": "OGL-UK-2.0", "title": "Open Government Licence 2.0 (United Kingdom)"}, + { "const": "OGL-UK-3.0", "title": "Open Government Licence 3.0 (United Kingdom)"}, + { "const": "OGTSL", "title": "Open Group Test Suite License"}, + { "const": "OSL-3.0", "title": "Open Software License 3.0"}, + { "const": "PDDL-1.0", "title": "Open Data Commons Public Domain Dedication and Licence 1.0"}, + { "const": "PHP-3.0", "title": "PHP License 3.0"}, + { "const": "PostgreSQL", "title": "PostgreSQL License"}, + { "const": "Python-2.0", "title": "Python License 2.0"}, + { "const": "QPL-1.0", "title": "Q Public License 1.0"}, + { "const": "RPL-1.5", "title": "Reciprocal Public License 1.5"}, + { "const": "RPSL-1.0", "title": "RealNetworks Public Source License 1.0"}, + { "const": "RSCPL", "title": "Ricoh Source Code Public License"}, + { "const": "SISSL", "title": "Sun Industry Standards Source License 1.1"}, + { "const": "SPL-1.0", "title": "Sun Public License 1.0"}, + { "const": "SimPL-2.0", "title": "Simple Public License 2.0"}, + { "const": "Sleepycat", "title": "Sleepycat License"}, + { "const": "Talis", "title": "Talis Community License"}, + { "const": "Unlicense", "title": "Unlicense"}, + { "const": "VSL-1.0", "title": "Vovida Software License 1.0"}, + { "const": "W3C", "title": "W3C License"}, + { "const": "WXwindows", "title": "wxWindows Library License"}, + { "const": "Watcom-1.0", "title": "Sybase Open Watcom Public License 1.0"}, + { "const": "Xnet", "title": "X.Net License"}, + { "const": "ZPL-2.0", "title": "Zope Public License 2.0"}, + { "const": "Zlib", "title": "zlib/libpng license"}, + { "const": "dli-model-use", "title": "Statistics Canada: Data Liberation Initiative (DLI) - Model Data Use Licence"}, + { "const": "geogratis", "title": "Geogratis"}, + { "const": "hesa-withrights", "title": "Higher Education Statistics Agency Copyright with data.gov.uk rights"}, + { "const": "localauth-withrights", "title": "Local Authority Copyright with data.gov.uk rights"}, + { "const": "met-office-cp", "title": "Met Office UK Climate Projections Licence Agreement"}, + { "const": "mitre", "title": "MITRE Collaborative Virtual Workspace License (CVW License)"}, + { "const": "notspecified", "title": "License Not Specified"}, + { "const": "other-at", "title": "Other (Attribution)"}, + { "const": "other-closed", "title": "Other (Not Open)"}, + { "const": "other-nc", "title": "Other (Non-Commercial)"}, + { "const": "other-open", "title": "Other (Open)"}, + { "const": "other-pd", "title": "Other (Public Domain)"}, + { "const": "ukclickusepsi", "title": "UK Click Use PSI"}, + { "const": "ukcrown", "title": "UK Crown Copyright"}, + { "const": "ukcrown-withrights", "title": "UK Crown Copyright with data.gov.uk rights"}, + { "const": "ukpsi", "title": "UK PSI Public Sector Information"} + ], + "default": "CC-BY-4.0" + }, + "publication_date": { + "title": "Publication date", + "type": "string", + "description": "", + "format": "date" + }, + "references": { + "title": "References", + "type": "array", + "options": { "delimeter": false, "placeholder": "e.g. 'Cranmer, Kyle et al. (2014). Decouple software associated to arXiv:1401.0080.'" }, + "description": "Raw textual references for related publications and datasets when identifier is not known.", + "items": { + "title": "Reference string", + "type": "string", + "description": "A string providing the full reference for the related item." + } + }, + "related_identifiers": { + "title": "Related identifiers", + "type": "array", + "description": "Identifiers of related publications and datasets.", + "items": { + "type": "object", + "properties": { + "identifier": { + "title": "Identifier", + "type": "string", + "description": "Identifier of the related publication or dataset.", + "options": { + "placeholder": "e.g. '10.1234/foobar.567890'" + } + }, + "relation": { + "title": "Relationship type", + "type": "string", + "description": "The type of relationship between this item and the related item.", + "options": { "hasAutoComplete": true, "placeholder": "Start typing to autocomplete..." }, + "oneOf": [ + { "const": "isCitedBy", "title": "cites this upload"}, + { "const": "cites", "title": "is cited by this upload"}, + { "const": "isSupplementTo", "title": "is supplemented by this upload"}, + { "const": "isSupplementedBy", "title": "is a supplement to this upload"}, + { "const": "isContinuedBy", "title": "continues this upload"}, + { "const": "continues", "title": "is continued by this upload"}, + { "const": "isDescribedBy", "title": "describes this upload"}, + { "const": "describes", "title": "is described by this upload"}, + { "const": "hasMetadata", "title": "has additional metadata from this upload"}, + { "const": "isMetadataFor", "title": "is additional metadata for this upload"}, + { "const": "isNewVersionOf", "title": "is previous version of this upload"}, + { "const": "isPreviousVersionOf", "title": "is new version of this upload"}, + { "const": "isPartOf", "title": "has this upload as part"}, + { "const": "hasPart", "title": "is part of this upload"}, + { "const": "isReferencedBy", "title": "references this upload"}, + { "const": "references", "title": "is referenced by this upload"}, + { "const": "isDocumentedBy", "title": "documents this upload"}, + { "const": "documents", "title": "is documented by this upload"}, + { "const": "isCompiledBy", "title": "compiled/created this upload"}, + { "const": "compiles", "title": "is compiled/created by this upload"}, + { "const": "isVariantFormOf", "title": "is a variant or different form of this upload"}, + { "const": "isOrignialFormOf", "title": "is an original form of this upload"}, + { "const": "isIdenticalTo", "title": "is identical to this upload"}, + { "const": "isReviewedBy", "title": "reviews this upload"}, + { "const": "reviews", "title": "is reviewed by this upload"}, + { "const": "isDerivedFrom", "title": "is the source this upload is derived from"}, + { "const": "isSourceOf", "title": "has this upload as its source"}, + { "const": "requires", "title": "is required by this upload"}, + { "const": "isRequiredBy", "title": "requires this upload"}, + { "const": "isObsoletedBy", "title": "replaces this upload"}, + { "const": "obsoletes", "title": "is replaced by this upload"}, + { "const": "isPublishedIn", "title": "published this upload"} + ] + }, + "resource_type": { + "title": "Resource type", + "type": "string", + "description": "Resource type of the related identifier.", + "options": { }, + "oneOf": [ + { "const": "undefined", "title": "N/A" }, + { "const": "", "title": "", "divider": true }, + { "const": "", "title": "", "header": "Publication" }, + { "const": "publication-annotationcollection", "title": "Annotation collection" }, + { "const": "publication-book", "title": "Book" }, + { "const": "publication-section", "title": "Book section" }, + { "const": "publication-conferencepaper", "title": "Conference paper" }, + { "const": "publication-datamanagementplan", "title": "Data management plan" }, + { "const": "publication-article", "title": "Journal article" }, + { "const": "publication-other", "title": "Other" }, + { "const": "publication-patent", "title": "Patent" }, + { "const": "publication-preprint", "title": "Preprint" }, + { "const": "publication-deliverable", "title": "Project deliverable" }, + { "const": "publication-milestone", "title": "Project milestone" }, + { "const": "publication-proposal", "title": "Proposal" }, + { "const": "publication-report", "title": "Report" }, + { "const": "publication-softwaredocumentation", "title": "Software documentation" }, + { "const": "publication-taxonomictreatment", "title": "Taxonomic treatment" }, + { "const": "publication-technicalnote", "title": "Technical note" }, + { "const": "publication-thesis", "title": "Thesis" }, + { "const": "publication-workingpaper", "title": "Working paper" }, + { "const": "", "title": "", "divider": true }, + { "const": "", "title": "", "header": "Image" }, + { "const": "image-diagram", "title": "Diagram" }, + { "const": "image-drawing", "title": "Drawing" }, + { "const": "image-figure", "title": "Figure" }, + { "const": "image-other", "title": "Other" }, + { "const": "image-photo", "title": "Photo" }, + { "const": "image-plot", "title": "Plot" }, + { "const": "", "title": "", "divider": true }, + { "const": "lesson", "title": "Lesson" }, + { "const": "other", "title": "Other" }, + { "const": "physicalobject", "title": "Physical object" }, + { "const": "poster", "title": "Poster" }, + { "const": "presentation", "title": "Presentation" }, + { "const": "software", "title": "Software" }, + { "const": "video", "title": "Video/Audio" }, + { "const": "workflow", "title": "Workflow" } + ] + } + }, + "required": [ + "identifier", + "relation" + ] + } + }, + "resource_type": { + "title": "Resource type", + "type": "object", + "description": "Record resource type.", + "additionalProperties": false, + "properties": { + "openaire_subtype": { + "title": "OpenAIRE subtype", + "type": "string", + "description": "OpenAIRE-specific resource type." + }, + "subtype": { + "title": "Subtype", + "type": "string", + "description": "Specific resource type." + }, + "type": { + "title": "General resource type", + "type": "string", + "description": "General resource type.", + "default": "publication" + } + }, + "required": [ + "type" + ] + }, + "subjects": { + "title": "Subjects from specific vocabularies", + "type": "array", + "description": "Subjects from a taxonomy or controlled vocabulary.", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "identifier": { + "title": "Term identifier", + "type": "string", + "description": "Subjects term identifier (e.g., a URL)." + }, + "term": { + "title": "Subject term", + "type": "string", + "description": "Subject term value." + } + } + } + }, + "title": { + "title": "Title", + "type": "string", + "description": "Descriptive title for the record." + }, + "version": { + "title": "Version", + "type": "string", + "description": "Record version tag. Mostly relevant for software and dataset uploads. Any string will be accepted, but semantically-versioned tag is recommended." + }, + "upload_type": { + "additionalProperties": false, + "default": "dataset", + "description": "Record upload type.", + "enum": [ + "publication", + "poster", + "presentation", + "dataset", + "image", + "video", + "software", + "lesson", + "physicalobject", + "other" + ], + "type": "string" + } + }, + "required": [ + "title", + "description", + "keywords", + "notes", + "access_right", + "license" + ] +} \ No newline at end of file diff --git a/dspback/schemas/zenodo/uischema.json b/dspback/schemas/zenodo/uischema.json new file mode 100644 index 0000000..575acc1 --- /dev/null +++ b/dspback/schemas/zenodo/uischema.json @@ -0,0 +1,139 @@ +{ + "type": "VerticalLayout", + "elements": [ + { + "type": "Group", + "label": "Basic Information", + "elements": [ + { + "type": "Control", + "scope": "#/properties/title" + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/version" + }, + { + "type": "Control", + "scope": "#/properties/upload_type", + "rule": { + "effect": "DISABLE", + "condition": { + "scope": "#/properties/upload_type" + } + } + } + ] + }, + { + "type": "Control", + "scope": "#/properties/description", + "options": { + "multi": true + } + }, + { + "type": "Control", + "scope": "#/properties/keywords" + }, + { + "type": "Control", + "scope": "#/properties/communities", + "options": { "useTableLayout": true } + } + ] + }, + { + "type": "Control", + "scope": "#/properties/creators", + "options": { + "elementLabelProp": ["name"] + } + }, + { + "type": "Control", + "scope": "#/properties/contributors", + "options": { + "elementLabelProp": ["name"] + } + }, + { + "type": "Group", + "label": "Related Resource Information", + "elements":[ + { + "type": "Control", + "scope": "#/properties/references", + "options": { + "useArrayLayout": true, + "showSortButtons": true + } + }, + { + "type": "Control", + "scope": "#/properties/related_identifiers", + "options": { "useTableLayout": true } + } + ] + }, + { + "type": "Group", + "label": "License", + "elements": [ + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "VerticalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/access_right", + "options": { + "format": "radio" + } + }, + { + "type": "Control", + "scope": "#/properties/embargo_date", + "rule": { + "effect": "DISABLE", + "condition": { + "scope": "#/properties/access_right", + "schema": { + "enum": ["open"] + } + } + } + } + ] + }, + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": "#/properties/license" + } + ] + } + ] + } + ] + }, + { + "type": "Control", + "scope": "#/properties/subjects" + }, + { + "type": "Control", + "scope": "#/properties/notes", + "options": { + "multi": true + } + } + ] +} \ No newline at end of file From 1b992582bfab3c95ee10fbd7c89fdf34041abeeb Mon Sep 17 00:00:00 2001 From: Scott Black Date: Fri, 26 May 2023 09:36:31 -0600 Subject: [PATCH 03/11] add submissions report management command --- management/submissions_report.py | 81 ++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 management/submissions_report.py diff --git a/management/submissions_report.py b/management/submissions_report.py new file mode 100644 index 0000000..09eceba --- /dev/null +++ b/management/submissions_report.py @@ -0,0 +1,81 @@ +import asyncio + +import motor +from beanie import init_beanie + +from dspback.config import get_settings +from dspback.pydantic_schemas import User, Submission +from dspback.utils.jsonld.clusters import cluster_by_id + +''' +This script generates a report for the number of discoverable submissions, funding identifiers and clusters. + +Example call: + +docker exec dspback python management/submission_report.py +''' + +async def initiaize_beanie(): + db = motor.motor_asyncio.AsyncIOMotorClient(get_settings().mongo_url) + await init_beanie( + database=db[get_settings().mongo_database], document_models=[User, Submission] + ) + return db[get_settings().mongo_database] + +async def main(): + db = await initiaize_beanie() + + submission_count_by_repository = {} + test_submission_count_by_repository = {} + submission_count_by_cluster = {} + funding_by_cluster = {} + private_document_count = 0 + discoverable_documents_count = 0 + for submission in await Submission.all().to_list(): + if "test" == submission.title.lower() or "asdf" in submission.title: + submission_count = test_submission_count_by_repository.get(str(submission.repo_type), 0) + test_submission_count_by_repository[str(submission.repo_type)] = submission_count + 1 + else: + submission_count = submission_count_by_repository.get(str(submission.repo_type), 0) + submission_count_by_repository[str(submission.repo_type)] = submission_count + 1 + + discovery_document = await db["discovery"].find_one({"repository_identifier": submission.identifier}) + if discovery_document: + discoverable_documents_count = discoverable_documents_count + 1 + for cluster in discovery_document.get("clusters", []): + cluster_count = submission_count_by_cluster.get(cluster, 0) + submission_count_by_cluster[cluster] = cluster_count + 1 + + if "funding" in discovery_document: + for funding in discovery_document["funding"]: + funding_identifier = funding.get("identifier", None) + + funding_id_match = None + cluster_match = None + for cluster_funding_id, cluster in cluster_by_id.items(): + if cluster_funding_id in funding_identifier: + funding_id_match= cluster_funding_id + cluster_match = cluster + break + if funding_id_match: + funding_ids = funding_by_cluster.get(cluster, set()) + funding_ids.update([funding_id_match]) + funding_by_cluster[cluster_match] = funding_ids + else: + private_document_count = private_document_count + 1 + print("Submission Count By Repository") + print(submission_count_by_repository) + print("\nTest submission count by repository") + print(test_submission_count_by_repository) + print("\nSubmission count by cluster") + print(submission_count_by_cluster) + print("\nSubmission Funding identifiers by cluster") + print(funding_by_cluster) + print("\nNumber of documents not discoverable") + print(private_document_count) + print("\nNumber of documents discoverable") + print(discoverable_documents_count) + + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file From a544b1e3140ccfd9353349c58309570ad2d154ec Mon Sep 17 00:00:00 2001 From: Scott Black Date: Fri, 26 May 2023 09:47:01 -0600 Subject: [PATCH 04/11] add submission count by funding identifier report --- management/submissions_report.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/management/submissions_report.py b/management/submissions_report.py index 09eceba..67d5be2 100644 --- a/management/submissions_report.py +++ b/management/submissions_report.py @@ -29,6 +29,7 @@ async def main(): test_submission_count_by_repository = {} submission_count_by_cluster = {} funding_by_cluster = {} + submission_count_by_funding = {} private_document_count = 0 discoverable_documents_count = 0 for submission in await Submission.all().to_list(): @@ -61,16 +62,20 @@ async def main(): funding_ids = funding_by_cluster.get(cluster, set()) funding_ids.update([funding_id_match]) funding_by_cluster[cluster_match] = funding_ids + submission_count = submission_count_by_funding.get(cluster_match, 0) + submission_count_by_funding[cluster_match] = submission_count + 1 else: private_document_count = private_document_count + 1 - print("Submission Count By Repository") + print("Submission Count By Repository (Discoverable and private)") print(submission_count_by_repository) print("\nTest submission count by repository") print(test_submission_count_by_repository) - print("\nSubmission count by cluster") + print("\nSubmission count by cluster (Discoverable Submissions)") print(submission_count_by_cluster) - print("\nSubmission Funding identifiers by cluster") + print("\nSubmission Funding identifiers by cluster (Discoverable Submissions)") print(funding_by_cluster) + print("\nSubmission count by funding identifier (Discoverable Submissions)") + print(submission_count_by_funding) print("\nNumber of documents not discoverable") print(private_document_count) print("\nNumber of documents discoverable") From a88f5c6f30fe36fea9fd1b19168ea8f364de13e1 Mon Sep 17 00:00:00 2001 From: Scott Black Date: Tue, 30 May 2023 09:23:11 -0600 Subject: [PATCH 05/11] write out a table for the report management command --- management/submissions_report.py | 50 ++++++++++++-------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/management/submissions_report.py b/management/submissions_report.py index 67d5be2..4131692 100644 --- a/management/submissions_report.py +++ b/management/submissions_report.py @@ -28,11 +28,10 @@ async def main(): submission_count_by_repository = {} test_submission_count_by_repository = {} submission_count_by_cluster = {} - funding_by_cluster = {} - submission_count_by_funding = {} - private_document_count = 0 discoverable_documents_count = 0 + table = [["id", "repository", "discoverable", "funding", "cluster"]] for submission in await Submission.all().to_list(): + discoverable = False if "test" == submission.title.lower() or "asdf" in submission.title: submission_count = test_submission_count_by_repository.get(str(submission.repo_type), 0) test_submission_count_by_repository[str(submission.repo_type)] = submission_count + 1 @@ -42,44 +41,31 @@ async def main(): discovery_document = await db["discovery"].find_one({"repository_identifier": submission.identifier}) if discovery_document: + discoverable = True discoverable_documents_count = discoverable_documents_count + 1 for cluster in discovery_document.get("clusters", []): cluster_count = submission_count_by_cluster.get(cluster, 0) submission_count_by_cluster[cluster] = cluster_count + 1 - + funding_identifiers = [] + clusters = [] if "funding" in discovery_document: for funding in discovery_document["funding"]: funding_identifier = funding.get("identifier", None) - - funding_id_match = None - cluster_match = None + funding_identifiers.append(funding_identifier) for cluster_funding_id, cluster in cluster_by_id.items(): if cluster_funding_id in funding_identifier: - funding_id_match= cluster_funding_id - cluster_match = cluster - break - if funding_id_match: - funding_ids = funding_by_cluster.get(cluster, set()) - funding_ids.update([funding_id_match]) - funding_by_cluster[cluster_match] = funding_ids - submission_count = submission_count_by_funding.get(cluster_match, 0) - submission_count_by_funding[cluster_match] = submission_count + 1 - else: - private_document_count = private_document_count + 1 - print("Submission Count By Repository (Discoverable and private)") - print(submission_count_by_repository) - print("\nTest submission count by repository") - print(test_submission_count_by_repository) - print("\nSubmission count by cluster (Discoverable Submissions)") - print(submission_count_by_cluster) - print("\nSubmission Funding identifiers by cluster (Discoverable Submissions)") - print(funding_by_cluster) - print("\nSubmission count by funding identifier (Discoverable Submissions)") - print(submission_count_by_funding) - print("\nNumber of documents not discoverable") - print(private_document_count) - print("\nNumber of documents discoverable") - print(discoverable_documents_count) + clusters.append(cluster) + submission_row = [submission.identifier, submission.repo_type.name, discoverable, funding_identifiers, clusters] + table.append(submission_row) + import csv + with open('filename.csv', "w") as f: + filewriter = csv.writer(f) + for row in table: + filewriter.writerow(row) + + + + if __name__ == "__main__": From 07cc5b69d987f9991bd712c171efe1585d2c16ef Mon Sep 17 00:00:00 2001 From: pkdash Date: Thu, 22 Jun 2023 14:50:35 -0400 Subject: [PATCH 06/11] [#106] validating temporal coverage end date --- dspback/pydantic_schemas.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dspback/pydantic_schemas.py b/dspback/pydantic_schemas.py index efc44cb..7dcaf7d 100644 --- a/dspback/pydantic_schemas.py +++ b/dspback/pydantic_schemas.py @@ -289,6 +289,14 @@ class TemporalCoverage(BaseModel): start: datetime end: datetime + @validator('end') + def validate_end_date(cls, v, values, **kwargs): + if 'start' in values: + start = values.get('start') + if v < start: + raise ValueError('end date must be greater or equal to start date') + return v + class SpatialCoverage(BaseModel): type: Optional[str] name: Optional[str] From ed329f61dcf68629410eea8e8f8f69ff6cefa145 Mon Sep 17 00:00:00 2001 From: pkdash Date: Thu, 22 Jun 2023 14:52:21 -0400 Subject: [PATCH 07/11] [#106] adding exception handler for pydantic validation error --- dspback/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dspback/api.py b/dspback/api.py index 0f97049..3b8d775 100644 --- a/dspback/api.py +++ b/dspback/api.py @@ -1,11 +1,13 @@ import motor from beanie import init_beanie -from fastapi import FastAPI +from fastapi import FastAPI, status from fastapi.openapi.utils import get_openapi from fastapi.staticfiles import StaticFiles from starlette.middleware.cors import CORSMiddleware from starlette.middleware.sessions import SessionMiddleware from starlette.responses import PlainTextResponse +from pydantic import ValidationError + from dspback.config import get_settings from dspback.dependencies import RepositoryException @@ -50,6 +52,11 @@ async def http_exception_handler(request, exc): return PlainTextResponse(f"Repository exception response[{str(exc.detail)}]", status_code=exc.status_code) +@app.exception_handler(ValidationError) +async def validation_exception_handler(request, exc: ValidationError): + return PlainTextResponse(f"Request data validation errors: {str(exc)}", + status_code=status.HTTP_400_BAD_REQUEST) + @app.on_event("startup") async def startup_db_client(): From 4c1a54f9a35374e333cf6ab9360264df67bef74f Mon Sep 17 00:00:00 2001 From: Maurier Date: Wed, 28 Jun 2023 14:06:07 -0600 Subject: [PATCH 08/11] return 401 in case of unauthorized repository --- dspback/dependencies.py | 8 ++++---- tests/test_authentication.py | 4 ++-- tests/test_metadata_class.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dspback/dependencies.py b/dspback/dependencies.py index 8063e9d..21d95d3 100644 --- a/dspback/dependencies.py +++ b/dspback/dependencies.py @@ -10,7 +10,7 @@ from jose import JWTError, jwt from pydantic import BaseModel from starlette import status -from starlette.status import HTTP_403_FORBIDDEN +from starlette.status import HTTP_401_FORBIDDEN from dspback.config import Settings, get_settings, oauth from dspback.database.procedures import delete_repository_access_token @@ -74,7 +74,7 @@ async def __call__(self, request: Request, access_token: Optional[str] = None) - if not authorization: if self.auto_error: - raise HTTPException(status_code=HTTP_403_FORBIDDEN, detail="Not authenticated") + raise HTTPException(status_code=HTTP_401_FORBIDDEN, detail="Not authenticated") else: return None return param @@ -189,13 +189,13 @@ async def get_current_repository_token( ) -> RepositoryToken: repository_token: RepositoryToken = user.repository_token(repository) if not repository_token: - raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"User has not authorized with {repository}") + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=f"User has not authorized with {repository}") expiration_buffer: int = settings.access_token_expiration_buffer_seconds now = int(datetime.utcnow().timestamp()) if now > repository_token.expires_at: await delete_repository_access_token(repository, user) - raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"User token for {repository} has expired") + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=f"User token for {repository} has expired") if now > repository_token.expires_at - expiration_buffer: if repository_token.refresh_token: client = getattr(oauth, repository) diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 2cc718b..83863bf 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -13,7 +13,7 @@ async def test_submissions_not_logged_in(client_test): response = await client_test.get(url_for(client_test, "get_urls", repository="hydroshare")) assert response.json() == {"detail": "Not authenticated"} - assert response.status_code == 403 + assert response.status_code == 401 async def test_login(client_test): @@ -51,4 +51,4 @@ async def test_logout(client_test, authorize_response): logged_out_response = await client_test.get( url_for(client_test, "get_urls", repository="hydroshare"), follow_redirects=False ) - assert logged_out_response.status_code == 403 + assert logged_out_response.status_code == 401 diff --git a/tests/test_metadata_class.py b/tests/test_metadata_class.py index 8d0d6d8..57ae492 100644 --- a/tests/test_metadata_class.py +++ b/tests/test_metadata_class.py @@ -100,5 +100,5 @@ def test_create_hydroshare_record(user_cookie, hydroshare, authorize_response_hy async def test_unauthorized_hydroshare(client_test, user_cookie, hydroshare): response = await client_test.post(prefix + "/metadata/hydroshare?access_token=" + user_cookie, json=hydroshare) - assert response.status_code == 403 + assert response.status_code == 401 assert response.text == '{"detail":"User has not authorized with hydroshare"}' From e3a51de1cab971b090fc973bc6f42043202d9af7 Mon Sep 17 00:00:00 2001 From: Maurier Date: Wed, 28 Jun 2023 14:13:15 -0600 Subject: [PATCH 09/11] remove specific requirement versions --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c81134e..da4b3a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ cryptography==36.0.2 dnspython==2.2.1 ecdsa==0.17.0 email-validator==1.1.3 -fastapi==0.86.0 +fastapi fastapi-restful==0.4.3 greenlet==1.1.2 h11==0.12.0 @@ -51,7 +51,7 @@ rsa==4.8 six==1.16.0 sniffio==1.2.0 soupsieve==2.3.1 -starlette==0.20.4 +starlette tomli==2.0.1 typing_extensions==4.3.0 urllib3==1.26.9 From 3f31fe0f706ce07c8fbc37e579971dd26099a1be Mon Sep 17 00:00:00 2001 From: Maurier Ramirez Date: Tue, 25 Jul 2023 08:48:20 -0600 Subject: [PATCH 10/11] add format minimum property (#182) --- dspback/schemas/external/schema.json | 56 +++++++++++++++++++++------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/dspback/schemas/external/schema.json b/dspback/schemas/external/schema.json index 104af01..351b137 100644 --- a/dspback/schemas/external/schema.json +++ b/dspback/schemas/external/schema.json @@ -24,9 +24,13 @@ "items": { "type": "string" }, - "default": ["CZNet"], + "default": [ + "CZNet" + ], "contains": { - "enum": ["CZNet"] + "enum": [ + "CZNet" + ] } }, "creators": { @@ -156,14 +160,21 @@ "description": "A datetime object containing the instant corresponding to the commencement of the time interval (ISO8601 formatted date) - YYYY-MM-DDTHH:MM.", "type": "string", "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" } + "options": { + "placeholder": "YYYY-MM-DDTHH:MM" + } }, "end": { "title": "End", "description": "A datetime object containing the instant corresponding to the termination of the time interval (ISO8601 formatted date) - YYYY-MM-DDTHH:MM.", "type": "string", "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" } + "options": { + "placeholder": "YYYY-MM-DDTHH:MM" + }, + "formatMinimum": { + "$data": "1/start" + } } }, "required": [ @@ -179,7 +190,7 @@ "title": "Point Coverage Metadata", "description": "Geographic coverage metadata for a resource or aggregation expressed as a point location", "type": "object", - "options": { + "options": { "detail": { "type": "VerticalLayout", "elements": [ @@ -190,7 +201,11 @@ { "type": "MapLayout", "options": { - "map": { "type": "point", "north": "north", "east": "east" } + "map": { + "type": "point", + "north": "north", + "east": "east" + } }, "elements": [ { @@ -271,7 +286,13 @@ { "type": "MapLayout", "options": { - "map": { "type": "box", "northlimit": "northlimit", "eastlimit": "eastlimit", "southlimit": "southlimit", "westlimit": "westlimit" } + "map": { + "type": "box", + "northlimit": "northlimit", + "eastlimit": "eastlimit", + "southlimit": "southlimit", + "westlimit": "westlimit" + } }, "elements": [ { @@ -300,7 +321,6 @@ "type": "Control", "scope": "#/properties/projection" } - ] } }, @@ -391,14 +411,18 @@ "title": "Date created", "type": "string", "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" }, + "options": { + "placeholder": "YYYY-MM-DDTHH:MM" + }, "description": "The date on which the resource was originally created (ISO8601 formatted date) - YYYY-MM-DDTHH:MM." }, "dateModified": { "title": "Date modified", "type": "string", "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" }, + "options": { + "placeholder": "YYYY-MM-DDTHH:MM" + }, "description": "The date on which the resource was last modified (ISO8601 formatted date) - YYYY-MM-DDTHH:MM." }, "datePublished": { @@ -408,21 +432,25 @@ { "title": "Year", "type": "integer", - "options": { "placeholder": "YYYY" }, + "options": { + "placeholder": "YYYY" + }, "description": "Publication year (YYYY)." }, { "title": "Date", "type": "string", "format": "date-time", - "options": { "placeholder": "YYYY-MM-DDTHH:MM" }, + "options": { + "placeholder": "YYYY-MM-DDTHH:MM" + }, "description": "ISO8601 formatted date (YYYY-MM-DDTHH:MM)." } ] }, "status": { "title": "Data collection is ongoing", - "type": "boolean", + "type": "boolean", "description": "Indicate whether data collection is ongoing for this dataset", "default": false } @@ -605,4 +633,4 @@ "provider", "datePublished" ] -} +} \ No newline at end of file From bb6ad331863f225d7bd22202f7af787e1733e01e Mon Sep 17 00:00:00 2001 From: Scott Black Date: Tue, 25 Jul 2023 10:31:50 -0600 Subject: [PATCH 11/11] correct the 401 status import --- dspback/dependencies.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dspback/dependencies.py b/dspback/dependencies.py index 21d95d3..f878523 100644 --- a/dspback/dependencies.py +++ b/dspback/dependencies.py @@ -10,7 +10,6 @@ from jose import JWTError, jwt from pydantic import BaseModel from starlette import status -from starlette.status import HTTP_401_FORBIDDEN from dspback.config import Settings, get_settings, oauth from dspback.database.procedures import delete_repository_access_token @@ -74,7 +73,7 @@ async def __call__(self, request: Request, access_token: Optional[str] = None) - if not authorization: if self.auto_error: - raise HTTPException(status_code=HTTP_401_FORBIDDEN, detail="Not authenticated") + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Not authenticated") else: return None return param @@ -189,7 +188,9 @@ async def get_current_repository_token( ) -> RepositoryToken: repository_token: RepositoryToken = user.repository_token(repository) if not repository_token: - raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=f"User has not authorized with {repository}") + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, detail=f"User has not authorized with {repository}" + ) expiration_buffer: int = settings.access_token_expiration_buffer_seconds now = int(datetime.utcnow().timestamp())