Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions TODO.final/19-condition-grammar-and-lutaml-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
**From:** cdd-data session 2026-07-23
**User decisions:** All 3 lutaml decisions resolved; condition grammar Option 2 approved.

## Status (2026-07-24)

| Item | Status | Where |
|------|--------|-------|
| **Item 1** — Condition grammar (ClassReference subclass) | ✅ **SHIPPED** | commit `bae0c56` on `main`, merged via PR [#17](https://github.com/opencdd/opencdd-ruby/pull/17). Released in gem v0.3.1. |
| **Item 2** — lutaml-model migration | 📋 **PLAN-ONLY** | [`19b-lutaml-model-migration.md`](19b-lutaml-model-migration.md) — Phases 2.1 & 2.2 already shipped via TODO.impl/33–35; Phases 2.3, 2.4, 2.5 remain. |

TS team: `Opencdd::Condition::ClassReference` is real API on `main`,
not a proposal. See `lib/opencdd/condition.rb:141`. The `lutaml-model`
work is the only outstanding piece.

## Item 1: Condition Grammar — ClassReference subclass (TODO 18)

### Problem
Expand Down
1 change: 1 addition & 0 deletions bin/lint-no-raw-mdc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# lint-no-raw-mdc — fail if any raw MDC_P### / MDC_C### / EXT_P### /
# EXT_C### / CIM_P### string literal appears in lib/opencdd/ outside
# the designated SSOT files.
Expand Down
54 changes: 5 additions & 49 deletions lib/opencdd/entity/name_synthesizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,12 @@ class Entity
# Extracted from SheetSchema so SheetSchema focuses on header
# parsing + Column construction. Name synthesis is a separate
# concern with its own test surface.
#
# The name→ID table itself lives in Opencdd::PropertyIds::IEC_COLUMN_NAMES
# (the lint-exempt SSOT). NAME_TO_PROPERTY_ID is kept here as a
# back-compat alias so existing callers see no public-API change.
module NameSynthesizer
# IEC 62656-1 defined column names mapped to canonical
# property IDs. These names appear in the #PROPERTY_NAME
# directive row when #PROPERTY_ID is absent.
NAME_TO_PROPERTY_ID = {
"Code" => "MDC_P001_5",
"Version" => "MDC_P002_1",
"Revision" => "MDC_P002_2",
"VersionInitiationDate" => "MDC_P003_1",
"VersionReleaseDate" => "MDC_P003_2",
"RevisionReleaseDate" => "MDC_P003_3",
"PreferredName" => "MDC_P004",
"SynonymousName" => "MDC_P007",
"ShortName" => "MDC_P005",
"Definition" => "MDC_P006",
"DefinitionSource" => "MDC_P006_1",
"Note" => "MDC_P008",
"Remark" => "MDC_P009",
"Drawing" => "MDC_P008_1",
"GUID" => "MDC_P066",
"TimeStamp" => "MDC_P067",
"ClassType" => "MDC_P011",
"Superclass" => "MDC_P010",
"IsCaseOf" => "MDC_P013",
"ApplicableProperties" => "MDC_P014",
"ImportedProperties" => "MDC_P090",
"SubClassSelection" => "MDC_P016",
"DataType" => "MDC_P022",
"ValueFormat" => "MDC_P024",
"DefinitionClass" => "MDC_P021",
"Unit" => "MDC_P041",
"Condition" => "MDC_P028",
"ListType" => "MDC_P046",
"CodeList" => "MDC_P044",
"TermList" => "MDC_P043",
"EnumerationCode" => "MDC_P044",
"RelationType" => "MDC_P200",
"RelationDomain" => "MDC_P201",
"FunctionDomain" => "MDC_P202",
"FunctionCodomain" => "MDC_P203",
"Formula" => "MDC_P204",
"FormulaLanguage" => "MDC_P205",
"FormulaExternalSolver" => "MDC_P206",
"TriggerEvent" => "MDC_P207",
"DomainElementType" => "MDC_P208",
"CodomainElementType" => "MDC_P209",
"Role" => "MDC_P210",
"Segment" => "MDC_P211",
"SuperRelation" => "MDC_P212",
}.freeze
NAME_TO_PROPERTY_ID = Opencdd::PropertyIds::IEC_COLUMN_NAMES

# Given a PROPERTY_NAME directive row (Array of name strings),
# returns a parallel Array of property IDs (or nil where the
Expand Down
52 changes: 52 additions & 0 deletions lib/opencdd/property_ids.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,58 @@ module PropertyIds
# ontology registry). Kept here as an alias for back-compat.
PARCEL_VARIANT_TO_CANONICAL = Opencdd::Parcel::SheetSchema::VARIANT_TO_CANONICAL

# IEC 62656-1 defined PROPERTY_NAME directive column names mapped
# to canonical property IDs. Used by Opencdd::Entity::NameSynthesizer
# when a Parcel sheet omits the #PROPERTY_ID directive row and
# only carries #PROPERTY_NAME. Declared here so the raw IDs live
# in the lint-exempt SSOT instead of in the synthesis module.
IEC_COLUMN_NAMES = {
"Code" => "MDC_P001_5",
"Version" => "MDC_P002_1",
"Revision" => "MDC_P002_2",
"VersionInitiationDate" => "MDC_P003_1",
"VersionReleaseDate" => "MDC_P003_2",
"RevisionReleaseDate" => "MDC_P003_3",
"PreferredName" => "MDC_P004",
"SynonymousName" => "MDC_P007",
"ShortName" => "MDC_P005",
"Definition" => "MDC_P006",
"DefinitionSource" => "MDC_P006_1",
"Note" => "MDC_P008",
"Remark" => "MDC_P009",
"Drawing" => "MDC_P008_1",
"GUID" => "MDC_P066",
"TimeStamp" => "MDC_P067",
"ClassType" => "MDC_P011",
"Superclass" => "MDC_P010",
"IsCaseOf" => "MDC_P013",
"ApplicableProperties" => "MDC_P014",
"ImportedProperties" => "MDC_P090",
"SubClassSelection" => "MDC_P016",
"DataType" => "MDC_P022",
"ValueFormat" => "MDC_P024",
"DefinitionClass" => "MDC_P021",
"Unit" => "MDC_P041",
"Condition" => "MDC_P028",
"ListType" => "MDC_P046",
"CodeList" => "MDC_P044",
"TermList" => "MDC_P043",
"EnumerationCode" => "MDC_P044",
"RelationType" => "MDC_P200",
"RelationDomain" => "MDC_P201",
"FunctionDomain" => "MDC_P202",
"FunctionCodomain" => "MDC_P203",
"Formula" => "MDC_P204",
"FormulaLanguage" => "MDC_P205",
"FormulaExternalSolver" => "MDC_P206",
"TriggerEvent" => "MDC_P207",
"DomainElementType" => "MDC_P208",
"CodomainElementType" => "MDC_P209",
"Role" => "MDC_P210",
"Segment" => "MDC_P211",
"SuperRelation" => "MDC_P212",
}.freeze

REGISTRY.each_key do |id|
const_set(id, id.freeze) unless const_defined?(id, false)
end
Expand Down
Loading