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().

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datacatalogtordf-4.1.4.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datacatalogtordf-4.1.4-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file datacatalogtordf-4.1.4.tar.gz.

File metadata

  • Download URL: datacatalogtordf-4.1.4.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1020-azure

File hashes

Hashes for datacatalogtordf-4.1.4.tar.gz
Algorithm Hash digest
SHA256 ae72f4c9574833f1bdb47d0fc63449ef6e238880f522405b3b14cb0f4e3b5d4d
MD5 9c09e776e3e5a10d1f6a5589529711ff
BLAKE2b-256 39dd6882762f09c055be9ea2df999e0ce9fa69ea70fe9fa6926546d1589b3fa1

See more details on using hashes here.

File details

Details for the file datacatalogtordf-4.1.4-py3-none-any.whl.

File metadata

  • Download URL: datacatalogtordf-4.1.4-py3-none-any.whl
  • Upload date:
  • Size: 42.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1020-azure

File hashes

Hashes for datacatalogtordf-4.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 14e16d47c65bca77a24a60a16fc46642eede149f5b5c533fce957f33f1b3fbe1
MD5 6028e7add2d151ed8fc97fd143760220
BLAKE2b-256 f082f29141abb33bebe691a6bb33955fd7442a32e67d9ddc1f9301b6b0e91f33

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.1.4 This release

2 files

4.1.3

2 files

4.1.2

2 files

4.1.1

2 files

4.1.0

2 files

4.0.1

2 files

4.0.0

2 files

3.0.0

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.9

2 files

1.4.8

2 files

1.4.7

2 files

1.4.6

2 files

1.4.5

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.0

2 files

1.1.0

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 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