diff --git a/README.md b/README.md index 9c4287b..1999b17 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,33 @@ The initial use-case is capture of provenance on HPC systems (SLURM), for adding 4. A creation tool will be provided for these files. This will guide users in populating the appropriate files, and will validate the files against the LINK-ML schema. 5. SLURM plugin will scan PFFPATH locations as job runs. *.pff files found will be validated against the schema, then metadata ingested. +## Schemas + +- `schema.yaml` — entry schema (imports the fragments below) +- `user.schema.yaml` / `project.schema.yaml` / `system.schema.yaml` — definitions + +## Development + +Setup (requires [uv](https://docs.astral.sh/uv/)): + +```bash +uv sync --group dev +``` + +## Regenerating the compiled schema + +`schema.json` is the compiled output of `schema.yaml`. After changing any schema, regenerate it and commit: + +```bash +uv run linkml generate json-schema schema.yaml > schema.json +``` + +CI fails if `schema.json` is out of date. + +## Validating the example + +```bash +uv run linkml validate -s schema.yaml -C PFF examples/example.yaml +``` + diff --git a/examples/example.yaml b/examples/example.yaml index 11b3842..e646fac 100644 --- a/examples/example.yaml +++ b/examples/example.yaml @@ -8,10 +8,6 @@ project: description: > Fictional research programme in psychoceramics, the supposed study of cracked pots. Professor Carberry is said to still teach at Brown University. - PI: - id: jcarberry - full_name: Josiah Stinkney Carberry - orcid: https://orcid.org/0000-0002-1825-0097 start_date: "1929-04-01" system: hardware: diff --git a/project.schema.yaml b/project.schema.yaml index e10f43c..0691c4f 100644 --- a/project.schema.yaml +++ b/project.schema.yaml @@ -6,8 +6,6 @@ classes: id: title: description: - PI: - range: User start_date: range: date end_date: diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..b7de8ed --- /dev/null +++ b/schema.json @@ -0,0 +1,241 @@ +{ + "$defs": { + "CPU": { + "additionalProperties": false, + "description": "", + "properties": { + "cores": { + "type": [ + "integer", + "null" + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "threads": { + "type": [ + "integer", + "null" + ] + }, + "vendor": { + "type": [ + "string", + "null" + ] + } + }, + "title": "CPU", + "type": "object" + }, + "OS": { + "additionalProperties": false, + "description": "", + "properties": { + "name": { + "type": [ + "string", + "null" + ] + }, + "version": { + "type": [ + "string", + "null" + ] + } + }, + "title": "OS", + "type": "object" + }, + "PFF": { + "additionalProperties": false, + "description": "", + "properties": { + "project": { + "anyOf": [ + { + "$ref": "#/$defs/Project" + }, + { + "type": "null" + } + ] + }, + "system": { + "anyOf": [ + { + "$ref": "#/$defs/System" + }, + { + "type": "null" + } + ] + }, + "user": { + "anyOf": [ + { + "$ref": "#/$defs/User" + }, + { + "type": "null" + } + ] + } + }, + "title": "PFF", + "type": "object" + }, + "Project": { + "additionalProperties": false, + "description": "", + "properties": { + "description": { + "type": [ + "string", + "null" + ] + }, + "end_date": { + "format": "date", + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + }, + "start_date": { + "format": "date", + "type": [ + "string", + "null" + ] + }, + "title": { + "type": [ + "string", + "null" + ] + } + }, + "title": "Project", + "type": "object" + }, + "System": { + "additionalProperties": false, + "description": "", + "properties": { + "hardware": { + "anyOf": [ + { + "$ref": "#/$defs/CPU" + }, + { + "type": "null" + } + ] + }, + "hostname": { + "type": [ + "string", + "null" + ] + }, + "software": { + "anyOf": [ + { + "$ref": "#/$defs/OS" + }, + { + "type": "null" + } + ] + } + }, + "title": "System", + "type": "object" + }, + "User": { + "additionalProperties": false, + "description": "", + "properties": { + "email": { + "type": [ + "string", + "null" + ] + }, + "full_name": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + }, + "orcid": { + "type": [ + "string", + "null" + ] + } + }, + "title": "User", + "type": "object" + } + }, + "$id": "provenance-file-format", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "additionalProperties": true, + "description": "", + "metamodel_version": "1.11.0", + "properties": { + "project": { + "anyOf": [ + { + "$ref": "#/$defs/Project" + }, + { + "type": "null" + } + ] + }, + "system": { + "anyOf": [ + { + "$ref": "#/$defs/System" + }, + { + "type": "null" + } + ] + }, + "user": { + "anyOf": [ + { + "$ref": "#/$defs/User" + }, + { + "type": "null" + } + ] + } + }, + "title": "provenance-file-format", + "type": "object", + "version": null +} +