Class: Ea::Mdg::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/mdg/loader.rb

Overview

Parses an MDG technology file into an Mdg::Document.

Supports two EA MDG file formats:

1. **MDG.Technology format** (root: `<MDG.Technology>`) —
 Parsed via lutaml-model XML mapping (Ea::Mdg::Xml::*).
 Carries UMLProfile elements with Stereotype definitions
 and their tagged-value specs. Example: CityGML MDG.

2. **XMI format** (root: `<XMI>`) — Delegates to the xmi
 gem's typed Sparx model for UML class/attribute/generalization
 extraction. Carries reference model classes. Example: ISO 19103.

The format is auto-detected from the root element. Both contribute to the same Document; stereotypes and classifiers coexist without coupling.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Loader

Returns a new instance of Loader.



25
26
27
# File 'lib/ea/mdg/loader.rb', line 25

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



23
24
25
# File 'lib/ea/mdg/loader.rb', line 23

def xml
  @xml
end

Class Method Details

.from_path(path) ⇒ Object



29
30
31
# File 'lib/ea/mdg/loader.rb', line 29

def self.from_path(path)
  new(File.read(path))
end

.from_xml(xml) ⇒ Object



33
34
35
# File 'lib/ea/mdg/loader.rb', line 33

def self.from_xml(xml)
  new(xml)
end

Instance Method Details

#documentObject



37
38
39
# File 'lib/ea/mdg/loader.rb', line 37

def document
  @document ||= build_document
end