# Command Line Interface (CLI) `dartfx-cdif` includes a command line interface `cdif` built with [Typer](https://typer.tiangolo.com/). The CLI enables rapid inspection, metadata validation, and automated code generation directly from your terminal. --- ## Overview ```bash cdif --help ``` ```text Usage: cdif [OPTIONS] COMMAND [ARGS]... CLI utilities for Cross-Domain Interoperability Framework (CDIF) profiles and Pydantic RDF models. Options: --help Show this message and exit. Commands: codegen Regenerate CDIF Pydantic + RDF models from upstream JSON Schemas and vocabularies. profiles List registered CDIF profiles, model classes, and canonical URIs. validate Load a CDIF metadata file into its Pydantic model and run conformance checks. ``` --- ## Commands ### `cdif profiles` List all registered CDIF profiles, their root Pydantic model classes, and their canonical/versioned URIs. ```bash cdif profiles ``` #### Output Example ```text core: CdifCoreDataset - https://w3id.org/cdif/core/1.1 - https://w3id.org/cdif/core/1.0 discovery: CdifDiscoveryDataset - https://w3id.org/cdif/discovery/1.0 data_description: CdifDataDescriptionDataset - https://w3id.org/cdif/datadescription/1.0 data_structure: (component-only) - https://w3id.org/cdif/datastructure/1.0 provenance: CdifProvenanceDataset - https://w3id.org/cdif/provenance/1.0 manifest: CdifManifestDataset - https://w3id.org/cdif/manifest/1.0 codelist: CdifCodelist - https://w3id.org/cdif/codelist/1.0 complete: CdifCompleteDataset - https://w3id.org/cdif/complete/1.0 ``` --- ### `cdif validate` Load a CDIF JSON-LD or RDF metadata file, automatically detect its profile (or use an explicit one), instantiate the corresponding Pydantic v2 model, and execute normative conformance validation. ```bash cdif validate [OPTIONS] ``` #### Arguments & Options * `PATH`: Path to a CDIF metadata file (JSON-LD, Turtle, NT, etc.). * `--profile`, `-p`: Explicit profile key or URI (auto-detected if omitted). * `--format`, `-f`: RDF serialization format (e.g., `json-ld`, `turtle`). #### Example: Valid Document ```bash cdif validate examples/kaggle-iris.jsonld ``` ```text Loaded Detected profiles: ['core'] Conformance: VALID (profile: https://w3id.org/cdif/core/1.1) ``` #### Example: Invalid Document ```bash cdif validate invalid-dataset.jsonld ``` ```text Loaded Detected profiles: ['core'] Conformance: INVALID (profile: https://w3id.org/cdif/core/1.1) Errors: - [missing_required] schema:creator: Field is required by profile - [missing_any_of] schema:license | schema:conditionsOfAccess: At least one of these fields must be provided ``` --- ### `cdif codegen` Re-compile upstream CDIF specifications (JSON Schemas, `@context`, and SKOS ontologies) into the local Pydantic models. ```bash cdif codegen [OPTIONS] ``` #### Options * `--cdif-root`: Path to the local `git-cdif` repositories directory. Defaults to locating `git-cdif` relative to the workspace. * `--output-dir`: Destination directory for generated Python models. Defaults to `src/dartfx/cdif/models`. #### Example ```bash cdif codegen --output-dir src/dartfx/cdif/models ``` ```text Generated 11 files: .../src/dartfx/cdif/models/vocabularies.py .../src/dartfx/cdif/models/common.py .../src/dartfx/cdif/models/profiles/core.py .../src/dartfx/cdif/models/profiles/discovery.py .../src/dartfx/cdif/models/profiles/datadescription.py .../src/dartfx/cdif/models/profiles/datastructure.py .../src/dartfx/cdif/models/profiles/provenance.py .../src/dartfx/cdif/models/profiles/manifest.py .../src/dartfx/cdif/models/profiles/codelist.py .../src/dartfx/cdif/models/profiles/complete.py .../src/dartfx/cdif/models/profiles/__init__.py ```