opencdd · Ruby · IEC CDD
A Ruby model for the IEC Common Data Dictionary.
Read, write, validate, and navigate CDD content with first-class powertype semantics. Loads Parcel Excel workbooks, walks the four-layer ontology, and emits YAML, JSON, CDDAL, or Parcel. Built on the IEC CDD ontology — IRDIs, classes, properties, value lists, units, and relations.
What is opencdd?
Model
Frozen value objects for every CDD entity type — classes, properties, value lists, value terms, units, relations, view controls. One in-memory Database store.
Read & write
Three Parcel layouts (workbook, flat dir, sharded) plus.xlsBIFF. YAML persistence via lutaml-model. CDDAL plain-text canonical format.
Validate
14 rule classes (R01–R14) cover IRDI format, hierarchy acyclicity, type-specific shape, reference integrity. Composite runner returns structured errors.
Five-minute example
Load a Parcel workbook, walk its class hierarchy, list the effective properties (including inherited) of any class.
require "opencdd"
db = Opencdd::Database.load("my_dict.xlsx")
root = db.classes.find { |c| c.superclass_irdi.nil? }
puts "Root: #{root.preferred_name} (#{root.code})"
# Walk effective properties (declared + inherited)
db.effective_properties.properties_of(root).each do |prop|
puts " - #{prop.code}: #{prop.preferred_name}"
end
# Emit YAML / JSON / CDDAL
db.save_to_directory("./dict-yaml/")
File.write("dict.json", Opencdd::Exporters::Json.new.to_json(db))Install
gem "opencdd", "~> 0.3"Or gem install opencdd. Requires Ruby ≥ 3.1. Released under the MIT license.