A library for mapping a data catalog to rdf
Project description
datacatalogtordf
A small Python library for mapping a data catalog to rdf
The library contains helper classes for the following dcat classes:
Other relevant classes are also supported, such as:
- Contact vcard:Kind
The library will map to the Norwegian Application Profile of the DCAT standard.
Usage
Install
% pip install datacatalogtordf
Getting started
from datacatalogtordf import Catalog, Dataset
# Create catalog object
catalog = Catalog()
catalog.identifier = "http://example.com/catalogs/1"
catalog.title = {"en": "A dataset catalog"}
catalog.publisher = "https://example.com/publishers/1"
# Create a dataset:
dataset = Dataset()
dataset.identifier = "http://example.com/datasets/1"
dataset.title = {"nb": "inntektsAPI", "en": "incomeAPI"}
#
# Add dataset to catalog:
catalog.datasets.append(dataset)
# get rdf representation in turtle (default)
rdf = catalog.to_rdf()
print(rdf.decode())
Development
Requirements
% pipx install poetry==1.1.4
% pipx install nox==2020.8.22
% pipx inject nox nox-poetry
Install
% git clone https://github.com/Informasjonsforvaltning/datacatalogtordf.git
% cd datacatalogtordf
% pyenv install 3.8.2
% pyenv install 3.7.6
% pyenv local 3.8.2 3.7.6
% poetry install
Run all sessions
% nox
Run all tests with coverage reporting
% nox -rs tests
Debugging
You can enter into Pdb by passing --pdb
to pytest:
nox -rs tests -- --pdb
You can set breakpoints directly in code by using the function breakpoint()
.
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
datacatalogtordf-1.3.0.tar.gz
(23.1 kB
view details)
Built Distribution
File details
Details for the file datacatalogtordf-1.3.0.tar.gz
.
File metadata
- Download URL: datacatalogtordf-1.3.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.4 Linux/5.4.0-1043-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f5f02054775ddb187b8d8ede7c7dc25c0029223d0bc9f22024b7a87dc64708a |
|
MD5 | c3ffc0580ea38294cc6c7087a2e3f760 |
|
BLAKE2b-256 | 258e726cf8b724368a24380ef014b1d32dd4bd71cee39890c7f01e0a18ea92b0 |
File details
Details for the file datacatalogtordf-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: datacatalogtordf-1.3.0-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.4 Linux/5.4.0-1043-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 261773d10a1d34b18890f7b2358be8297ae72da2bfa8bad00586f67fabe4f25c |
|
MD5 | 1ab148e397b9d0be750375b57e96627b |
|
BLAKE2b-256 | cc6a9d4a800c6dfb454aa4993009d3c22c34a10e8ad55d5ee606a7c80e1d6b5a |