Skip to content

Language-Research-Technology/omeka-ro-crate-tools

 
 

Repository files navigation

omeka-datacrate-tools

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.

The scripts

There are two script for extracting data from Omeka repositories:

  • omeka_classic_to_rocrate.py exports from Omeka Classic repositories into DataCrate format.

  • NEEDS UPDATING omeka_s_to_ro-crate.py exports 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.py will 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.py uses the API dump from an omeka site.

Audience =

This is for experienced Python developers

An example

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 this code and install with uv

  • 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
    

Download data from Omeka Classic

  • To see what the omeka_classic_to_rocrate.py script 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.

About

Scripts to push DataCrates into Omeka S and to move data out of Omeka Classic -- originally made at UTS - forking to work on these as part of the Language Data Commons of Australia and update from datacrate to ro-crate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 98.6%
  • Makefile 1.4%