# Overview The **Cross-Domain Interoperability Framework (CDIF)** is a set of guidelines and metadata profiles designed to facilitate the discovery, exchange, and integration of research and scientific data across diverse disciplinary boundaries. Developed under initiatives spearheaded by the **CODATA/W3C/DDI Alliance** (including the Horizon Europe **WorldFAIR** project), CDIF establishes common standards for expressing dataset discovery, structural descriptions, variable semantics, provenance, and packaging. `dartfx-cdif` is a Python toolkit providing **Pydantic v2 data models**, an **RDF graph dual-serialization engine**, an automated **schema-driven code generator**, and a **CLI validation suite** for CDIF metadata. --- ## The Cross-Domain Interoperability Challenge Scientific research increasingly demands cross-disciplinary collaboration—integrating climate observations with socio-economic data, epidemiological models with genomics, or disaster management data with geospatial sensors. However, each domain historically adopted distinct metadata standards: * **Social Sciences**: DDI (Data Documentation Initiative) Codebook and Lifecycle. * **Geospatial & Earth Sciences**: ISO 19115, OGC standards, GeoSPARQL. * **Life Sciences**: Bioschemas, OBO ontologies, ISA-Tab. * **Web Data Publishing**: Schema.org, W3C DCAT (Data Catalog Vocabulary). * **Provenance & Lineage**: W3C PROV-O, GSBPM. CDIF harmonizes these disparate ecosystems by defining modular, reusable **profiles** layered on top of W3C and Web standards—primarily **JSON-LD**, **Schema.org**, **DDI-CDI**, **W3C DCAT**, **PROV-O**, and **SKOS**. --- ## Architectural Role of `dartfx-cdif` Within the **Data Artifex** scientific data ecosystem, `dartfx-cdif` serves as the authoritative interface for interacting with CDIF metadata. ``` +-----------------------------------+ | Upstream CDIF Specifications | | - JSON Schemas (Draft 2020-12) | | - JSON-LD @context (2026) | | - SKOS Controlled Vocabularies | +-----------------+-----------------+ | [dartfx.cdif.codegen] | v +-----------------------------------------------------------------------------------+ | dartfx-cdif | | | | +-----------------------------------------------------------------------------+ | | | Generated Pydantic v2 Models | | | | - CdifCoreDataset - CdifDataStructureDataset | | | | - CdifDiscoveryDataset - CdifProvenanceDataset | | | | - CdifDataDescriptionDataset - CdifManifestDataset / CdifCodelist | | | | - CdifCompleteDataset (Composite Multi-Profile Model) | | | +-----------------------------------------------------------------------------+ | | | | | +-------------------------------+-------------------------------+ | | | | | | v v | | [JSON-LD Serialization] [RDF Graph Engine] | | Direct dictionary export via Full rdflib Graph | | Pydantic alias mappings via dartfx-rdf | | (to_jsonld / from_jsonld) (to_rdf / from_rdf) | +-----------------------------------------------------------------------------------+ | | v v JSON-LD Payloads RDF Turtle / SPARQL (Web APIs, Catalogs) (Triplestores, Graphs) ``` --- ## Key Features ### 1. Dual Serialization: Framed JSON-LD & W3C RDF Graph CDIF metadata documents are natively expressed as JSON-LD trees for web discovery, but their true semantic power lies in their underlying RDF graph. `dartfx-cdif` provides seamless, zero-loss translation between both paradigms: * **Framed JSON-LD**: Manipulate nested Python dictionary trees matching Schema.org conventions (`to_jsonld()` / `from_jsonld()`). * **W3C RDF Graph**: Convert any model into an `rdflib.Graph` (`to_rdf()`) or reconstruct models directly from raw RDF triplestores or SPARQL query results (`from_rdf()`). ### 2. Comprehensive Profile Coverage `dartfx-cdif` provides fully typed models for all **8 official CDIF profiles**: * **Core Profile**: Persistent identifiers, licenses, creators, publishers, and catalog records. * **Discovery Profile**: Geospatial extents, temporal intervals, keywords, and data access distributions. * **Data Description Profile**: Variables measured, statistical properties, and physical units. * **Data Structure Profile**: Tabular records, dimensions, measures, attributes, and DDI-CDI mappings. * **Provenance Profile**: W3C PROV-O activities, entity derivations, agents, and processing workflows. * **Manifest Profile**: Distribution packaging, checksums, and hierarchical dataset parts. * **Code List Profile**: SKOS Concept Schemes, controlled vocabularies, and code notations. * **Complete Composite**: An integrated multi-profile model combining all capabilities for comprehensive datasets. ### 3. Automated Schema-Driven Code Generation To prevent schema drift and ensure total compliance with evolving CDIF specifications, `dartfx-cdif` includes a built-in code generator (`dartfx.cdif.codegen`). The generator automatically parses upstream Draft 2020-12 JSON Schemas, `@context` declarations, and SKOS Turtle ontologies, emitting optimized Pydantic v2 classes with exact RDF property predicates. ### 4. Smart Profile Detection and Loading The `dartfx.cdif.registry` module inspects incoming metadata documents (JSON-LD files, strings, dictionaries, or `rdflib.Graph` instances) and automatically detects the conforming profile via `dcterms:conformsTo` URIs or structural heuristic scoring, instantiating the appropriate model class via `load_cdif()`. ### 5. Normative Conformance Validation In addition to Pydantic's structural type validation, CDIF models implement `validate_conformance()`, enforcing profile-specific business rules, required field presence, and conditional `anyOf` constraints (e.g., verifying that a dataset declares either a `schema:license` or a `schema:conditionsOfAccess`). ### 6. Command Line Interface (CLI) A clean command line tool (`cdif`) empowers developers and data stewards to validate metadata files, inspect registered profiles, and regenerate Python models directly from the shell.