Source code for dartfx.cdif.models.profiles.codelist

# AUTO-GENERATED by dartfx.cdif.codegen — DO NOT EDIT MANUALLY.
"""CDIF Codelist profile (skos:ConceptScheme / schema:DefinedTermSet)."""

from __future__ import annotations

from typing import Annotated, Any, ClassVar

from pydantic import Field
from rdflib import URIRef

from dartfx.cdif.models._base import CdifBaseModel
from dartfx.cdif.models.common import CatalogRecord, CdifCodelistConcept, ObjectReference, PropertyValue
from dartfx.cdif.namespaces import SCHEMA, SKOS
from dartfx.rdf.pydantic import RdfProperty


[docs] class CdifCodelist(CdifBaseModel): """ A controlled-vocabulary codelist implemented as a skos:ConceptScheme constrained for CDIF use. The scheme must have a resolvable @id and identify its top concepts via skos:hasTopConcept; each concept (CdifCodelistConcept) must have a resolvable @id, skos:inScheme, skos:prefLabel, and skos:notation. Hierarchical concepts must declare both skos:narrower (for JSON tree traversal) and skos:broader (for upward navigation) where hierarchy exists. CDIF metadata properties (schema:identifier, schema:dateModified, schema:license or schema:conditionsOfAccess) take precedence over the equivalent dcterms properties from the base skos:ConceptScheme. """ rdf_type: ClassVar[Any] = [SKOS.ConceptScheme] cdif_profile_uri: ClassVar[str | None] = "https://w3id.org/cdif/codelist/2.0" cdif_required_fields: ClassVar[tuple[str, ...]] = ( "@id", "skos:prefLabel", "schema:identifier", "schema:dateModified", "skos:hasTopConcept", ) identifier: Annotated[ PropertyValue | str | list[PropertyValue | str] | None, RdfProperty(SCHEMA.identifier), ] = Field( default=None, alias="schema:identifier", description="Primary identifier for the codelist. May be a string URI or a structured PropertyValue.", ) date_modified: Annotated[str | list[str] | None, RdfProperty(SCHEMA.dateModified)] = Field( default=None, alias="schema:dateModified", description="ISO 8601 date when the codelist was last modified.", ) url: Annotated[URIRef | str | list[URIRef | str] | None, RdfProperty(SCHEMA.url)] = Field( default=None, alias="schema:url", description="Web location of a page describing the codelist.", ) license: Annotated[ ObjectReference | URIRef | str | list[ObjectReference | URIRef | str] | None, RdfProperty(SCHEMA.license), ] = Field( default=None, alias="schema:license", description="License for the codelist.", ) conditions_of_access: Annotated[str | list[str] | None, RdfProperty(SCHEMA.conditionsOfAccess)] = Field( default=None, alias="schema:conditionsOfAccess", description="Text statement of access conditions for the codelist.", ) pref_label: Annotated[str | list[str] | None, RdfProperty(SKOS.prefLabel)] = Field( default=None, alias="skos:prefLabel", description=( "Preferred lexical label for the concept scheme. Required. A single string, a single language- " "tagged value, or an array of language-tagged values. **Uniqueness rule.** Each language should " "appear at..." ), ) definition: Annotated[str | list[str] | None, RdfProperty(SKOS.definition)] = Field( default=None, alias="skos:definition", description="Formal explanation of the meaning or purpose of this concept scheme.", ) note: Annotated[str | list[str] | None, RdfProperty(SKOS.note)] = Field( default=None, alias="skos:note", description="General note about the concept scheme.", ) has_top_concept: Annotated[ CdifCodelistConcept | list[CdifCodelistConcept] | None, RdfProperty(SKOS.hasTopConcept), ] = Field( default=None, alias="skos:hasTopConcept", description="Top-level concepts that have no skos:broader in this scheme. Required for hierarchical codelists.", ) subject_of: Annotated[CatalogRecord | list[CatalogRecord] | None, RdfProperty(SCHEMA.subjectOf)] = Field( default=None, alias="schema:subjectOf", description=( "Catalog record describing this codelist as CDIF-conformant metadata. Must declare conformance to " "the cdifCodelist profile via dcterms:conformsTo and be typed as schema:Dataset with " "schema:additiona..." ), )
CdifCodelist.model_rebuild() __all__ = ["CdifCodelist", "CdifCodelistConcept"]