Skip to main content

qualia_client_core/wellfair/cml_context/
mod.rs

1//! Rust-native **CML context graph** + **COF HTML+RDFa** for the hypermedia Library.
2//!
3//! Goal: every ingested document (legislation, notes, policies, contracts) gets a
4//! **TEXT → CONCEPT → LOGIC** layer that is honest about provenance:
5//!
6//! - All machine output is **`cml:Proposed`** (never `cml:Attested`).
7//! - Structure + signal extraction is **deterministic** (no Python, no Ollama required).
8//! - Deontic cues compile into real `NQuin` norms (`OP_OBLIGATE` / `OP_PERMIT` / `OP_FORBID`).
9//! - Privacy / GDPR-family / rights / temporal / cross-ref signals become topics + graph edges.
10//! - **COF** (`cof_html`) serialises the same graph as **HTML+RDFa** for agent windows, with
11//!   **token-bounded segments** (index + body packs) when a document is large.
12//!
13//! Optional local LLM enrichment can attach later on the same `ContextUnit` surface; the
14//! product path stays pure Rust.
15
16mod cof_html;
17mod extract;
18mod graph;
19
20pub use cof_html::{
21    build_cof_package, pack_units_into_segments, render_cof_document, render_unit_fragment,
22    CofPackage, CofSegment, CofStyle, COF_PROFILE, DEFAULT_SEGMENT_MAX_CHARS, MEDIA_TYPE_COF,
23};
24pub use extract::{
25    classify_deontic, extract_cross_refs, extract_privacy_signals, extract_rights_signals,
26    extract_temporal_signals, DeonticClass, PrivacySignal, SignalHit,
27};
28pub use graph::{
29    build_document_context, build_unit_context, units_from_headings, units_from_paragraphs,
30    CmlConcept, CmlContextGraph, ContextUnit,
31};