From 04228f856d94c248d3844de6169cb554ce1bd4a3 Mon Sep 17 00:00:00 2001 From: "Jeffrey N. Johnson" Date: Fri, 17 May 2024 10:01:15 -0700 Subject: [PATCH 01/11] Making a trivial update to the schema file. --- schema/kbase/linkml/credit_metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/kbase/linkml/credit_metadata.yaml b/schema/kbase/linkml/credit_metadata.yaml index e8c01d2..98740c9 100644 --- a/schema/kbase/linkml/credit_metadata.yaml +++ b/schema/kbase/linkml/credit_metadata.yaml @@ -37,7 +37,7 @@ classes: one of the 'name' fields: either 'given_name' and 'family_name' (for a person), or 'name' (for an organization or a person). The 'contributor_role' field takes values from the DataCite and CRediT contributor - roles vocabularies. For more information on these resources and choosing the + roles vocabularies. For more information on these resources and choosing appropriate roles, please see the following links: DataCite contributor roles: https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#7a-contributortype From 327604e5250784edaa10e4160823d08b7e04b1e0 Mon Sep 17 00:00:00 2001 From: "Jeffrey N. Johnson" Date: Fri, 17 May 2024 10:14:11 -0700 Subject: [PATCH 02/11] Fixed a bad identifier. --- .github/workflows/on_schema_update.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/on_schema_update.yaml b/.github/workflows/on_schema_update.yaml index 430a462..a3e9590 100644 --- a/.github/workflows/on_schema_update.yaml +++ b/.github/workflows/on_schema_update.yaml @@ -20,38 +20,39 @@ jobs: schema/kbase/linkml/credit_metadata.yaml - name: Set up python - if: steps.changed-markdown-files.outputs.any_changed == 'true' + if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: actions/setup-python@v4 with: python-version: 3.12 - name: Regenerate JSONSchema bindings for credit metadata schame - if: steps.changed-markdown-files.outputs.any_changed == 'true' + if: steps.metadata-schema-changes.outputs.any_changed == 'true' shell: bash -l {0} run: | pip3 install linkml # and any other bits and pieces required - I think that's it, though gen-json-schema schema/kbase/linkml/credit_metadata.yaml > schema/kbase/jsonschema/credit_metadata.schema.json - name: Commit regenerated JSONSchema bindings - if: steps.changed-markdown-files.outputs.any_changed == 'true' + if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Regenerated JSONSchema bindings for credit metadata schema - name: checkout DTS repo + if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: actions/checkout@v4 with: repository: kbase/dts path: dts - name: Regenerate DTS Golang bindings for credit metadata schame - if: steps.changed-markdown-files.outputs.any_changed == 'true' + if: steps.metadata-schema-changes.outputs.any_changed == 'true' shell: bash -l {0} run: | gen-golang schema/kbase/linkml/credit_metadata.yaml > dts/credit/metadata.go - name: Create DTS pull request with regenerated credit metadata bindings - if: steps.changed-markdown-files.outputs.any_changed == 'true' + if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.PAT }} # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens From f067a87908f056e4d2582a6f4ebb4fd06e0c54f5 Mon Sep 17 00:00:00 2001 From: "Jeffrey N. Johnson" Date: Fri, 17 May 2024 10:44:01 -0700 Subject: [PATCH 03/11] Separating linkml installation and JSONSchema regeneration --- .github/workflows/on_schema_update.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_schema_update.yaml b/.github/workflows/on_schema_update.yaml index a3e9590..61ef3c4 100644 --- a/.github/workflows/on_schema_update.yaml +++ b/.github/workflows/on_schema_update.yaml @@ -25,11 +25,15 @@ jobs: with: python-version: 3.12 + - name: Install linkml + shell: bash -l {0} + run: | + pip3 install linkml + - name: Regenerate JSONSchema bindings for credit metadata schame if: steps.metadata-schema-changes.outputs.any_changed == 'true' shell: bash -l {0} run: | - pip3 install linkml # and any other bits and pieces required - I think that's it, though gen-json-schema schema/kbase/linkml/credit_metadata.yaml > schema/kbase/jsonschema/credit_metadata.schema.json - name: Commit regenerated JSONSchema bindings From 0179c6b393cc9230ec8402d536818ce6fd526718 Mon Sep 17 00:00:00 2001 From: "Jeffrey N. Johnson" Date: Fri, 17 May 2024 10:46:57 -0700 Subject: [PATCH 04/11] A fix for a relationship. --- schema/kbase/linkml/credit_metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/kbase/linkml/credit_metadata.yaml b/schema/kbase/linkml/credit_metadata.yaml index 98740c9..1b05cea 100644 --- a/schema/kbase/linkml/credit_metadata.yaml +++ b/schema/kbase/linkml/credit_metadata.yaml @@ -1126,7 +1126,7 @@ enums: Crossref:Replaces: meaning: Crossref:Replaces title: replaces - Unknown: + kbcm:Unknown: # meaning: Relationship type is unknown title: unknown reachable_from: From e64bb6ea066382dbc2ddd32a9f8260e14049315d Mon Sep 17 00:00:00 2001 From: ialarmedalien Date: Fri, 17 May 2024 11:24:31 -0700 Subject: [PATCH 05/11] Fixing a number of minor linting errors. Updating prefixes. Removing some cruft. Adding credit metadata source." --- schema/kbase/linkml/credit_metadata.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/kbase/linkml/credit_metadata.yaml b/schema/kbase/linkml/credit_metadata.yaml index 1b05cea..164286e 100644 --- a/schema/kbase/linkml/credit_metadata.yaml +++ b/schema/kbase/linkml/credit_metadata.yaml @@ -1126,8 +1126,8 @@ enums: Crossref:Replaces: meaning: Crossref:Replaces title: replaces - kbcm:Unknown: - # meaning: Relationship type is unknown + kbcms:Unknown: + meaning: Relationship type is unknown title: unknown reachable_from: source_ontology: bioportal:DATACITE-VOCAB From fcc6411ffee41f44818e8d286e375c485032e24e Mon Sep 17 00:00:00 2001 From: jeff-cohere Date: Fri, 17 May 2024 19:20:39 +0000 Subject: [PATCH 06/11] Auto-commit black formatting changes --- credit_engine/clients/args.py | 12 ++++++------ credit_engine/clients/base.py | 1 + tests/clients/test_args.py | 1 + tests/clients/test_base_errors.py | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/credit_engine/clients/args.py b/credit_engine/clients/args.py index cc4df8a..4bd5ba6 100644 --- a/credit_engine/clients/args.py +++ b/credit_engine/clients/args.py @@ -47,12 +47,12 @@ class GenericClientArgs(BaseModel, extra="ignore", arbitrary_types_allowed=True) {CE.OutputFormat.JSON, CE.OutputFormat.XML}, const=True ) doi_file: FilePath | None = Field(None) - dois_from_file: conset( - constr(strip_whitespace=True, min_length=3), min_items=1 - ) | None = Field(None) - doi_list: conset( - constr(strip_whitespace=True, min_length=3), min_items=1 - ) | None = Field(None) + dois_from_file: ( + conset(constr(strip_whitespace=True, min_length=3), min_items=1) | None + ) = Field(None) + doi_list: ( + conset(constr(strip_whitespace=True, min_length=3), min_items=1) | None + ) = Field(None) save_files: bool = Field(default=False) # TODO @ialarmedalien: use client's SAMPLE_DATA_DIR as default # https://github.com/kbase/credit_engine/issues/158 diff --git a/credit_engine/clients/base.py b/credit_engine/clients/base.py index 654507e..c1566d7 100644 --- a/credit_engine/clients/base.py +++ b/credit_engine/clients/base.py @@ -1,4 +1,5 @@ """Base functionality for any client retrieving data from a data source.""" + import types from enum import Enum from typing import Any diff --git a/tests/clients/test_args.py b/tests/clients/test_args.py index eb7fb6e..1ad0418 100644 --- a/tests/clients/test_args.py +++ b/tests/clients/test_args.py @@ -1,4 +1,5 @@ """Tests for the ClientArgs classes.""" + import re from pathlib import Path from typing import Any diff --git a/tests/clients/test_base_errors.py b/tests/clients/test_base_errors.py index fb7bd38..f4daeab 100644 --- a/tests/clients/test_base_errors.py +++ b/tests/clients/test_base_errors.py @@ -1,4 +1,5 @@ """Input error tests for retrieve_dois and retrieve_dois_from_unknown.""" + import re import pytest From e3c0221b0c2d177e2786998e6d0a90508ce9ab8a Mon Sep 17 00:00:00 2001 From: ialarmedalien Date: Fri, 17 May 2024 15:03:26 -0700 Subject: [PATCH 07/11] Minor schema edit --- schema/kbase/linkml/credit_metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/kbase/linkml/credit_metadata.yaml b/schema/kbase/linkml/credit_metadata.yaml index 164286e..dd57d94 100644 --- a/schema/kbase/linkml/credit_metadata.yaml +++ b/schema/kbase/linkml/credit_metadata.yaml @@ -1127,7 +1127,7 @@ enums: meaning: Crossref:Replaces title: replaces kbcms:Unknown: - meaning: Relationship type is unknown + # meaning: Relationship type is unknown title: unknown reachable_from: source_ontology: bioportal:DATACITE-VOCAB From e36d86b0f90bfbb3cbacb7088db24af658581dc7 Mon Sep 17 00:00:00 2001 From: ialarmedalien Date: Fri, 17 May 2024 15:05:01 -0700 Subject: [PATCH 08/11] schema edits --- .../jsonschema/credit_metadata.schema.json | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/schema/kbase/jsonschema/credit_metadata.schema.json b/schema/kbase/jsonschema/credit_metadata.schema.json index 5c3fe22..ef03632 100644 --- a/schema/kbase/jsonschema/credit_metadata.schema.json +++ b/schema/kbase/jsonschema/credit_metadata.schema.json @@ -32,7 +32,7 @@ }, "contributor_type": { "$ref": "#/$defs/ContributorType", - "description": "Must be either 'Person' or 'Organization'" + "description": "Must be either 'Person' or 'Organization'." }, "family_name": { "description": "The family name(s) of the contributor.", @@ -67,7 +67,7 @@ "type": "object" }, "ContributorRole": { - "description": "The type of contribution made by a contributor", + "description": "The type of contribution made by a contributor.", "enum": [ "DataCite:ContactPerson", "DataCite:DataCollector", @@ -109,7 +109,7 @@ "type": "string" }, "ContributorType": { - "description": "The type of contributor being represented", + "description": "The type of contributor being represented.", "enum": [ "Person", "Organization" @@ -171,7 +171,7 @@ }, "license": { "$ref": "#/$defs/License", - "description": "Usage license for the resource. Use one of the SPDX license identifiers or provide a link to the license text if no SPDX ID is available.\n\nAll data published at KBase is done so under a Creative Commons 0 or Creative Commons 4.0 license.\n" + "description": "Usage license for the resource. Use one of the SPDX license identifiers or provide a link to the license text if no SPDX ID is available.\n\nAll data published at KBase is done so under a Creative Commons 0 or Creative Commons 4.0 license." }, "publisher": { "$ref": "#/$defs/Organization", @@ -266,7 +266,7 @@ }, "description_type": { "$ref": "#/$defs/DescriptionType", - "description": "The type of text being represented" + "description": "The type of text being represented." }, "language": { "description": "The language in which the description is written, using the appropriate IETF BCP-47 notation.", @@ -280,7 +280,7 @@ "type": "object" }, "DescriptionType": { - "description": "The type of text being represented", + "description": "The type of text being represented.", "enum": [ "abstract", "description", @@ -311,7 +311,7 @@ "type": "object" }, "EventType": { - "description": "The type of date being represented", + "description": "The type of date being represented.", "enum": [ "accepted", "available", @@ -334,18 +334,18 @@ "properties": { "funder": { "$ref": "#/$defs/Organization", - "description": "The funder for the grant or award" + "description": "The funder for the grant or award." }, "grant_id": { - "description": "Code for the grant, assigned by the funder", + "description": "Code for the grant, assigned by the funder.", "type": "string" }, "grant_title": { - "description": "Title for the grant", + "description": "Title for the grant.", "type": "string" }, "grant_url": { - "description": "URL for the grant", + "description": "URL for the grant.", "pattern": "^https?://\\S", "type": "string", "format": "uri" @@ -391,7 +391,7 @@ "description": "Represents an organization.\n\nRecommended resources for organization identifiers and canonical organization names include:\n - Research Organization Registry, http://ror.org\n - International Standard Name Identifier, https://isni.org\n - Crossref Funder Registry, https://www.crossref.org/services/funder-registry/\n\nFor example, the US DOE would be entered as:\n organization_name: United States Department of Energy\n organization_id: ROR:01bj3aw27", "properties": { "organization_id": { - "description": "Persistent unique identifier for the organization in the format :", + "description": "Persistent unique identifier for the organization in the format :.", "pattern": "^[a-zA-Z0-9.-_]+:\\S", "type": "string" }, @@ -421,7 +421,7 @@ }, "relationship_type": { "$ref": "#/$defs/RelationshipType", - "description": "The relationship between the ID and some other entity.\nFor example, when a PermanentID class is used to represent objects in the CreditMetadata field 'related_identifiers', the 'relationship_type' field captures the relationship between the CreditMetadata and this ID.\n" + "description": "The relationship between the ID and some other entity.\nFor example, when a PermanentID class is used to represent objects in the CreditMetadata field 'related_identifiers', the 'relationship_type' field captures the relationship between the CreditMetadata and this ID." } }, "required": [ @@ -432,8 +432,38 @@ "type": "object" }, "RelationshipType": { - "description": "The relationship between two entities", + "description": "The relationship between two entities.", "enum": [ + "Crossref:BasedOnData", + "Crossref:Finances", + "Crossref:HasComment", + "Crossref:HasDerivation", + "Crossref:HasExpression", + "Crossref:HasFormat", + "Crossref:HasManifestation", + "Crossref:HasManuscript", + "Crossref:HasPreprint", + "Crossref:HasRelatedMaterial", + "Crossref:HasReply", + "Crossref:HasReview", + "Crossref:HasTranslation", + "Crossref:IsBasedOn", + "Crossref:IsBasisFor", + "Crossref:IsCommentOn", + "Crossref:IsDataBasisFor", + "Crossref:IsExpressionOf", + "Crossref:IsFinancedBy", + "Crossref:IsFormatOf", + "Crossref:IsManifestationOf", + "Crossref:IsManuscriptOf", + "Crossref:IsPreprintOf", + "Crossref:IsRelatedMaterial", + "Crossref:IsReplacedBy", + "Crossref:IsReplyTo", + "Crossref:IsReviewOf", + "Crossref:IsSameAs", + "Crossref:IsTranslationOf", + "Crossref:Replaces", "DataCite:Cites", "DataCite:Compiles", "DataCite:Continues", @@ -458,45 +488,14 @@ "DataCite:IsReferencedBy", "DataCite:IsRequiredBy", "DataCite:IsReviewedBy", - "DataCite:IsSourceOf", - "DataCite:IsSupplementTo", "DataCite:IsSupplementedBy", + "DataCite:IsSupplementTo", "DataCite:IsVariantFormOf", "DataCite:IsVersionOf", "DataCite:Obsoletes", "DataCite:References", "DataCite:Requires", "DataCite:Reviews", - "Crossref:BasedOnData", - "Crossref:Finances", - "Crossref:HasComment", - "Crossref:HasDerivation", - "Crossref:HasExpression", - "Crossref:HasFormat", - "Crossref:HasManifestation", - "Crossref:HasManuscript", - "Crossref:HasPreprint", - "Crossref:HasRelatedMaterial", - "Crossref:HasReply", - "Crossref:HasReview", - "Crossref:HasTranslation", - "Crossref:IsBasedOn", - "Crossref:IsBasisFor", - "Crossref:IsCommentOn", - "Crossref:IsDataBasisFor", - "Crossref:IsExpressionOf", - "Crossref:IsFinancedBy", - "Crossref:IsFormatOf", - "Crossref:IsManifestationOf", - "Crossref:IsManuscriptOf", - "Crossref:IsPreprintOf", - "Crossref:IsRelatedMaterial", - "Crossref:IsReplacedBy", - "Crossref:IsReplyTo", - "Crossref:IsReviewOf", - "Crossref:IsSameAs", - "Crossref:IsTranslationOf", - "Crossref:Replaces", "unknown" ], "title": "RelationshipType", @@ -519,7 +518,7 @@ "type": "string" }, "title": { - "description": "A string used as a title for a resource", + "description": "A string used as a title for a resource.", "type": "string" }, "title_type": { From 0111c9e31a5e99adb99ddde4dae87512e30e42b6 Mon Sep 17 00:00:00 2001 From: ialarmedalien Date: Fri, 17 May 2024 22:05:51 +0000 Subject: [PATCH 09/11] Regenerated JSONSchema bindings for credit metadata schema --- .../jsonschema/credit_metadata.schema.json | 239 ++++++++---------- 1 file changed, 109 insertions(+), 130 deletions(-) diff --git a/schema/kbase/jsonschema/credit_metadata.schema.json b/schema/kbase/jsonschema/credit_metadata.schema.json index ef03632..37bca54 100644 --- a/schema/kbase/jsonschema/credit_metadata.schema.json +++ b/schema/kbase/jsonschema/credit_metadata.schema.json @@ -1,15 +1,8 @@ { - "$id": "https://github.com/kbase/credit_engine/schema/kbase/linkml", - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalProperties": false, - "metamodel_version": "1.7.0", - "title": "KBase Credit Metadata Schema", - "type": "object", - "version": "0.0.1-commonmeta", "$defs": { "Contributor": { "additionalProperties": false, - "description": "Represents a contributor to the resource.\n\nContributors must have a 'contributor_type', either 'Person' or 'Organization', and\none of the 'name' fields: either 'given_name' and 'family_name' (for a person), or 'name' (for an organization or a person).\n\nThe 'contributor_role' field takes values from the DataCite and CRediT contributor\nroles vocabularies. For more information on these resources and choosing the\nappropriate roles, please see the following links:\n\nDataCite contributor roles: https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#7a-contributortype\n\nCRediT contributor role taxonomy: https://credit.niso.org", + "description": "Represents a contributor to the resource.\n\nContributors must have a 'contributor_type', either 'Person' or 'Organization', and\none of the 'name' fields: either 'given_name' and 'family_name' (for a person), or 'name' (for an organization or a person).\n\nThe 'contributor_role' field takes values from the DataCite and CRediT contributor\nroles vocabularies. For more information on these resources and choosing\nappropriate roles, please see the following links:\n\nDataCite contributor roles: https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#7a-contributortype\n\nCRediT contributor role taxonomy: https://credit.niso.org", "properties": { "affiliations": { "description": "List of organizations with which the contributor is affiliated. For contributors that represent an organization, this may be a parent organization (e.g. KBase, US DOE; Arkin lab, LBNL).", @@ -32,7 +25,7 @@ }, "contributor_type": { "$ref": "#/$defs/ContributorType", - "description": "Must be either 'Person' or 'Organization'." + "description": "Must be either 'Person' or 'Organization'" }, "family_name": { "description": "The family name(s) of the contributor.", @@ -48,26 +41,13 @@ } }, "required": [ - "contributor_type" - ], - "anyOf": [ - { - "required": [ - "name" - ] - }, - { - "required": [ - "family_name", - "given_name" - ] - } + "name" ], "title": "Contributor", "type": "object" }, "ContributorRole": { - "description": "The type of contribution made by a contributor.", + "description": "The type of contribution made by a contributor", "enum": [ "DataCite:ContactPerson", "DataCite:DataCollector", @@ -90,26 +70,26 @@ "DataCite:Supervisor", "DataCite:WorkPackageLeader", "DataCite:Other", - "CRediT:conceptualization", - "CRediT:data-curation", - "CRediT:formal-analysis", - "CRediT:funding-acquisition", - "CRediT:investigation", - "CRediT:methodology", - "CRediT:project-administration", - "CRediT:resources", - "CRediT:software", - "CRediT:supervision", - "CRediT:validation", - "CRediT:visualization", - "CRediT:writing-original-draft", - "CRediT:writing-review-editing" + "crcr:conceptualization", + "crcr:data-curation", + "crcr:formal-analysis", + "crcr:funding-acquisition", + "crcr:investigation", + "crcr:methodology", + "crcr:project-administration", + "crcr:resources", + "crcr:software", + "crcr:supervision", + "crcr:validation", + "crcr:visualization", + "crcr:writing-original-draft", + "crcr:writing-review-editing" ], "title": "ContributorRole", "type": "string" }, "ContributorType": { - "description": "The type of contributor being represented.", + "description": "The type of contributor being represented", "enum": [ "Person", "Organization" @@ -131,8 +111,7 @@ "content_url": { "description": "The URL of the content of the resource.", "items": { - "type": "string", - "format": "uri" + "type": "string" }, "type": "array" }, @@ -143,6 +122,13 @@ }, "type": "array" }, + "credit_metadata_source": { + "description": "A list of CURIEs, URIs, or free text entries denoting the source of the credit metadata.", + "items": { + "type": "string" + }, + "type": "array" + }, "dates": { "description": "A list of relevant lifecycle events for the resource. Note that these dates apply only to the resource itself, and not to the creation or update of the credit metadata record for the resource.", "items": { @@ -171,7 +157,7 @@ }, "license": { "$ref": "#/$defs/License", - "description": "Usage license for the resource. Use one of the SPDX license identifiers or provide a link to the license text if no SPDX ID is available.\n\nAll data published at KBase is done so under a Creative Commons 0 or Creative Commons 4.0 license." + "description": "Usage license for the resource. Use one of the SPDX license identifiers or provide a link to the license text if no SPDX ID is available.\n\nAll data published at KBase is done so under a Creative Commons 0 or Creative Commons 4.0 license.\n" }, "publisher": { "$ref": "#/$defs/Organization", @@ -197,8 +183,7 @@ }, "url": { "description": "The URL of the resource.", - "type": "string", - "format": "uri" + "type": "string" }, "version": { "description": "The version of the resource. This must be an absolute version, not a relative version like 'latest'.", @@ -211,18 +196,6 @@ "resource_type", "titles" ], - "anyOf": [ - { - "required": [ - "version" - ] - }, - { - "required": [ - "dates" - ] - } - ], "title": "CreditMetadata", "type": "object" }, @@ -266,7 +239,7 @@ }, "description_type": { "$ref": "#/$defs/DescriptionType", - "description": "The type of text being represented." + "description": "The type of text being represented" }, "language": { "description": "The language in which the description is written, using the appropriate IETF BCP-47 notation.", @@ -280,7 +253,7 @@ "type": "object" }, "DescriptionType": { - "description": "The type of text being represented.", + "description": "The type of text being represented", "enum": [ "abstract", "description", @@ -295,7 +268,7 @@ "properties": { "date": { "description": "The date associated with the event. The date may be in the format YYYY, YYYY-MM, or YYYY-MM-DD.", - "pattern": "^\\d{4}(-\\d{2}){0,2}$", + "pattern": "\\d{4}(-\\d{2}){0,2}", "type": "string" }, "event": { @@ -311,7 +284,7 @@ "type": "object" }, "EventType": { - "description": "The type of date being represented.", + "description": "The type of date being represented", "enum": [ "accepted", "available", @@ -334,26 +307,22 @@ "properties": { "funder": { "$ref": "#/$defs/Organization", - "description": "The funder for the grant or award." + "description": "The funder for the grant or award" }, "grant_id": { - "description": "Code for the grant, assigned by the funder.", + "description": "Code for the grant, assigned by the funder", "type": "string" }, "grant_title": { - "description": "Title for the grant.", + "description": "Title for the grant", "type": "string" }, "grant_url": { - "description": "URL for the grant.", - "pattern": "^https?://\\S", - "type": "string", - "format": "uri" + "description": "URL for the grant", + "pattern": "^[a-zA-Z0-9.-_]+:\\S", + "type": "string" } }, - "required": [ - "funder" - ], "title": "FundingReference", "type": "object" }, @@ -367,22 +336,9 @@ }, "url": { "description": "URL for the license.", - "type": "string", - "format": "uri" + "type": "string" } }, - "anyOf": [ - { - "required": [ - "url" - ] - }, - { - "required": [ - "id" - ] - } - ], "title": "License", "type": "object" }, @@ -391,7 +347,7 @@ "description": "Represents an organization.\n\nRecommended resources for organization identifiers and canonical organization names include:\n - Research Organization Registry, http://ror.org\n - International Standard Name Identifier, https://isni.org\n - Crossref Funder Registry, https://www.crossref.org/services/funder-registry/\n\nFor example, the US DOE would be entered as:\n organization_name: United States Department of Energy\n organization_id: ROR:01bj3aw27", "properties": { "organization_id": { - "description": "Persistent unique identifier for the organization in the format :.", + "description": "Persistent unique identifier for the organization in the format :", "pattern": "^[a-zA-Z0-9.-_]+:\\S", "type": "string" }, @@ -408,7 +364,7 @@ }, "PermanentID": { "additionalProperties": false, - "description": "Represents a persistent unique identifier for an entity, with an optional relationship to some other entity.\n\nThe 'id' field is required; all other fields are optional.\n\nThe values in the 'relationship_type' field come from controlled vocabularies maintained by DataCite and Crossref. See the documentation links below for more details.\n\nDataCite relation types: https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#12b-relationtype\n\nCrossref relation types: https://www.crossref.org/documentation/schema-library/markup-guide-metadata-segments/relationships/", + "description": "Represents a persistent unique identifier for an entity, with an optional relationship to some other entity.\n\nThe 'id' field and 'relationship_type' fields are required.\n\nThe values in the 'relationship_type' field come from controlled vocabularies maintained by DataCite and Crossref. See the documentation links below for more details.\n\nDataCite relation types: https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#12b-relationtype\n\nCrossref relation types: https://www.crossref.org/documentation/schema-library/markup-guide-metadata-segments/relationships/", "properties": { "description": { "description": "Description of that entity.", @@ -421,49 +377,18 @@ }, "relationship_type": { "$ref": "#/$defs/RelationshipType", - "description": "The relationship between the ID and some other entity.\nFor example, when a PermanentID class is used to represent objects in the CreditMetadata field 'related_identifiers', the 'relationship_type' field captures the relationship between the CreditMetadata and this ID." + "description": "The relationship between the ID and some other entity.\nFor example, when a PermanentID class is used to represent objects in the CreditMetadata field 'related_identifiers', the 'relationship_type' field captures the relationship between the CreditMetadata and this ID.\n" } }, "required": [ - "id", - "relationship_type" + "id" ], "title": "PermanentID", "type": "object" }, "RelationshipType": { - "description": "The relationship between two entities.", + "description": "The relationship between two entities", "enum": [ - "Crossref:BasedOnData", - "Crossref:Finances", - "Crossref:HasComment", - "Crossref:HasDerivation", - "Crossref:HasExpression", - "Crossref:HasFormat", - "Crossref:HasManifestation", - "Crossref:HasManuscript", - "Crossref:HasPreprint", - "Crossref:HasRelatedMaterial", - "Crossref:HasReply", - "Crossref:HasReview", - "Crossref:HasTranslation", - "Crossref:IsBasedOn", - "Crossref:IsBasisFor", - "Crossref:IsCommentOn", - "Crossref:IsDataBasisFor", - "Crossref:IsExpressionOf", - "Crossref:IsFinancedBy", - "Crossref:IsFormatOf", - "Crossref:IsManifestationOf", - "Crossref:IsManuscriptOf", - "Crossref:IsPreprintOf", - "Crossref:IsRelatedMaterial", - "Crossref:IsReplacedBy", - "Crossref:IsReplyTo", - "Crossref:IsReviewOf", - "Crossref:IsSameAs", - "Crossref:IsTranslationOf", - "Crossref:Replaces", "DataCite:Cites", "DataCite:Compiles", "DataCite:Continues", @@ -488,15 +413,46 @@ "DataCite:IsReferencedBy", "DataCite:IsRequiredBy", "DataCite:IsReviewedBy", - "DataCite:IsSupplementedBy", + "DataCite:IsSourceOf", "DataCite:IsSupplementTo", + "DataCite:IsSupplementedBy", "DataCite:IsVariantFormOf", "DataCite:IsVersionOf", "DataCite:Obsoletes", "DataCite:References", "DataCite:Requires", "DataCite:Reviews", - "unknown" + "Crossref:BasedOnData", + "Crossref:Finances", + "Crossref:HasComment", + "Crossref:HasDerivation", + "Crossref:HasExpression", + "Crossref:HasFormat", + "Crossref:HasManifestation", + "Crossref:HasManuscript", + "Crossref:HasPreprint", + "Crossref:HasRelatedMaterial", + "Crossref:HasReply", + "Crossref:HasReview", + "Crossref:HasTranslation", + "Crossref:IsBasedOn", + "Crossref:IsBasisFor", + "Crossref:IsCommentOn", + "Crossref:IsDataBasisFor", + "Crossref:IsExpressionOf", + "Crossref:IsFinancedBy", + "Crossref:IsFormatOf", + "Crossref:IsManifestationOf", + "Crossref:IsManuscriptOf", + "Crossref:IsPreprintOf", + "Crossref:IsRelatedMaterial", + "Crossref:IsReplacedBy", + "Crossref:IsReplyTo", + "Crossref:IsReviewOf", + "Crossref:IsSameAs", + "Crossref:IsTranslationOf", + "Crossref:Replaces", + "kbcms:Unknown" ], "title": "RelationshipType", "type": "string" @@ -511,14 +467,14 @@ }, "Title": { "additionalProperties": false, - "description": "Represents the title or name of a resource, and the type of that title.\n\nThe 'title' field is required; 'title_type' is only necessary if the text is not the primary title.", + "description": "Represents the title or name of a resource, the type of that title, and the language used (if appropriate).\n\nThe 'title' field is required; 'title_type' is only necessary if the text is not the primary title.", "properties": { "language": { - "description": "The language in which the description is written, using the appropriate IETF BCP-47 notation.", + "description": "The language in which the title is written, using the appropriate IETF BCP-47 notation.", "type": "string" }, "title": { - "description": "A string used as a title for a resource.", + "description": "A string used as a title for a resource", "type": "string" }, "title_type": { @@ -544,13 +500,36 @@ "type": "string" } }, + "$id": "https://github.com/kbase/credit_engine/schema/kbase/linkml", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "additionalProperties": true, + "description": "Container for an instance of credit metadata; includes the credit metadata itself and metadata for the credit metadata, including the schema version used, who submitted it, and the date of submission. When the credit metadata for a resource is added or updated, a new CreditMetadataEntry is created to store the information.", + "metamodel_version": "1.7.0", "properties": { - "credit_metadata_entry": { - "$ref": "#/$defs/CreditMetadataEntry", - "description": "A credit metadata entry for a resource." + "credit_metadata": { + "$ref": "#/$defs/CreditMetadata", + "description": "The credit metadata itself." + }, + "credit_metadata_schema_version": { + "description": "The version of the credit metadata schema used.", + "type": "string" + }, + "saved_by": { + "description": "KBase workspace ID of the user who added this entry.", + "type": "string" + }, + "timestamp": { + "description": "Unix timestamp for the addition of this set of credit metadata.", + "type": "integer" } }, "required": [ - "credit_metadata_entry" - ] + "credit_metadata", + "credit_metadata_schema_version", + "saved_by", + "timestamp" + ], + "title": "credit_metadata", + "type": "object", + "version": "0.0.1-commonmeta" } From 7da587c8b60db0b621a31e0615ad122c7dbaa8bb Mon Sep 17 00:00:00 2001 From: "Jeffrey N. Johnson" Date: Thu, 23 May 2024 14:35:55 -0700 Subject: [PATCH 10/11] Adding token for creating a PR in the DTS repo on schema updates. --- .github/workflows/on_schema_update.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on_schema_update.yaml b/.github/workflows/on_schema_update.yaml index 61ef3c4..2494a53 100644 --- a/.github/workflows/on_schema_update.yaml +++ b/.github/workflows/on_schema_update.yaml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Get metadata schema changes + - name: Evaluate metadata schema changes id: metadata-schema-changes uses: tj-actions/changed-files@v44 with: @@ -42,7 +42,7 @@ jobs: with: commit_message: Regenerated JSONSchema bindings for credit metadata schema - - name: checkout DTS repo + - name: Check out DTS repo if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: actions/checkout@v4 with: @@ -59,4 +59,4 @@ jobs: if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: peter-evans/create-pull-request@v6 with: - token: ${{ secrets.PAT }} # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens + token: ${{ secrets.GHCR_TOKEN }} From 0c10fc7b19ba1b5febacea3517dfe16ba3a2e69a Mon Sep 17 00:00:00 2001 From: "Jeffrey N. Johnson" Date: Thu, 23 May 2024 14:52:18 -0700 Subject: [PATCH 11/11] Setting some more fields in the action. --- .github/workflows/on_schema_update.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/on_schema_update.yaml b/.github/workflows/on_schema_update.yaml index 2494a53..099b7c7 100644 --- a/.github/workflows/on_schema_update.yaml +++ b/.github/workflows/on_schema_update.yaml @@ -59,4 +59,7 @@ jobs: if: steps.metadata-schema-changes.outputs.any_changed == 'true' uses: peter-evans/create-pull-request@v6 with: + branch: credit-metadata-schema-update + path: dts + title: Update to Credit Engine metadata schema token: ${{ secrets.GHCR_TOKEN }}