Skip to content
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
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ And you can skip the backup (simply edit in place):
python -m opencloning_linkml.migrations.migrate file.json --no-backup
```



## Developer Documentation

The python package can be installed from PyPI:
Expand All @@ -45,6 +43,23 @@ Use the `make` command to generate project artefacts:
* `make deploy`: deploys site
</details>

### Creating a migration

To add a migration from version `X.Y.Z` to a new version `A.B.C`, follow these steps:

1. **Archive the current model**: Save a copy of the current Pydantic model to `src/opencloning_linkml/migrations/model_archive/vA_B_C.py`. This file should contain the complete model classes for version `A.B.C` (typically copied from `src/opencloning_linkml/datamodel/_models.py` after generating the new version).

2. **Create the transformation file**: Create a new file `src/opencloning_linkml/migrations/transformations/vX_Y_Z_to_vA_B_C.py` with a migration function

3. **Register the migration**: Add the migration to `src/opencloning_linkml/migrations/__init__.py`:
- Import the migration function: `from .transformations.vX_Y_Z_to_vA_B_C import migrate_X_Y_Z_to_A_B_C`
- Add it to the `load_migrations()` return dictionary: `("X.Y.Z", "A.B.C"): migrate_X_Y_Z_to_A_B_C`

4. **Add a test**: Add a test to `tests/test_migration.py` to ensure the migration works as expected.

**Example**: See `v0_2_8_to_v0_2_9.py` for a simple transformation example, or `v0_2_9_to_v_0_4_0.py` for a more complex migration with ID remapping and structural changes.


## Credits

This project was made with
Expand Down
Binary file modified project/excel/opencloning_linkml.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion project/jsonld/opencloning_linkml.context.jsonld
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comments": {
"description": "Auto generated by LinkML jsonld context generator",
"generation_date": "2025-10-20T16:29:26",
"generation_date": "2025-11-17T18:53:28",
"source": "opencloning_linkml.yaml"
},
"@context": {
Expand Down
4 changes: 2 additions & 2 deletions project/jsonld/opencloning_linkml.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -3542,9 +3542,9 @@
],
"metamodel_version": "1.7.0",
"source_file": "opencloning_linkml.yaml",
"source_file_date": "2025-10-20T16:11:45",
"source_file_date": "2025-11-17T18:34:01",
"source_file_size": 26051,
"generation_date": "2025-10-20T16:29:26",
"generation_date": "2025-11-17T18:53:29",
"@type": "SchemaDefinition",
"@context": [
"project/jsonld/opencloning_linkml.context.jsonld",
Expand Down
906 changes: 453 additions & 453 deletions project/owl/opencloning_linkml.owl.ttl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion project/python/opencloning_linkml.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto generated from opencloning_linkml.yaml by pythongen.py version: 0.0.1
# Generation date: 2025-10-20T16:29:27
# Generation date: 2025-11-17T18:53:30
# Schema: OpenCloning_LinkML
#
# id: https://opencloning.github.io/OpenCloning_LinkML
Expand Down
1,660 changes: 830 additions & 830 deletions project/shacl/opencloning_linkml.shacl.ttl

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/opencloning_linkml/migrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ def load_migrations() -> MigrationDict:
from .transformations.v0_2_6_1_to_v_0_2_8 import migrate_0_2_6_1_to_0_2_8 # noqa: F401
from .transformations.v0_2_8_to_v0_2_9 import migrate_0_2_8_to_0_2_9 # noqa: F401
from .transformations.v0_2_9_to_v_0_4_0 import migrate_0_2_9_to_0_4_0 # noqa: F401
from .transformations.v0_4_0_to_v0_4_6 import migrate_0_4_0_to_0_4_6 # noqa: F401

return {
("0.2.6.1", "0.2.8"): migrate_0_2_6_1_to_0_2_8,
("0.2.8", "0.2.9"): migrate_0_2_8_to_0_2_9,
("0.2.9", "0.4.0"): migrate_0_2_9_to_0_4_0,
("0.4.0", "0.4.6"): migrate_0_4_0_to_0_4_6,
}


Expand Down
Loading