Source code for tdw_catalog.metadata_template.linked_dataset

from typing import Optional
import tdw_catalog.dataset as dataset

from tdw_catalog.utils import MetadataFieldType
import tdw_catalog.metadata_template.field as field


[docs]class Field(field.MetadataTemplateField[dataset.Dataset]): """ Connect :class:`.Dataset`\\ s together to indicate a semantic relation and/or increase discoverability Attributes ---------- None """ def __init__(self, key: str, default_value: Optional['dataset.Dataset'], optional: Optional[bool]) -> None: super().__init__(key, default_value, optional) def serialize(self) -> dict: res = super().serialize() res["default_value"] = self.default_value.id if self.default_value is not None else None res["field_type"] = MetadataFieldType.FT_DATASET return res