Commit d4589aa
committed
feat(lance-graph-ontology): PR-bO-15 SchematronHydrator + ZUGFeRD rules
Second Tier-C hydrator. Schematron (ISO/IEC 19757-3) is the rule-
language layer that sits on top of XSD across every major e-business
standard — EN 16931, PEPPOL, XRechnung, ZUGFeRD, UBL, ISO 20022 all
ship structural XSD + behavioral .sch business rules. This hydrator
generalizes the rule-extraction shape so each future spec only needs
glue, not new hydrator code.
New SchematronHydrator (minimal name-extraction shape):
- crates/lance-graph-ontology/src/hydrators/schematron.rs
- Walks `<assert id="..." test="..." flag="...">` and
`<report id="...">` and `<pattern id="...">` elements via quick-xml
streaming, interns each as `{base_iri}/{element}/{id}`
- Additionally scans text bodies for bracketed business-rule IDs
like [BR-52], [BR-CO-03], [BR-DE-1], [PEPPOL-EN16931-R008] —
these are the canonical EN16931 / PEPPOL / DE / VAT-category rule
identifiers used by cross-spec alignment. Each distinct ID interns
as `{base_iri}/rule/{rule-id}`.
- Strict business-rule ID validator (uppercase-only, dash-segmented,
no leading digit / double dash / trailing dash) keeps the rule
namespace clean of false positives from message text.
- 3 unit tests verify the validator + end-to-end interning on a tiny
in-memory .sch fixture.
bO-15 ZUGFeRD rules (OGIT::ZUGFERDRULES_V1, slot 31):
- hydrate_zugferd_rules() points the SchematronHydrator at the
FACTUR-X_EN16931.sch file that already shipped with bO-16.
- Base IRI urn:schematron:factur-x-1.08-en16931 — stable URN for
downstream alignment to PEPPOL / EN16931 / FeRD rule registries.
- inherits_from: Some(OGIT::ZUGFERD_V1.0) — rule namespace is
meaningless without the structural CII namespace.
- 5 smoke tests verify the EN16931 anchor rules (BR-52 / BR-45 /
BR-CO-03 / BR-CO-17 / BR-S-08 / BR-Z-08 / BR-DEC-19), PEPPOL
extension (PEPPOL-EN16931-R008), schema-level FX-SCH-A-* IDs that
KoSIT validator output references directly, and rule-family
coverage (BR-CO / BR-DEC / BR-S / BR-Z / PEPPOL).
- ~510 IRIs hydrated: 301 distinct schema assert IDs (428 elements
collapse to 301 — some IDs are reused across patterns) + ~209
distinct bracketed business-rule IDs.
Inspection findings documented in tests + LICENSES/ZUGFERD.txt:
- 191 <report> elements present but NONE have @id (Schematron-1
style; text bodies still contribute business-rule IRIs).
- 0 patterns / 0 phases with @id.
Side fix: factored out the XsdHydrator interning-closure type alias
to clear a clippy type_complexity warning. Now 5 clippy warnings,
all pre-existing oxrdf deprecations.
All 106 lance-graph-ontology tests pass; downstream consumers build
clean.1 parent 9e65307 commit d4589aa
9 files changed
Lines changed: 646 additions & 8 deletions
File tree
- LICENSES
- crates
- lance-graph-contract
- lance-graph-ontology
- src
- hydrators
- tests
- modules/zugferd-rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments