Python API for interacting with openMINDS metadata schemas
Project description
This Python API helps you to interact with the EBRAINS openMINDS metadata models and schemas. It consists of two sub-modules:
The openMINDS.generator (coming soon) facilitates the translation of the openMINDS schema template syntax to other established formats, such as HTML and JSON-Schema.
The openMINDS.compiler allows you the dynamic usage of openMINDS metadata models and schemas in your Python application for generating your own collection of openMINDS conform metadata representations (instances) as JSON-LDs.
Installation
The official versions are available at the Python Package Index and can be installed using pip install
in your console:
pip install openMINDS
The latest version is available on GitHub.
Documentation
Please find in the following a basic documenation on how to use the two submodules (openMINDS.generator and openMINDS.compiler) of the openMINDS Python API. A full documentation can be found on the EBRAINS Collaboratory (coming soon).
openMINDS.compiler
As stated above, the openMINDS.compiler allows you the dynamic usage of openMINDS metadata models and schemas in your Python application for generating your own collection of openMINDS conform metadata representations (instances) as JSON-LDs. Here a small example:
import openMINDS.compiler
# initiate the helper class for the dynamic usage of a specific openMINDS version
helper = openMINDS.compiler.Helper(version="dev")
# initiate the collection into which you will store all metadata instances
mycollection = helper.create_collection()
# create a metadata instance for (e.g.) the openMINDS Person schema
lyuba = mycollection.add_core_person(givenName="Lyuba")
# add more metadata to a created instance
mycollection.get(lyuba).familyName = "Zehl"
# add connections to other metadata instances
email_lyuba = mycollection.add_core_contactInformation(email="openminds@ebrains.eu")
mycollection.get(lyuba).contactInformation = email_lyuba
# save your collection
mycollection.save("./myFirstOpenMINDSMetadataCollection/")
To learn in general about the available openMINDS metadata models, schemas and their required or optional metadata properties, please go the main openMINDS GitHub repository, or the full documentation on the EBRAINS Collaboratory (coming soon).
Within the openMINDS.compiler you can also get an overview of the requirement of a schema and all its properties by using the 'help_X' function. Here an example:
mycollection.help_core_person()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for openMINDS-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fea037ce0ca3a0eef4736e9074ba3223a9fca4971e1db776dc37ffd0b8f46ac |
|
MD5 | 73f7f5e3f30dd0df4d2e42f2ecd06a77 |
|
BLAKE2b-256 | c3ac386eaed96646727122e7bb29476982f0025dc98ce066e5d740a8229931ee |