This repository contains some python3 scripts to push DataCrates/RO-Crates in and out of Omeka S and to move data out of Omeka Classic. As time permits we're updating these scripts to follow the RO-Crate specification.
These scripts are packaged for use with uv via pyproject.toml.
There are two script for extracting data from Omeka repositories:
-
omeka_classic_to_rocrate.pyexports from Omeka Classic repositories into DataCrate format. -
NEEDS UPDATING
omeka_s_to_ro-crate.pyexports from Omeka S to DataCrate format, it puts metadata into both CATALOG.json and into a file containing raw Omeka S API data: API.json.
There are two ways to import DataCrate metadata into Omeka S.
- NEEDS UPDATING
datacrate_to_omeka_s.pywill work with ANY DataCrate data, and uses the CATALOG.json file for metadata. To run this the target repository must have the schema.org vocabulary installed. - NEEDS UPDATING
reconstitute_omeka_s.pyuses the API dump from an omeka site.
This is for experienced Python developers
This is a worked example of how to export data from an Omeka Classic repostiory to an RO-Crate, and optionally to re-upload it.
The example repository "Farms to Freeways" is here: http://omeka.scem.ws/farmstofreeways/exhibits/show/viewall.
-
Get the code:
git clone git@github.com:Language-Research-Technology/omeka-ro-crate-tools.git -
Install dependencies (including TinyCrate from GitHub) with uv:
uv sync -
Run scripts with uv:
uv run python omeka_classic_to_rocrate.py --help
- To see what the
omeka_classic_to_rocrate.pyscript takes as arguments type:
python omeka_classic_to_rocrate.py --help
usage: omeka_classic_to_rocrate.py [-h] [-k KEY] [-u API_URL] [-d DOWNLOAD_CACHE] [-r ROCRATE] [-n] [-m MAPPING] [-l] [outfile]
positional arguments:
outfile
options:
-h, --help show this help message and exit
-k, --key KEY Omeka API Key
-u, --api_url API_URL
Omeka API Endpoint URL (hint, ends in /api)
-d, --download_cache DOWNLOAD_CACHE
Path to a directory in which to cache dowloads (defaults to ./data)
-r, --rocrate ROCRATE
RO-Crate metadata document to use as a template (will be updated with items from Omeka)
-n, --no_relations Don't try to fetch item relations
-m, --mapping MAPPING
JSON mapping file
-l, --link Try to link items using name values instead of just IDs
- For this example use this command:
make get-f2f
This creates an RO-Crate directory ./f2f2-out with the data from Omeka.