atlasdcat package¶
Submodules¶
atlasdcat.attribute module¶
Attribute module for mapping an Atlas Glossery to DCAT rdf.
- class atlasdcat.attribute.Attribute(value)¶
-
Attribute enum.
- ACCESS_RIGHTS = 'accessRights'¶
- ACCESS_URL = 'accessURL'¶
- CONTACT_EMAIL = 'contactEmail'¶
- CONTACT_NAME = 'contactName'¶
- DATASET = 'Dataset'¶
- DISTRIBUTION = 'Distribution'¶
- DOWNLOAD_URL = 'downloadURL'¶
- FORMAT = 'format'¶
- FREQUENCY = 'frequency'¶
- GENERATED = 'generated'¶
- INCLUDE_IN_DCAT = 'includeInDCAT'¶
- KEYWORD = 'keyword'¶
- LICENSE = 'license'¶
- PUBLISHER = 'publisher'¶
- SPATIAL = 'spatial'¶
- SPATIAL_RESOLUTION_IN_METERS = 'spatialResolutionInMeters'¶
- TEMPORAL_END_DATE = 'temporalEndDate'¶
- TEMPORAL_RESOLUTION = 'temporalResolution'¶
- TEMPORAL_START_DATE = 'temporalStartDate'¶
- THEME = 'theme'¶
- TITLE = 'title'¶
atlasdcat.glossaryclient module¶
AtlasClient module for mapping an Atlas Glossery to DCAT rdf.
atlasdcat.mapper module¶
Mapper module for mapping an Atlas Glossery to DCAT rdf.
This module contains methods for mapping an Atlas Glossery to DCAT rdf according to the dcat-ap-no v.2 standard
Example
Setup the AtlasDcatMapper. >>> 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://example.com/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 >>> 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}”)
>>> 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:
>>> 6+
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}")
- class atlasdcat.mapper.AtlasDcatMapper(glossary_client, glossary_id, catalog_uri, catalog_language, catalog_title, catalog_publisher, dataset_uri_template, distribution_uri_template, language='nb', attr_mapping=None, is_purview=None, include_approved_only=False)¶
Bases:
objectClass for mapping Atlas Glossary terms to DCAT catalog.
- map_dataset_catalog_to_glossary_terms(catalog)¶
Map dcat dataset catalog RDF resource to glossary terms.
- Parameters
catalog (
Catalog) – A dataset catalog RDF resource- Raises
MappingError – A mapping error if the language does not match
InvalidStateError – If glossary is not fetched before calling this function
- Return type
- map_glossary_terms_to_dataset_catalog()¶
Map glossary terms to dcat dataset catalog RDF resource.
- Return type
- Returns
A catalog RDF resource.
- Raises
InvalidStateError – If glossary is not fetched before calling this function
- save_glossary_terms()¶
Save glossary terms.
- Raises
InvalidStateError – If there are no terms to save.
- Return type
- exception atlasdcat.mapper.FormatError¶
Bases:
MappingErrorException class for format errors.
- exception atlasdcat.mapper.InvalidStateError¶
Bases:
MappingErrorException class for invalid state errors.
- exception atlasdcat.mapper.TemporalError¶
Bases:
MappingErrorException class for temporal errors.
atlasdcat.termtype module¶
Termtype module for mapping an Atlas Glossery to DCAT rdf.
Module contents¶
atlasdcat package.