1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! DTDL v3 — Digital Twin Definition Language Support
//!
//! This module implements Microsoft DTDL v3 parsing, RDF mapping, and
//! semantic validation for the OxiRS physics crate.
//!
//! # Overview
//!
//! DTDL (Digital Twin Definition Language) is an open specification by
//! Microsoft for defining Digital Twin interfaces in IoT and industrial
//! contexts. A DTDL v3 document is a JSON-LD object that declares one or
//! more **Interface** elements, each of which may contain:
//!
//! - **Telemetry** — time-series observable values (e.g. temperature)
//! - **Property** — settable configuration or state
//! - **Command** — request/response operation
//! - **Component** — composition via another Interface DTMI
//! - **Relationship** — directed link to other digital twins
//!
//! # Quick Start
//!
//! ```rust
//! use oxirs_physics::dtdl::{parse_dtdl_interface, interface_to_rdf, validate};
//!
//! let json = r#"{
//! "@context": "dtmi:dtdl:context;3",
//! "@type": "Interface",
//! "@id": "dtmi:example:Thermostat;1",
//! "displayName": "Thermostat",
//! "contents": [
//! { "@type": ["Telemetry","Temperature"], "name": "temperature", "schema": "double", "unit": "Celsius" },
//! { "@type": "Property", "name": "targetTemperature", "schema": "double", "writable": true }
//! ]
//! }"#;
//!
//! let iface = parse_dtdl_interface(json).expect("parse failed");
//! assert_eq!(iface.id.0, "dtmi:example:Thermostat;1");
//!
//! let errors = validate(&iface);
//! assert!(errors.is_empty());
//!
//! let triples = interface_to_rdf(&iface);
//! assert!(!triples.is_empty());
//! ```
//!
//! # Module layout
//!
//! | Module | Responsibility |
//! |--------|---------------|
//! | [`types`] | Core data structures: [`Dtmi`], [`DtdlInterface`], [`DtdlContent`], etc. |
//! | [`parser`] | JSON → typed structs (`parse_dtdl_interface`) |
//! | [`mapper`] | [`DtdlInterface`] → [`RdfTriple`]s, QUDT unit mapping |
//! | [`validator`] | Semantic validation rules (`validate`, `is_valid`) |
//!
//! # Coexistence with DTDL v2
//!
//! A lightweight DTDL v2 parser (`parse_dtdl_json`, `DtdlModel`) already
//! lives in [`crate::digital_twin`]. This module provides a richer v3
//! implementation with full RDF mapping and DTMI validation. Both modules
//! can be used concurrently; the v3 types live in `crate::dtdl::types` and
//! are distinct from the simpler `digital_twin` v2 types.
// ─── Flat re-exports ─────────────────────────────────────────────────────────
pub use ;
pub use ;
pub use ;
pub use ;