# preservica-ocfl
This library provides a Python module which will create a local Oxford Common File Layout (OCFL) Specification storage
structure from a Preservica repository.
Content is exported from Preservica as OPEX packages using the API and saved locally in a OCFL compliant structure.
## Preservica repository as a local OCFL storage structure
This Oxford Common File Layout (OCFL) specification describes an application-independent approach to the
storage of digital information in a structured, transparent, and predictable manner.
It is designed to promote long-term object management best practices within digital repositories.
https://ocfl.io/
This project uses the OCFL Core https://github.com/inveniosoftware/ocflcore library to create the OCFL inventory
metadata.
## Limitations
The preservica-ocfl module creates OCFL specification 1.1 file structures. It does not support the OCFL 1.0 specification.
The library creates OCFL objects from each Preservica Asset. It currently does not look for modifications in Preservica
to create new OCFL versions. Each Asset in Preservica is mapped to a v1 OCFL object.
If OCFL objects already exist for a Preservica Asset then they will be ignored.
## OPEX
The information stored within the OCFL object depends on the type of OPEX package exported from Preservica.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/carj/preservica-ocfl
## Support
preservica-ocfl is 3rd party open source library and is not affiliated or supported by Preservica Ltd.
There is no support for use of the library by Preservica Ltd.
Bug reports can be raised directly on GitHub.
Users of preservica-ocfl should make sure they are licensed to use the Preservica REST APIs.
## License
The package is available as open source under the terms of the Apache License 2.0
## Installation
preservica-ocfl is available from the Python Package Index (PyPI)
https://pypi.org/project/preserva-ocfl/
To install preservica-ocfl, simply run this simple command in your terminal of choice:
$ pip install preservica-ocfl
$ python -m preservica-ocfl -r STORAGE_ROOT -c a7ad52e3-2cb3-4cb5-af2a-3ab08829a2a8
```
usage: preservica-ocfl [-h] -r STORAGE_ROOT [-c COLLECTION] [-t THREADS] [-d DIRECTORY_DEPTH] [--parent-folders PARENT_FOLDERS] [-u USERNAME] [-p PASSWORD] [-s SERVER]
Create a local OCFL storage root from a Preservica repository
options:
-h, --help show this help message and exit
-r STORAGE_ROOT, --storage-root STORAGE_ROOT
The OCFL Storage Root
-c COLLECTION, --collection COLLECTION
The Preservica parent collection uuid, ignore to process the entire repository
-t THREADS, --threads THREADS
The number of export threads, defaults to 1
-d DIRECTORY_DEPTH, --directory-depth DIRECTORY_DEPTH
The number of directory components below the storage root,
defaults to 2 Can be any of (1, 2, 3, 4)
--parent-folders PARENT_FOLDERS
The OCFL object includes Preservica Parent Hierarchy information.
This corresponding flag should also be set on the OPEX export workflow
-u USERNAME, --username USERNAME
Your Preservica username if not using credentials.properties
-p PASSWORD, --password PASSWORD
Your Preservica password if not using credentials.properties
-s SERVER, --server SERVER
Your Preservica server domain name if not using credentials.properties
Preservica requires an active Export workflow, which be configured to include "Content" and "Metadata"
```
## Usage
The preserva-ocfl module uses the Preservica API to export Assets as OPEX packages. The OPEX packages are then
downloaded and the OCFL objects are created from the OPEX packages.
The only required parameter is the storage root location for the OCFL objects.
The storage root is the root directory for the OCFL see https://ocfl.io/1.1/spec/#storage-root
The module requires the Preservica parent collection UUID to be specified. If no collection is specified then the entire
repository is exported.
$ python -m preserva-ocfl --storage-root "storage_root" --collection 10f8d7aa-d477-413b-8d52-d2a5632b8e13
The initial OCFL storage root will be created with the following structure:
[storage_root]
├── 0=ocfl_1.1
├── ocfl_1.1.html
└── ocfl_layout.json
The --directory-depth parameter can be used to control the number of directories below the storage root before the
objects are stored. The default is 2. The directory structure is based on the UUID of the Preservica Asset.
For example, with depth set to the default 2, the OCFL structure will look like:
[storage_root]
├── 0=ocfl_1.1
├── ocfl_1.1.html
└── ocfl_layout.json
└──3b <- Level 1
└──be <- Level 2
└──3bbe0160-ad3d-48db-8800-632db07249b6
└──0=ocfl_object_1.1
└──inventory.json
└──inventory.json.SHA512
└──v1
└──inventory.json
└──inventory.json.SHA512
└──content
└──OPEX Package...
The number of concurrent export workflows can be controlled using the --threads parameter. The default is 1.
Raw data
{
"_id": null,
"home_page": "https://github.com/carj/preservica-ocfl",
"name": "preservica-ocfl",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Preservica API Preservation OCFL Storage",
"author": "James Carr",
"author_email": "drjamescarr@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/79/dd/ca486846c20504d3b1e5d73393b18ba13bf108c7142e6607285122511eb0/preservica_ocfl-0.0.3.tar.gz",
"platform": null,
"description": "# preservica-ocfl\r\n\r\nThis library provides a Python module which will create a local Oxford Common File Layout (OCFL) Specification storage \r\nstructure from a Preservica repository. \r\nContent is exported from Preservica as OPEX packages using the API and saved locally in a OCFL compliant structure.\r\n\r\n## Preservica repository as a local OCFL storage structure\r\n\r\nThis Oxford Common File Layout (OCFL) specification describes an application-independent approach to the \r\nstorage of digital information in a structured, transparent, and predictable manner. \r\nIt is designed to promote long-term object management best practices within digital repositories.\r\n\r\nhttps://ocfl.io/\r\n\r\nThis project uses the OCFL Core https://github.com/inveniosoftware/ocflcore library to create the OCFL inventory \r\nmetadata.\r\n\r\n## Limitations\r\n\r\nThe preservica-ocfl module creates OCFL specification 1.1 file structures. It does not support the OCFL 1.0 specification.\r\n\r\nThe library creates OCFL objects from each Preservica Asset. It currently does not look for modifications in Preservica\r\nto create new OCFL versions. Each Asset in Preservica is mapped to a v1 OCFL object. \r\n\r\nIf OCFL objects already exist for a Preservica Asset then they will be ignored. \r\n\r\n## OPEX\r\n\r\nThe information stored within the OCFL object depends on the type of OPEX package exported from Preservica.\r\n\r\n\r\n## Contributing\r\n\r\nBug reports and pull requests are welcome on GitHub at https://github.com/carj/preservica-ocfl\r\n\r\n## Support \r\n\r\npreservica-ocfl is 3rd party open source library and is not affiliated or supported by Preservica Ltd.\r\nThere is no support for use of the library by Preservica Ltd.\r\nBug reports can be raised directly on GitHub.\r\n\r\nUsers of preservica-ocfl should make sure they are licensed to use the Preservica REST APIs. \r\n\r\n## License\r\n\r\nThe package is available as open source under the terms of the Apache License 2.0\r\n\r\n## Installation\r\n\r\npreservica-ocfl is available from the Python Package Index (PyPI)\r\n\r\nhttps://pypi.org/project/preserva-ocfl/\r\n\r\nTo install preservica-ocfl, simply run this simple command in your terminal of choice:\r\n\r\n $ pip install preservica-ocfl\r\n\r\n $ python -m preservica-ocfl -r STORAGE_ROOT -c a7ad52e3-2cb3-4cb5-af2a-3ab08829a2a8\r\n \r\n ```\r\n usage: preservica-ocfl [-h] -r STORAGE_ROOT [-c COLLECTION] [-t THREADS] [-d DIRECTORY_DEPTH] [--parent-folders PARENT_FOLDERS] [-u USERNAME] [-p PASSWORD] [-s SERVER]\r\n\r\n Create a local OCFL storage root from a Preservica repository\r\n \r\n options:\r\n -h, --help show this help message and exit\r\n -r STORAGE_ROOT, --storage-root STORAGE_ROOT\r\n The OCFL Storage Root\r\n -c COLLECTION, --collection COLLECTION\r\n The Preservica parent collection uuid, ignore to process the entire repository\r\n -t THREADS, --threads THREADS\r\n The number of export threads, defaults to 1\r\n -d DIRECTORY_DEPTH, --directory-depth DIRECTORY_DEPTH\r\n The number of directory components below the storage root, \r\n defaults to 2 Can be any of (1, 2, 3, 4)\r\n --parent-folders PARENT_FOLDERS\r\n The OCFL object includes Preservica Parent Hierarchy information. \r\n This corresponding flag should also be set on the OPEX export workflow\r\n -u USERNAME, --username USERNAME\r\n Your Preservica username if not using credentials.properties\r\n -p PASSWORD, --password PASSWORD\r\n Your Preservica password if not using credentials.properties\r\n -s SERVER, --server SERVER\r\n Your Preservica server domain name if not using credentials.properties\r\n \r\n Preservica requires an active Export workflow, which be configured to include \"Content\" and \"Metadata\"\r\n\r\n \r\n \r\n \r\n ```\r\n\r\n\r\n\r\n## Usage\r\n\r\nThe preserva-ocfl module uses the Preservica API to export Assets as OPEX packages. The OPEX packages are then \r\ndownloaded and the OCFL objects are created from the OPEX packages.\r\n\r\nThe only required parameter is the storage root location for the OCFL objects. \r\nThe storage root is the root directory for the OCFL see https://ocfl.io/1.1/spec/#storage-root\r\n\r\nThe module requires the Preservica parent collection UUID to be specified. If no collection is specified then the entire\r\nrepository is exported.\r\n\r\n $ python -m preserva-ocfl --storage-root \"storage_root\" --collection 10f8d7aa-d477-413b-8d52-d2a5632b8e13\r\n\r\nThe initial OCFL storage root will be created with the following structure:\r\n\r\n [storage_root]\r\n \u251c\u2500\u2500 0=ocfl_1.1\r\n \u251c\u2500\u2500 ocfl_1.1.html \r\n \u2514\u2500\u2500 ocfl_layout.json \r\n\r\n\r\nThe --directory-depth parameter can be used to control the number of directories below the storage root before the\r\nobjects are stored. The default is 2. The directory structure is based on the UUID of the Preservica Asset.\r\n\r\nFor example, with depth set to the default 2, the OCFL structure will look like:\r\n\r\n [storage_root]\r\n \u251c\u2500\u2500 0=ocfl_1.1\r\n \u251c\u2500\u2500 ocfl_1.1.html \r\n \u2514\u2500\u2500 ocfl_layout.json\r\n \u2514\u2500\u25003b <- Level 1\r\n \u2514\u2500\u2500be <- Level 2\r\n \u2514\u2500\u25003bbe0160-ad3d-48db-8800-632db07249b6\r\n \u2514\u2500\u25000=ocfl_object_1.1\r\n \u2514\u2500\u2500inventory.json\r\n \u2514\u2500\u2500inventory.json.SHA512\r\n \u2514\u2500\u2500v1\r\n \u2514\u2500\u2500inventory.json\r\n \u2514\u2500\u2500inventory.json.SHA512\r\n \u2514\u2500\u2500content\r\n \u2514\u2500\u2500OPEX Package... \r\n\r\n\r\n \r\n \r\nThe number of concurrent export workflows can be controlled using the --threads parameter. The default is 1.\r\n\r\n\r\n \r\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Python module for creating a local OCFL storage structure from a Preservica repository",
"version": "0.0.3",
"project_urls": {
"Discussion Forum": "https://github.com/carj/preservica-ocfl",
"Documentation": "https://github.com/carj/preservica-ocfl",
"Homepage": "https://github.com/carj/preservica-ocfl",
"Source": "https://github.com/carj/preservica-ocfl"
},
"split_keywords": [
"preservica",
"api",
"preservation",
"ocfl",
"storage"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b0a0be0085d228e10cf48abe29f2ebe95cba4fc1ad895d96e7354ed08d9cb4a1",
"md5": "cba0e7be1fdd9aa525dd5c1dcca4ca45",
"sha256": "26f184cc22db106afa533c2cf53a0beec75f6feecfce14c46e4e147a4acb9aca"
},
"downloads": -1,
"filename": "preservica_ocfl-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cba0e7be1fdd9aa525dd5c1dcca4ca45",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12199,
"upload_time": "2025-02-14T12:36:19",
"upload_time_iso_8601": "2025-02-14T12:36:19.303277Z",
"url": "https://files.pythonhosted.org/packages/b0/a0/be0085d228e10cf48abe29f2ebe95cba4fc1ad895d96e7354ed08d9cb4a1/preservica_ocfl-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "79ddca486846c20504d3b1e5d73393b18ba13bf108c7142e6607285122511eb0",
"md5": "6bac06d27457ccda1d4e87db8a0ac617",
"sha256": "4ded14277fc7c6dd13728d76ba1c8e5a3757eba340ecab7134fd6af7e61db7ef"
},
"downloads": -1,
"filename": "preservica_ocfl-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "6bac06d27457ccda1d4e87db8a0ac617",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11820,
"upload_time": "2025-02-14T12:36:21",
"upload_time_iso_8601": "2025-02-14T12:36:21.020542Z",
"url": "https://files.pythonhosted.org/packages/79/dd/ca486846c20504d3b1e5d73393b18ba13bf108c7142e6607285122511eb0/preservica_ocfl-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-14 12:36:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "carj",
"github_project": "preservica-ocfl",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "preservica-ocfl"
}