Commit f8e9d48
committed
feat(ar_shape): OGIT canonical vocabulary + per-extractor codebooks (Rails + Odoo) fold curator vocab into ogit:includes/isMemberOf/contains/isPartOf
Operator clarification 2026-06-19: "if we have one canonical, it just
needs a codebook for import. and OGAR can use canonical."
OGIT TTL at /home/user/OGIT/SGO/sgo/verbs/{includes,isMemberOf,contains,
isPartOf}.ttl defines the canonical relation predicate vocabulary. Each
is owl:ObjectProperty subPropertyOf ogit:Verb. The workspace already
calls lance-graph-ontology "the OGIT-canonical ontology spine" (per
.claude/knowledge/ontology-registry.md). OGAR is the compiler that
USES OGIT canonical predicates; the IRIs stay ogit:-prefixed.
What landed:
1. New pub mod ogit_relations with the 4 canonical relation IRIs:
- ogit:includes (one-to-many parent → children; has_many, One2many)
- ogit:isMemberOf (many-to-one child → parent; belongs_to, Many2one)
- ogit:contains (composition; habtm, Many2many from composing side)
- ogit:isPartOf (inverse of contains)
Plus is_relation_predicate() direction-blind check.
2. translate_rails_to_ogit(triples) — joins declares_association +
association_kind and emits the directional OGIT predicate:
| Rails kind | OGIT predicate |
|---------------------------|--------------------|
| belongs_to | ogit:isMemberOf |
| has_many | has_one | ogit:includes |
| has_and_belongs_to_many | ogit:contains |
Missing kind triple defaults to belongs_to (conservative).
3. translate_odoo_to_ogit(triples, ns) — maps target → ogit:isMemberOf
(the Many2one-dominant default for today's Odoo extractor which
doesn't surface field_kind). Subject rewritten from <class>.<field>
→ <class>; object underscored to match workspace IRI convention
(account.tax → odoo:account_tax). Future Odoo-extractor extension
emitting field_kind sibling triple → dispatch to includes/contains.
4. classes_matching_commercial_line_item_shape_canonical — single
detector walks ogit_relations canonical predicates direction-blind.
Replaces the per-vocabulary dispatch with one canonical pass.
5. 4 new tests, all green:
- ogit_relation_predicates_have_stable_canonical_iris
- rails_codebook_translates_has_many_to_includes_and_belongs_to_to_is_member_of
- odoo_codebook_translates_target_to_is_member_of_with_underscored_comodel
- ogit_canonical_detector_finds_line_item_classes_on_both_corpora
(loads OSB fixture + workspace Odoo; codebook-translates both;
asserts InvoiceLineItem and account_move_line both surface via
the canonical detector)
Plus all 10 prior tests still green → 14/14 total.
What this collapses:
- E-OGAR-AR-SHAPE-SMOKE-2 finding "two extractor predicate
vocabularies" → SOLVED. Each extractor stays free to emit its
native shape; OGAR consumes OGIT canonical after a per-extractor
codebook pass.
- Doctrine §2 correction 4 "the ontology shapes everything
agnostically through the contract" → contract carries
OGIT-canonical Triples; ontology holds the codebook; consumers
don't know which extractor produced what.
- §11.1 Inc 4 (curator promotion probe) → F4 is now falsifiable
today on the existing corpus pair via the codebook layer; the
upstream-alignment path (E-AR-PROJECTION-CORRECTION-1 Phase 1
Option A) can ship later, moving the codebook one layer up
without changing OGAR's consumer surface.
Adding a new extractor (Spree, future SAP) means adding ONE codebook
function; the detector stays unchanged.
OGIT vs OGAR (operator-confirmed): OGIT = canonical predicate
vocabulary source (TTL prefix ogit:, http://www.purl.org/ogit/).
OGAR = the compiler/Core that consumes OGIT canonical (per
docs/OGAR_AR_SHAPE_ENDGAME.md). No ogar: predicate prefix; the
pub mod ogit_relations is correctly named.
EPIPHANIES E-OGAR-AR-SHAPE-SMOKE-3 prepended.
Cross-refs:
- OGIT/SGO/sgo/verbs/{includes,isMemberOf,contains,isPartOf}.ttl
(canonical predicate definitions)
- crates/lance-graph-ontology/src/ar_shape.rs (codebooks + canonical
detector + 4 new tests; 14/14 green)
- E-OGAR-AR-SHAPE-SMOKE-2 (the predicate-vocab divergence this closes)
- E-OGAR-AR-SHAPE-SMOKE-1 (hand-fixture predecessor)
- .claude/knowledge/ontology-registry.md (OGIT-canonical spine framing)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx1 parent 93074fa commit f8e9d48
2 files changed
Lines changed: 353 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
305 | 331 | | |
306 | 332 | | |
307 | 333 | | |
| |||
0 commit comments