Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align model serialisation to handle api #42

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
# python-version: ["3.9", "3.10", "3.11", "3.12"] # re-enable when linkml-runtime has https://github.com/linkml/linkml-runtime/pull/357
python-version: ["3.11", "3.12"]
fail-fast: false

steps:
Expand Down
3 changes: 3 additions & 0 deletions .linkmllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ extends: recommended
rules:
standard_naming:
permissible_values_upper_case: true
canonical_prefixes:
# Superfluous warnings for https-refixes, https://github.com/linkml/linkml/issues/2492
level: disabled
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ test-schema:
$(RUN) gen-project ${CONFIG_YAML} -d tmp $(SOURCE_SCHEMA_PATH)

test-python:
$(RUN) python -m unittest discover
$(RUN) python -m pytest

lint:
$(RUN) linkml-lint $(SOURCE_SCHEMA_PATH)
Expand Down
110 changes: 85 additions & 25 deletions examples/PID4CatRecord-001.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,86 @@
# Example data object
---
contains_pids:
- id: lik-123
landing_page_url: https://pid4cat.example.org/lik-123
status: REGISTERED
pid_schema_version: 0.1.0
record_version: 20240219v-0
resource_info:
label: Resource label
description: Resource description
resource_category: SAMPLE
rdf_url: https://example.org/resource
rdf_type: TURTLE
schema_url: https://example.org/schema
schema_type: XSD
dc_rights: CC0-1.0
curation_contact: [email protected]
change_log:
- datetime_log: '2024-02-19T00:00:00Z'
has_agent:
name: Data Fuzzi
person_orcid: 0000-0000-0000-0000
role: TRUSTEE
changed_field: STATUS
description: 'as requested in issue #123'
- responseCode: 1
handle: 21.T12995/lik-1
values:
- index: 1
type: URL
data:
format: string
value: https://pid4cat.example.org/lik-1
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 2
type: STATUS
data:
format: string
value: REGISTERED
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 3
type: SCHEMA_VER
data:
format: string
value: v0.1.0
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 4
type: LICENSE
data:
format: string
value: CC0-1.0
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 5
type: EMAIL
data:
format: string
value: [email protected]
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 6
type: RESOURCE_INFO
data:
format: string
value:
- resource_info:
label: Resource label
description: Resource description
resource_category: SAMPLE
representation_variants:
- url: https://example.org/resource
media_type: text/turtle
encoding_format: UTF-8
size: 12345
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 7
type: RELATED
data:
format: string
value:
- related_identifiers:
- relation_type: IS_PART_OF
related_identifier: https://example.org/collection
datetime_log: '2024-02-19T00:00:00Z'
- relation_type: IS_REFERENCED_BY
related_identifier: https://example.org/referenced
datetime_log: '2024-02-19T00:00:00Z'
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
- index: 8
type: LOG
data:
format: string
value:
- change_log:
- datetime_log: '2024-02-19T00:00:00Z'
has_agent:
name: Data Fuzzi
email: [email protected]
orcid: 0000-0000-0000-0000
affiliation_ror: https://ror.org/029hg0311
role: TRUSTEE
changed_field: STATUS
description: 'as requested in issue #123'
ttl: 86400
timestamp: '2024-05-15T15:51:15Z'
141 changes: 86 additions & 55 deletions examples/example_p1.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,91 @@
{
"id": "lik-1",
"landing_page_url": "https://pid4cat.example.org/lik-1",
"status": "REGISTERED",
"pid_schema_version": "0.1.0",
"license": "CC0-1.0",
"curation_contact_email": "[email protected]",
"resource_info": {
"label": "Resource label",
"description": "Resource description",
"resource_category": "SAMPLE",
"representation_variants": [
{
"url": "https://example.org/resource",
"media_type": "text/turtle",
"encoding_format": "UTF-8",
"size": 12345
}
]
},
"related_identifiers": [
"contains_pids": [
{
"relation_type": "IS_PART_OF",
"related_identifier": "https://example.org/collection",
"datetime_log": "2024-02-19T00:00:00+00:00"
},
{
"relation_type": "IS_REFERENCED_BY",
"related_identifier": "https://example.org/referenced",
"datetime_log": "2024-02-19T00:00:00+00:00"
}
],
"change_log": [
{
"datetime_log": "2024-02-19T00:00:00+00:00",
"has_agent": {
"name": "Data Fuzzi",
"email": "[email protected]",
"orcid": "0000-0000-0000-0000",
"affiliation_ror": "https://ror.org/01abcde",
"role": "TRUSTEE"
},
"changed_field": "STATUS",
"description": "Registration completed."
},
{
"datetime_log": "2024-05-15T15:51:15+00:00",
"has_agent": {
"name": "Data Fuzzi",
"email": "[email protected]",
"orcid": "0000-0000-0000-0000",
"affiliation_ror": "https://ror.org/01abcde",
"role": "TRUSTEE"
},
"changed_field": "RESOURCE_INFO",
"description": "as requested in issue #234"
"responseCode": 1,
"handle": "21.T12995/lik-1",
"values": [
{
"index": 1,
"type": "URL",
"data": {
"format": "string",
"value": "https://pid4cat.example.org/lik-1"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 2,
"type": "STATUS",
"data": {
"format": "string",
"value": "PermissibleValue({\n 'text': 'REGISTERED',\n 'description': 'The PID4CatRecord links to a concrete resource.'\n})"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 3,
"type": "SCHEMA_VER",
"data": {
"format": "string",
"value": "v0.1.0"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 4,
"type": "LICENSE",
"data": {
"format": "string",
"value": "CC0-1.0"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 5,
"type": "EMAIL",
"data": {
"format": "string",
"value": "[email protected]"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 6,
"type": "RESOURCE_INFO",
"data": {
"format": "string",
"value": "ResourceInfo({\n 'label': 'Resource label',\n 'description': 'Resource description',\n 'resource_category': ResourceCategory(text='SAMPLE', description='A representative part of an entity of interest on which observations may be made.'),\n 'representation_variants': [RepresentationVariant({\n 'url': 'https://example.org/resource',\n 'media_type': 'text/turtle',\n 'encoding_format': 'UTF-8',\n 'size': 12345\n })]\n})"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 7,
"type": "RELATED",
"data": {
"format": "string",
"value": "[PID4CatRelation({\n 'relation_type': RelationType(text='IS_PART_OF', description='The resource is part of another resource.', meaning='https://purl.org/dc/terms/isPartOf'),\n 'related_identifier': 'https://example.org/collection',\n 'datetime_log': '2024-02-19T00:00:00+00:00'\n}), PID4CatRelation({\n 'relation_type': RelationType(text='IS_REFERENCED_BY', description='The resource is referenced by another resource.', meaning='https://purl.org/dc/terms/isReferencedBy'),\n 'related_identifier': 'https://example.org/referenced',\n 'datetime_log': '2024-02-19T00:00:00+00:00'\n})]"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
},
{
"index": 8,
"type": "LOG",
"data": {
"format": "string",
"value": "[LogRecord({\n 'datetime_log': '2024-02-19T00:00:00+00:00',\n 'has_agent': Agent({\n 'name': 'Data Fuzzi',\n 'email': '[email protected]',\n 'orcid': '0000-0000-0000-0000',\n 'affiliation_ror': 'https://ror.org/01abcde',\n 'role': PID4CatAgentRole(text='TRUSTEE', description='The agent is the trustee of the resource.')\n }),\n 'changed_field': ChangeLogField(text='STATUS', description='The status of the PID4CatRecord was changed.'),\n 'description': 'Registration completed.'\n}), LogRecord({\n 'datetime_log': '2024-05-15T15:51:15+00:00',\n 'has_agent': Agent({\n 'name': 'Data Fuzzi',\n 'email': '[email protected]',\n 'orcid': '0000-0000-0000-0000',\n 'affiliation_ror': 'https://ror.org/01abcde',\n 'role': PID4CatAgentRole(text='TRUSTEE', description='The agent is the trustee of the resource.')\n }),\n 'changed_field': ChangeLogField(text='RESOURCE_INFO', description='The resource info of the PID4CatRecord was changed.'),\n 'description': 'as requested in issue #234'\n})]"
},
"ttl": 86400,
"timestamp": "2024-05-15T15:51:15+00:00"
}
]
}
],
"@type": "dict"
"@type": "HandleRecordContainer"
}
Loading
Loading