Skip to main content

atlasdcat

Tests codecov PyPI Read the Docs

A Python library for mapping Apache Atlas Glossary terms to DCAT metadata and vice versa.

Specification the Norwegian Application Profile of the DCAT standard.

Notice This library is part of the DCAT for Apache Atlas lifecycle and not a complete solution. The complete lifecycle contains the following actions:

  • Create glossary
  • Add dataset descriptions by using atlasdcat mapper (this library)
  • Assign dataset description glossary terms to entities (actual datasets)
  • Fetch glossary terms as DCAT catalog in RDF format (this library)

Usage

Install

% pip install atlasdcat

Getting started

Setup mapper

# Example...
from atlasdcat import AtlasDcatMapper, AtlasGlossaryClient
from pyapacheatlas.auth import BasicAuthentication

atlas_auth = BasicAuthentication(username="dummy", password="dummy")
atlas_client = AtlasGlossaryClient(
    endpoint_url="http://atlas", authentication=atlas_auth
)

mapper = AtlasDcatMapper(
    glossary_client=atlas_client,
    glossary_id="myglossary",
    catalog_uri="https://domain/catalog",
    catalog_language="http://publications.europa.eu/resource/authority/language/NOB",
    catalog_title="Catalog",
    catalog_publisher="https://domain/publisher",
    dataset_uri_template="http://domain/datasets/{guid}",
    distribution_uri_template="http://domain/distributions/{guid}",
    language="nb",
)

Map glossary terms to DCAT Catalog RDF resource

try:
    mapper.fetch_glossary()
    catalog = mapper.map_glossary_terms_to_dataset_catalog()
    print(catalog.to_rdf())
except Exception as e:
    print(f"An exception occurred: {e}")

Map DCAT Catalog RDF resource to glossary terms

catalog = Catalog()
catalog.identifier = "http://catalog-uri"
catalog.title = {"nb": "mytitle"}
catalog.publisher = "http://publisher"
catalog.language = ["nb"]
catalog.license = ""

dataset = Dataset()
dataset.title = {"nb": "Dataset"}
dataset.description = {"nb": "Dataset description"}
catalog.datasets = [dataset]

try:
    mapper.fetch_glossary()
    mapper.map_dataset_catalog_to_glossary_terms(catalog)
    mapper.save_glossary_terms()
except Exception as e:
    print(f"An exception occurred: {e}")

For an example of usage of this library in a simple server, see example.

Development

Requirements

% pip install poetry==1.1.13
% pip install nox==2022.1.7
% pip inject nox nox-poetry==1.0.0

Install developer tools

% git clone https://github.com/Informasjonsforvaltning/atlasdcat.git
% cd atlasdcat
% pyenv install 3.8.12
% pyenv install 3.9.10
% pyenv install 3.10.
% pyenv local 3.8.12 3.9.10 3.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 atlasdcat 1.0.3

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

Source distribution (sdist)

Source distribution for atlasdcat 1.0.3
File Size Uploaded Provenance Actions
atlasdcat-1.0.3.tar.gz 16.3 kB Without provenance Details for atlasdcat-1.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 31.8 kB

Release files / atlasdcat-1.0.3.tar.gz

Download URL atlasdcat-1.0.3.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ecd831edd40858120f745dde2a430077c359bf56e7162a12e1fa04aa47abc3e3
BLAKE2b-256 checksum
How to use checksums
5d3269b76e88f9bba1de5e173f1f04f5bc468ed2f38daac39cb7c1abd938b153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.6 Linux/5.15.0-1023-azure

Release files / atlasdcat-1.0.3-py3-none-any.whl

Download URL atlasdcat-1.0.3-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cda1adc87aa4e4f5b8a41ebcffecb0c9b8578c591f04a36d1dcb68b7997d7905
BLAKE2b-256 checksum
How to use checksums
51a365b9185ca0661fbf1738adf802fbc11769a0537bcab249a820bcc6d26112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.6 Linux/5.15.0-1023-azure

Security for atlasdcat 1.0.3

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.

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