Module: Lutaml::Xmi::Parsers::XmiBase

Includes:
XmiClassMembers, XmiConnector
Included in:
Xml, XmiLookupService
Defined in:
lib/lutaml/xmi/parsers/xmi_base.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from XmiClassMembers

#cardinality_min_max_value, #fetch_element, #get_ns_by_xmi_id, #loopup_assoc_def

Methods included from XmiConnector

#build_connector_lookup, #connector_labels, #connector_lookup, #connector_name_by_source_or_target, #connector_node_by_id, #connector_source_name, #extract_attribute_name, #extract_cardinality, #fetch_assoc_connector, #fetch_connector, #fetch_connector_name, #fetch_definition_node_value, #fetch_owned_attribute_node, #generalization_association, #index_connector_directions, #member_end_name, #serialize_member_end, #serialize_member_type, #serialize_owned_type

Class Method Details

.included(base) ⇒ Object



15
16
17
# File 'lib/lutaml/xmi/parsers/xmi_base.rb', line 15

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#set_xmi_model(xmi_model, id_name_mapping = nil) ⇒ Hash

Parameters:

  • xmi_model (Lutaml::Model::Serializable)
  • id_name_mapping (Hash) (defaults to: nil)

Returns:

  • (Hash)


32
33
34
35
36
37
38
39
# File 'lib/lutaml/xmi/parsers/xmi_base.rb', line 32

def set_xmi_model(xmi_model, id_name_mapping = nil)
  @xmi_root_model ||= xmi_model

  if @xmi_index.nil?
    @xmi_index = @xmi_root_model.index
    @id_name_mapping = id_name_mapping || @xmi_index.id_name_map
  end
end

#xmi_indexObject

Access the index, auto-initializing from @xmi_root_model if needed



42
43
44
45
46
47
48
# File 'lib/lutaml/xmi/parsers/xmi_base.rb', line 42

def xmi_index
  if @xmi_index.nil? && @xmi_root_model
    @xmi_index = @xmi_root_model.index
    @id_name_mapping ||= @xmi_index.id_name_map
  end
  @xmi_index
end