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.



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

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



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

def xml
  @xml
end

Class Method Details

.from_path(path) ⇒ Object



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

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

.from_xml(xml) ⇒ Object



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

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

Instance Method Details

#documentObject



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

def document
  @document ||= build_document
end