Skip to main content

AI4 Metadata utilities

GitHub license GitHub release PyPI Python versions

DOI

Metadata utilities for the AI4OS hub data science applications.

The AI4OS hub data science applications use metadata to describe the data sources, models, and other resources. The metadata is used to validate the resources and to provide information to the users.

Installation

The metadata utilities can be installed using pip:

$ pip install ai4-metadata

Usage

The AI4 metadata utilities can be invoked from the command line. The utilities provide commands to validate and migrate the metadata files.

$ ai4-metadata --help

Metadata validation

The metadata utilities provide a subcommand ai4-metadata validate that can be used to validate the metadata files. The CLI tool accepts the metadata files as input parameters.

$ ai4-metadata validate src/assets/examples/sample-v2.mods.json
╭─ Success ──────────────────────────────────────────────────────────────────╮
│ 'src/assets/examples/sample-v2.mods.json' is valid for version 2.0.0       │
╰────────────────────────────────────────────────────────────────────────────╯

Different metadata versions can be specified, either by using the --metadata-version or by providing the metadata schema file. The following two executions are equivalent:

$ ai4-metadata validate --metadata-version 2.0.0 src/assets/examples/sample-v2.mods.json
╭─ Success ──────────────────────────────────────────────────────────────────╮
│ 'src/assets/examples/sample-v2.mods.json' is valid for version 2.0.0       │
╰────────────────────────────────────────────────────────────────────────────╯
$ ai4-metadata validate --schema schemata/ai4-apps-v2.0.0.json src/assets/examples/sample-v2.mods.json
╭─ Success ──────────────────────────────────────────────────────────────────╮
│ 'src/assets/examples/sample-v2.mods.json' is valid for version 2.0.0       │
╰────────────────────────────────────────────────────────────────────────────╯
$ ai4-metadata validate --metadata-version 1.0.0 src/assets/examples/sample-v2.mods.json
╭─ Error ────────────────────────────────────────────────────────────────────╮
│ Error validating instance 'src/assets/examples/sample-v2.mods.json':       │
│ 'date_creation' is a required property                                     │
╰────────────────────────────────────────────────────────────────────────────╯

Metadata files can be present in either JSON or YAML format. The metadata utilities will automatically detect the format.

$ ai4-metadata validate src/assets/examples/sample-v2.mods.yaml
╭─ Success ──────────────────────────────────────────────────────────────────╮
│ 'src/assets/examples/sample-v2.mods.yaml' is valid for version 2.0.0       │
╰────────────────────────────────────────────────────────────────────────────╯
$ ai4-metadata validate src/assets/examples/sample-v2.mods.json
╭─ Success ──────────────────────────────────────────────────────────────────╮
│ 'src/assets/examples/sample-v2.mods.json' is valid for version 2.0.0       │
╰────────────────────────────────────────────────────────────────────────────╯

Metadata mapping between different profiles and formats

The metadata utilities provide a subcommand ai4-metadata map that can be used to map the ai4 metadata into different metadata profiles and different output serialization formats. The supported profiles and formats are detailed below.

MLDCAT-AP profile

We support the MLDCAT-AP profile developed by the SEMIC support centre. The MLDCAT-AP profile is a metadata profile aimed to extend the use of DCAT Aplication Profile for data portals in Europe.

In order to map the ai4 metadata into the MLDCAT-AP profile you can use the ai4-metadata map mldcat subcommand. The input metadata file must be in the ai4 metadata format (YAML or JSON). You can specify what format the metadata should be rendered into, either JSON-LD (jsonld) or RD Turtle (ttl).

$ ai4-metadata map mldcat src/assets/examples/sample-v2.mods.json --output-format jsonld --output sample-v2.mldcat.jsonld
$ ai4-metadata map mldcat src/assets/examples/sample-v2.mods.json --output-format ttl --output sample-v2.mldcat.ttl

Metadata migration

The metadata utilities provide a subcommand ai4-metadata migrate that can be used to migrate the metadata files from V1 to latest V2. To save the output, use the --output option.

$ ai4-metadata migrate --output sample-v2.mods.json src/assets/examples/sample-v1.mods.json
╭─ Success ──────────────────────────────────────────────────────────────────╮
│ V1 metadata 'src/assets/examples/sample-v1.mods.json' migrated to version  │
│ MetadataVersions.V2 and stored in 'sample-v2.mods.json'                    │
╰────────────────────────────────────────────────────────────────────────────╯

Please review the changes, as the metadata migration is not complete, and manual steps are needed.

Acknowledgements

Funded by the European Union

This project has received funding from the European Union’s Horizon Research and Innovation programme under Grant agreement No. 101058593

Metadata

Release files for ai4-metadata 2.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai4-metadata 2.4.2
File Size Uploaded
ai4_metadata-2.4.2.tar.gz 31.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai4-metadata 2.4.2
File Interpreter ABI Platform
ai4_metadata-2.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 84.3 kB

Release files / ai4_metadata-2.4.2.tar.gz

Download URL ai4_metadata-2.4.2.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
621d5542fe01f34a6371653eec27e404f54edc8082aa675ae69f6927c9237c1c
BLAKE2b-256 checksum
How to use checksums
2e9acaf5ae89f874b1839296956e91d6d6d6305b927a3363954f9a372e0d99e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.14.0 Linux/6.11.0-1018-azure

Release files / ai4_metadata-2.4.2-py3-none-any.whl

Download URL ai4_metadata-2.4.2-py3-none-any.whl
Size 53.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbea8ed81a46ad3862dd8f52c3a423e43c92325aa75c161f5c35192e5010d72b
BLAKE2b-256 checksum
How to use checksums
64efc084f5c4beb59e11686d87dae1936869e14d411c6e3af41e8c360e302cc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.14.0 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

2.4.2 This release

2 release files

2.4.1

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page