About Semantic Data Types
Discover the motivation, specifications, and architecture that make Semantic Data Types (SDT) a core building block for AI agents and clean software design.
What is a Semantic Data Type?
Traditional programming languages and databases describe data in terms of its physical storage representation: string, integer, float, or boolean.
A Semantic Data Type (SDT) sits above these physical types, establishing a formal bridge between conceptual representations and physical storage or programming data types. By capturing key aspects—including meaning and purpose, usage, formatting, and validation rules—an SDT enables both humans and machines to gain a deep, actionable understanding of the associated data. For example, rather than representing a Social Security Number simply as a string, an SDT defines it as a distinct conceptual entity bound to specific metadata constraints, geopolitical coverage (US), validation checksums, display formatting, and agentic instructions.
Key Characteristics
Ontological Mapping
Each SDT is mapped to one or more conceptual definitions in global vocabularies (e.g., SKOS, Wikidata, Dublin Core, or DDI-CDI), ensuring cross-domain semantic interoperability.
Contextual Boundaries
SDTs declare their temporal and geospatial scope (e.g., ISO country codes or specific legal domains), indicating exactly where and when the variable representation is valid.
Agent Guidelines
Provides machine-readable instructions and system prompt snippets so that Large Language Models (LLMs) and agentic toolkits know how to parse, normalize, mask, or display values.
Built on LinkML
The Semantic Data Type modeling schema is built upon and compiled using LinkML (Linked Data Modeling Language).
LinkML provides a robust, author-friendly framework for describing structural data models. By leveraging LinkML, this project gains automated model validation, strict schema conformance checks, and dynamic generation of multi-environment target bindings (such as Python Pydantic classes, TypeScript interfaces, Rust modules, and Markdown documentation) from a single source of truth.
Comparison with Other Systems
| Feature | Physical Types (e.g., JSON Schema) | Semantic Web (RDF / OWL) | Semantic Data Types (SDT) |
|---|---|---|---|
| Data Constraints | Basic regex and numerical ranges. | Logic axioms, domain/range constraints. | Multi-layered patterns, custom checksum algorithms, and templates. |
| Environment Portability | Primarily JSON/Web environments. | Linked-data formats (Turtle, JSON-LD). | Multi-environment storage bindings (Python, Rust, TS, SQL). |
| Agent Interaction | None (requires custom code). | Query engines (SPARQL). | Direct agent guidelines and LLM prompt snippets. |
| Code Generation | Schema to class generation. | None (purely conceptual). | Built-in fuzzer patterns and environment-specific snippet generation. |