Skip to main content

datacatalogtordf

Tests codecov PyPI Read the Docs

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:

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(format="turtle")
print(rdf.decode())

Will produce the following output:

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .

<http://example.com/catalogs/1> a dcat:Catalog ;
    dct:publisher <https://example.com/publishers/1> ;
    dct:title "A dataset catalog"@en ;
    dcat:dataset <http://example.com/datasets/1> .

<http://example.com/datasets/1> a dcat:Dataset ;
    dct:title "incomeAPI"@en,
        "inntekstAPI"@nb .

Development

Requirements

% pipx install poetry==1.1.13
% pipx install nox==2022.1.7
% pipx inject nox nox-poetry==0.9.0

Install developer tools

% git clone https://github.com/Informasjonsforvaltning/datacatalogtordf.git
% cd datacatalogtordf
% pyenv install 3.8.12
% pyenv install 3.9.10
% pyenv local 3.8.12 3.9.10 
% 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().

Metadata

Release files for datacatalogtordf 4.1.4

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

Source distribution (sdist)

Source distribution for datacatalogtordf 4.1.4
File Size Uploaded Provenance Actions
datacatalogtordf-4.1.4.tar.gz 26.8 kB Without provenance Details for datacatalogtordf-4.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datacatalogtordf 4.1.4
File Interpreter ABI Platform Actions
datacatalogtordf-4.1.4-py3-none-any.whl Python 3 none any Details for datacatalogtordf-4.1.4-py3-none-any.whl

Total release size: 68.8 kB

Release files / datacatalogtordf-4.1.4.tar.gz

Download URL datacatalogtordf-4.1.4.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ae72f4c9574833f1bdb47d0fc63449ef6e238880f522405b3b14cb0f4e3b5d4d
BLAKE2b-256 checksum
How to use checksums
39dd6882762f09c055be9ea2df999e0ce9fa69ea70fe9fa6926546d1589b3fa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1020-azure

Release files / datacatalogtordf-4.1.4-py3-none-any.whl

Download URL datacatalogtordf-4.1.4-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14e16d47c65bca77a24a60a16fc46642eede149f5b5c533fce957f33f1b3fbe1
BLAKE2b-256 checksum
How to use checksums
f082f29141abb33bebe691a6bb33955fd7442a32e67d9ddc1f9301b6b0e91f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1020-azure

Security for datacatalogtordf 4.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.1.4 This release

2 release files No provenance

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