Expand description
Rust-native CML context graph + COF HTML+RDFa for the hypermedia Library.
Goal: every ingested document (legislation, notes, policies, contracts) gets a TEXT → CONCEPT → LOGIC layer that is honest about provenance:
- All machine output is
cml:Proposed(nevercml:Attested). - Structure + signal extraction is deterministic (no Python, no Ollama required).
- Deontic cues compile into real
NQuinnorms (OP_OBLIGATE/OP_PERMIT/OP_FORBID). - Privacy / GDPR-family / rights / temporal / cross-ref signals become topics + graph edges.
- COF (
cof_html) serialises the same graph as HTML+RDFa for agent windows, with token-bounded segments (index + body packs) when a document is large.
Optional local LLM enrichment can attach later on the same ContextUnit surface; the
product path stays pure Rust.
Structs§
- CmlConcept
- A proposed concept in the CML layer.
- CmlContext
Graph - Full context graph for a document or provision.
- CofPackage
- A complete COF package: index + ordered body segments.
- CofSegment
- One COF HTML segment (self-contained HTML document, RDFa-complete).
- Context
Unit - One structural unit (section, heading block, or paragraph cluster).
- Signal
Hit - A named signal hit (privacy family, rights, etc.).
Enums§
- CofStyle
- Deontic
Class - Proposed deontic class for a provision / paragraph.
- Privacy
Signal - Privacy / data-protection family (GDPR-like and cognates).
Constants§
- COF_
PROFILE - Official COF HTML+RDFa profile (must match
cof.n3/ legis2cml). - DEFAULT_
SEGMENT_ MAX_ CHARS - Default agent body-segment budget (~6–8k tokens at ~4 chars/token; leave headroom).
- MEDIA_
TYPE_ COF
Functions§
- build_
cof_ package - Build a full COF package (index + body segments) for agent token optimisation.
- build_
document_ context - Build a multi-unit CML context graph for a document.
- build_
unit_ context - Build CML context for a single unit (provision or paragraph).
- classify_
deontic - Classify deontic force from English legislative / policy phrasing.
- extract_
cross_ refs - Cross-references to other provisions / instruments.
- extract_
privacy_ signals - Extract GDPR-like / privacy-family signals.
- extract_
rights_ signals - Human-rights / civil-rights cues (broader than privacy).
- extract_
temporal_ signals - Temporal / LTL-ish cues (commencement, deadlines).
- pack_
units_ into_ segments - Pack units into COF segments under a character budget (section-aligned).
- render_
cof_ document - Single-document COF (no multi-segment) — still valid html-rdfa-1.
- render_
unit_ fragment - Render one unit as a COF section fragment (no document chrome).
- units_
from_ headings - Split plain text into heading-aware units (Markdown
#/ ALL-CAPS lines / blank-line blocks). - units_
from_ paragraphs - Fallback: split on blank lines into paragraph units (max 64).