httk.core.datasets¶
Neutral dataset identity, distribution, and publication metadata contracts.
Classes¶
Describe one retrievable representation of a dataset. |
|
Describe one published dataset independently of a transport or provider. |
|
Store one |
Module Contents¶
- class httk.core.datasets.DatasetDistribution[source]¶
Describe one retrievable representation of a dataset.
Identifier and vocabulary fields must be well-formed absolute IRIs.
access_urlmay instead be a root-relative URL for later resolution by a serving application.byte_sizeis a non-negative integer, andsha256is a lowercase hexadecimal digest.- Parameters:
id – An optional identifier for this representation.
access_url – An optional URL from which the representation can be retrieved.
media_type_iri – An optional IRI identifying the media type.
format_iri – An optional IRI identifying the representation format.
byte_size – The optional representation size in bytes.
sha256 – The optional lowercase SHA-256 digest.
- classmethod create(obj)[source]¶
Coerce a distribution instance or exact-field mapping.
- Parameters:
obj (DatasetDistribution | Mapping[str, Any]) – A distribution instance or a mapping of distribution fields.
- Returns:
The existing or newly constructed distribution.
- Raises:
TypeError – If
objis neither a distribution nor a mapping.ValueError – If the mapping has unknown or invalid fields.
- Return type:
Self
- class httk.core.datasets.Dataset[source]¶
Describe one published dataset independently of a transport or provider.
idandpublisher_idare absolute IRIs. The remaining fields are human-readable metadata and retain their supplied text exactly.- Parameters:
id – The dataset’s absolute IRI.
title – The dataset’s human-readable title.
description – A non-empty description of the dataset.
publisher_id – The publisher’s absolute IRI.
publisher_name – The publisher’s human-readable name.
distributions – The dataset’s retrievable representations.
- distributions: tuple[DatasetDistribution, Ellipsis] = ()[source]¶
- classmethod create(obj)[source]¶
Coerce a mapping or existing dataset into a
Dataset.- Parameters:
obj (Dataset | Mapping[str, Any]) – A dataset instance or a mapping with exactly the dataset fields.
- Returns:
The existing or newly constructed dataset.
- Raises:
TypeError – If
objis neither a dataset nor a mapping.ValueError – If the mapping has missing, unknown, or invalid fields.
- Return type:
Self
- class httk.core.datasets.DatasetRecord[source]¶
Bases:
DatasetStore one
Datasetusing the core dataset storage contract.- Parameters:
id – The dataset’s absolute IRI.
title – The dataset’s human-readable title.
description – A non-empty description of the dataset.
publisher_id – The publisher’s absolute IRI.
publisher_name – The publisher’s human-readable name.
distributions – The dataset’s retrievable representations.
- classmethod create(obj)[source]¶
Coerce a dataset record, neutral dataset, or field mapping.
- Parameters:
obj (DatasetRecord | Dataset | Mapping[str, Any]) – A dataset record, neutral dataset, or exact-field mapping.
- Returns:
The existing or newly constructed dataset record.
- Raises:
TypeError – If
objis not a dataset or mapping.ValueError – If the mapping has unknown, missing, or invalid fields.
- Return type:
Self