ADR-0019: Optional ontology compilation into the EF model¶
Status: specified compiler and Organization sample scope verified in green hosted run 38111298123, including 100 tooling tests, six Organization live cases and both Linux regeneration checks. Independent M5 initialization hardening is tracked in ADR-0018.
The runtime provider remains one non-relational EF package. GraphBridge.Tooling and the GraphBridge.Tool executable are optional authoring tools. Neither the provider nor the generated application references RDF, YAML or Roslyn packages.
The compiler accepts a bounded Turtle vocabulary and a strict versioned YAML persistence policy. Named OWL classes and object/datatype properties are inspected explicitly. No imports are fetched and no OWL/RDFS closure is computed. Domain/range do not imply requiredness. The policy supplies application keys, storage identifiers, scalar conversions, relationship roles/direction and deletion. Unsupported constructs produce diagnostics instead of invented mappings. Identified relationship payloads and parallel identities are explicit persistence extensions to RDF triple-set semantics.
The emitter accepts immutable typed definitions, escapes C# identifiers/literals and rejects ambiguous normalized names. It produces four deterministic files: entities, context, EF configuration and IRI constants. Date-only values use an explicit invariant yyyy-MM-dd string converter; this does not imply native temporal support or preserve every RDF date lexical form. Guid properties select the provider's existing canonical string mapping. Endpoint foreign keys are EF identity references, not additional edge payload properties.
The artifact pipeline compiles only source produced by this emitter, constructs its generated DbContext with a driver proxy that rejects all transport, and derives the canonical storage manifest from the actual finalized EF model. It never manufactures a runtime manifest directly from ontology metadata. The provenance hash includes normalized input text and remains outside the storage fingerprint. Application partial model customizations are excluded from the tool's compilation and can change the application's actual model and fingerprint.
Schema output is a proposal against an explicitly declared target version/edition and empty schema observation. It does not prove live capabilities or deploy DDL. Community and Enterprise proposals use the existing schema comparer; Enterprise execution is unverified. Graph Types/SET output is omitted. Custom converters remain subject to the manifest's documented caveats.
SHACL is a separate command using the actual dotNetRDF engine after strict shape preflight. The supported subset has class targets, direct property paths, cardinality, datatype/class and node-kind constraints. Unsupported shapes are rejected. A report distinguishes failure to validate from an executed nonconforming result. No SHACL constraint silently becomes EF or database enforcement.
Output publication validates the complete generated set first, stages sibling files and refuses unrelated, linked or manually modified output. A hash marker identifies owned artifacts. Caught replacement failures attempt to restore the old directory. This is not crash-atomic: process termination between the two directory moves can leave the old set in a .graphbridge-backup-* sibling, which must be recovered after inspection. Concurrent publication to the same destination is unsupported. --check compares bytes without writing. Generated artifacts use LF on Windows and Linux for checkout-stable hashes.
Exact optional dependencies: dotNetRdf.Core/Shacl 3.5.2, YamlDotNet 18.1.0, Microsoft.CodeAnalysis.CSharp 5.9.0 and AngleSharp 1.5.0. These use MIT licenses. The initial restore rejected RDF's vulnerable transitive AngleSharp 1.4.0 minimum; explicitly pinning patched 1.5.0 fixed the audit without suppressing it. Sources: dotNetRDF v3.5.2, YamlDotNet v18.1.0, Roslyn 5.9.0 package, AngleSharp advisory.
Initial local acceptance: serial solution build has zero warnings/errors; 100 tooling tests pass. Coverage includes actual SHACL conforming/nonconforming results, parser/shape failures, actual generated compilation with keyword/encoded identifiers, generated/manual finalized-model storage parity, deterministic bytes, CLI checks, regeneration and preservation of unrelated/manual files. Independent source review corrected absolute-IRI resolution priority, pre-hash input limits, conflicting SHACL shape kinds and diagnostic severity ordering. Hosted run 38111298123 subsequently passes all six Organization migration/round-trip cases and both Linux regeneration checks within the combined 134-case integration suite, closing the specified GB-013 subset.