lutaml 0.9.27 → 0.9.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +36 -35
  3. data/bin/plantuml2lutaml +11 -7
  4. data/bin/yaml2lutaml +1 -1
  5. data/exe/lutaml-sysml +4 -2
  6. data/exe/lutaml-wsd2uml +11 -7
  7. data/exe/lutaml-yaml2uml +1 -1
  8. data/lib/lutaml/express/parsers/exp.rb +4 -4
  9. data/lib/lutaml/formatter/graphviz.rb +7 -7
  10. data/lib/lutaml/parser.rb +3 -31
  11. data/lib/lutaml/sysml/allocate.rb +6 -7
  12. data/lib/lutaml/sysml/allocated.rb +6 -6
  13. data/lib/lutaml/sysml/binding_connector.rb +6 -6
  14. data/lib/lutaml/sysml/block.rb +28 -25
  15. data/lib/lutaml/sysml/constraint_block.rb +11 -11
  16. data/lib/lutaml/sysml/copy.rb +5 -5
  17. data/lib/lutaml/sysml/derive_requirement.rb +6 -6
  18. data/lib/lutaml/sysml/nested_connector_end.rb +9 -9
  19. data/lib/lutaml/sysml/refine.rb +6 -6
  20. data/lib/lutaml/sysml/requirement_related.rb +6 -6
  21. data/lib/lutaml/sysml/satisfy.rb +6 -6
  22. data/lib/lutaml/sysml/test_case.rb +20 -19
  23. data/lib/lutaml/sysml/trace.rb +6 -6
  24. data/lib/lutaml/sysml/verify.rb +5 -5
  25. data/lib/lutaml/sysml/version.rb +1 -1
  26. data/lib/lutaml/sysml/xmi_file.rb +455 -415
  27. data/lib/lutaml/sysml.rb +1 -1
  28. data/lib/lutaml/uml/association.rb +4 -3
  29. data/lib/lutaml/uml/data_type.rb +1 -0
  30. data/lib/lutaml/uml/document.rb +4 -1
  31. data/lib/lutaml/uml/formatter/graphviz.rb +11 -13
  32. data/lib/lutaml/uml/has_attributes.rb +2 -2
  33. data/lib/lutaml/uml/has_members.rb +4 -3
  34. data/lib/lutaml/uml/node/class_node.rb +5 -7
  35. data/lib/lutaml/uml/node/field.rb +1 -3
  36. data/lib/lutaml/uml/node/method.rb +1 -3
  37. data/lib/lutaml/uml/node/relationship.rb +1 -3
  38. data/lib/lutaml/uml/operation.rb +6 -6
  39. data/lib/lutaml/uml/package.rb +3 -1
  40. data/lib/lutaml/uml/parsers/attribute.rb +1 -3
  41. data/lib/lutaml/uml/parsers/dsl.rb +11 -10
  42. data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +7 -6
  43. data/lib/lutaml/uml/parsers/yaml.rb +2 -2
  44. data/lib/lutaml/uml/serializers/class.rb +1 -1
  45. data/lib/lutaml/uml/top_element.rb +9 -9
  46. data/lib/lutaml/uml/top_element_attribute.rb +6 -6
  47. data/lib/lutaml/uml/value.rb +6 -6
  48. data/lib/lutaml/version.rb +1 -1
  49. data/lib/lutaml/xmi/liquid_drops/association_drop.rb +31 -11
  50. data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +29 -11
  51. data/lib/lutaml/xmi/liquid_drops/cardinality_drop.rb +8 -2
  52. data/lib/lutaml/xmi/liquid_drops/constraint_drop.rb +6 -4
  53. data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +76 -18
  54. data/lib/lutaml/xmi/liquid_drops/diagram_drop.rb +13 -6
  55. data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +16 -7
  56. data/lib/lutaml/xmi/liquid_drops/enum_owned_literal_drop.rb +10 -4
  57. data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +2 -0
  58. data/lib/lutaml/xmi/liquid_drops/generalization_drop.rb +10 -3
  59. data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +98 -24
  60. data/lib/lutaml/xmi/liquid_drops/operation_drop.rb +11 -5
  61. data/lib/lutaml/xmi/liquid_drops/package_drop.rb +61 -18
  62. data/lib/lutaml/xmi/liquid_drops/root_drop.rb +14 -4
  63. data/lib/lutaml/xmi/parsers/xmi_base.rb +1031 -0
  64. data/lib/lutaml/xmi/parsers/xml.rb +23 -1018
  65. data/lib/lutaml/xml/parsers/xml.rb +6 -19
  66. data/lib/lutaml/xml.rb +0 -8
  67. data/lutaml.gemspec +2 -1
  68. metadata +32 -23
  69. data/lib/lutaml/express/lutaml_path/document_wrapper.rb +0 -22
  70. data/lib/lutaml/express/lutaml_path/formatter.rb +0 -14
  71. data/lib/lutaml/lutaml_path/document_wrapper.rb +0 -51
  72. data/lib/lutaml/uml/lutaml_path/document_wrapper.rb +0 -15
  73. data/lib/lutaml/xml/lutaml_path/document_wrapper.rb +0 -45
  74. data/lib/lutaml/xml/mapper.rb +0 -448
@@ -2,8 +2,9 @@ require "nokogiri"
2
2
  require "htmlentities"
3
3
  require "lutaml/uml/has_attributes"
4
4
  require "lutaml/uml/document"
5
-
6
- require "shale/schema"
5
+ require "lutaml/xsd"
6
+ require "lutaml/model"
7
+ require "lutaml/model/schema"
7
8
 
8
9
  module Lutaml
9
10
  module Xml
@@ -11,14 +12,12 @@ module Lutaml
11
12
  # Class for parsing .xml schema files into ::Lutaml::Uml::Document
12
13
  class Xml
13
14
  def self.load_schema(schema, root_schema)
14
- result = Shale::Schema.from_xml([schema])
15
+ result = Lutaml::Model::Schema.from_xml(schema)
15
16
 
16
- result.values.each do |klass|
17
- # Temporary solution will update in the parser
17
+ result.each_value do |klass|
18
18
  klass = klass.gsub(/^require.*?\n/, "")
19
- klass = klass.gsub(/< Shale::Mapper/, "< Lutaml::Xml::Mapper")
20
19
 
21
- eval(klass, TOPLEVEL_BINDING)
20
+ eval(klass, TOPLEVEL_BINDING) # rubocop:disable Security/Eval
22
21
  end
23
22
 
24
23
  @@root_schema = root_schema
@@ -39,18 +38,6 @@ module Lutaml
39
38
 
40
39
  @root_class.from_xml(doc)
41
40
  end
42
-
43
- private
44
-
45
- def load_schema(schema)
46
- result = Shale::Schema.from_xml([schema])
47
-
48
- result.values.each do |klass|
49
- klass = klass.gsub(/^require.*?\n/, "")
50
-
51
- eval(klass, TOPLEVEL_BINDING)
52
- end
53
- end
54
41
  end
55
42
  end
56
43
  end
data/lib/lutaml/xml.rb CHANGED
@@ -1,9 +1 @@
1
1
  require "lutaml/xml/parsers/xml"
2
-
3
- require "lutaml/xml/mapper"
4
- require "lutaml/xml/lutaml_path/document_wrapper"
5
-
6
- require "shale"
7
- require "shale/adapter/nokogiri"
8
-
9
- Shale.xml_adapter = Shale::Adapter::Nokogiri
data/lutaml.gemspec CHANGED
@@ -33,11 +33,12 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "hashie", "~> 4.1.0"
34
34
  spec.add_dependency "htmlentities"
35
35
  spec.add_dependency "liquid"
36
+ spec.add_dependency "lutaml-model"
36
37
  spec.add_dependency "lutaml-path"
38
+ spec.add_dependency "lutaml-xsd"
37
39
  spec.add_dependency "nokogiri", "~> 1.10"
38
40
  spec.add_dependency "parslet", "~> 2.0.0"
39
41
  spec.add_dependency "ruby-graphviz", "~> 1.2"
40
- spec.add_dependency "shale"
41
42
  spec.add_dependency "thor", "~> 1.0"
42
43
  spec.add_dependency "xmi", "~> 0.3.12"
43
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.27
4
+ version: 0.9.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-24 00:00:00.000000000 Z
11
+ date: 2025-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: lutaml-model
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: lutaml-path
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +94,20 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: lutaml-xsd
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: nokogiri
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +150,6 @@ dependencies:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
152
  version: '1.2'
125
- - !ruby/object:Gem::Dependency
126
- name: shale
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: thor
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -298,8 +312,6 @@ files:
298
312
  - lib/lutaml/command_line.rb
299
313
  - lib/lutaml/express.rb
300
314
  - lib/lutaml/express/README.adoc
301
- - lib/lutaml/express/lutaml_path/document_wrapper.rb
302
- - lib/lutaml/express/lutaml_path/formatter.rb
303
315
  - lib/lutaml/express/parsers/exp.rb
304
316
  - lib/lutaml/express/version.rb
305
317
  - lib/lutaml/formatter.rb
@@ -307,7 +319,6 @@ files:
307
319
  - lib/lutaml/formatter/graphviz.rb
308
320
  - lib/lutaml/layout/engine.rb
309
321
  - lib/lutaml/layout/graph_viz_engine.rb
310
- - lib/lutaml/lutaml_path/document_wrapper.rb
311
322
  - lib/lutaml/parser.rb
312
323
  - lib/lutaml/sysml.rb
313
324
  - lib/lutaml/sysml/README.md
@@ -353,7 +364,6 @@ files:
353
364
  - lib/lutaml/uml/has_attributes.rb
354
365
  - lib/lutaml/uml/has_members.rb
355
366
  - lib/lutaml/uml/instance.rb
356
- - lib/lutaml/uml/lutaml_path/document_wrapper.rb
357
367
  - lib/lutaml/uml/model.rb
358
368
  - lib/lutaml/uml/node/base.rb
359
369
  - lib/lutaml/uml/node/class_node.rb
@@ -410,11 +420,10 @@ files:
410
420
  - lib/lutaml/xmi/liquid_drops/operation_drop.rb
411
421
  - lib/lutaml/xmi/liquid_drops/package_drop.rb
412
422
  - lib/lutaml/xmi/liquid_drops/root_drop.rb
423
+ - lib/lutaml/xmi/parsers/xmi_base.rb
413
424
  - lib/lutaml/xmi/parsers/xml.rb
414
425
  - lib/lutaml/xmi/version.rb
415
426
  - lib/lutaml/xml.rb
416
- - lib/lutaml/xml/lutaml_path/document_wrapper.rb
417
- - lib/lutaml/xml/mapper.rb
418
427
  - lib/lutaml/xml/parsers/xml.rb
419
428
  - lutaml.gemspec
420
429
  homepage: https://github.com/lutaml/lutaml
@@ -440,7 +449,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
440
449
  - !ruby/object:Gem::Version
441
450
  version: '0'
442
451
  requirements: []
443
- rubygems_version: 3.3.27
452
+ rubygems_version: 3.5.22
444
453
  signing_key:
445
454
  specification_version: 4
446
455
  summary: 'LutaML: data models in textual form'
@@ -1,22 +0,0 @@
1
- require "lutaml/lutaml_path/document_wrapper"
2
- require "lutaml/express/lutaml_path/formatter"
3
-
4
- module Lutaml
5
- module Express
6
- module LutamlPath
7
- class DocumentWrapper < ::Lutaml::LutamlPath::DocumentWrapper
8
- attr_accessor :select_proc
9
-
10
- protected
11
-
12
- def serialize_document(repository)
13
- repository.to_hash(
14
- formatter: Formatter,
15
- include_empty: true,
16
- select_proc: select_proc,
17
- )
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,14 +0,0 @@
1
- require "expressir/express/formatter"
2
- require "expressir/express/schema_head_formatter"
3
- require "expressir/express/hyperlink_formatter"
4
-
5
- module Lutaml
6
- module Express
7
- module LutamlPath
8
- class Formatter < Expressir::Express::Formatter
9
- include Expressir::Express::SchemaHeadFormatter
10
- include Expressir::Express::HyperlinkFormatter
11
- end
12
- end
13
- end
14
- end
@@ -1,51 +0,0 @@
1
- module Lutaml
2
- module LutamlPath
3
- class DocumentWrapper
4
- attr_reader :serialized_document, :original_document
5
-
6
- def initialize(document)
7
- @original_document = document
8
- end
9
-
10
- def to_liquid
11
- serialized_document
12
- end
13
-
14
- def serialized_document
15
- @serialized_document ||= serialize_document(@original_document)
16
- end
17
-
18
- protected
19
-
20
- def serialize_document(_path)
21
- raise ArgumentError, "implement #serialize_document!"
22
- end
23
-
24
- def serialize_value(attr_value)
25
- if attr_value.is_a?(Array)
26
- return attr_value.map(&method(:serialize_to_hash))
27
- end
28
-
29
- serialize_to_hash(attr_value)
30
- end
31
-
32
- BASE_OBJECTS = [String, Integer, Float, FalseClass, TrueClass, Symbol, NilClass, Hash]
33
- def serialize_to_hash(object)
34
- return object if BASE_OBJECTS.include?(object.class)
35
-
36
- object.instance_variables.each_with_object({}) do |var, res|
37
- variable = object.instance_variable_get(var)
38
- res[var.to_s.gsub("@", "")] = if variable.is_a?(Array)
39
- variable.map do |n|
40
- serialize_to_hash(n)
41
- end
42
- elsif BASE_OBJECTS.include?(variable.class) || var == :@parent
43
- variable
44
- else
45
- serialize_to_hash(variable)
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,15 +0,0 @@
1
- require "lutaml/lutaml_path/document_wrapper"
2
-
3
- module Lutaml
4
- module Uml
5
- module LutamlPath
6
- class DocumentWrapper < ::Lutaml::LutamlPath::DocumentWrapper
7
- protected
8
-
9
- def serialize_document(document)
10
- serialize_to_hash(document)
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,45 +0,0 @@
1
- require "lutaml/lutaml_path/document_wrapper"
2
-
3
- module Lutaml
4
- module Xml
5
- module LutamlPath
6
- class DocumentWrapper < ::Lutaml::LutamlPath::DocumentWrapper
7
- protected
8
-
9
- def serialize_document(document)
10
- serialize_to_hash(document)
11
- end
12
-
13
- def serialize_to_hash(object)
14
- hash = {}
15
- attribute_name = nil
16
-
17
- object.all_content.each do |mapping, content|
18
- if mapping == "content"
19
- attribute_name = object.class.xml_mapping.content.attribute.to_s
20
- hash[attribute_name] ||= []
21
- hash[attribute_name] << content.strip unless content.strip&.empty?
22
- elsif content.is_a?(String)
23
- if object.class.attributes[mapping.attribute].collection?
24
- hash[mapping.name] ||= []
25
- hash[mapping.name] << content.strip
26
- else
27
- hash[mapping.name] = content.strip
28
- end
29
- else
30
- if object.class.attributes[mapping.attribute].collection?
31
- hash[mapping.name] ||= []
32
- hash[mapping.name] << serialize_to_hash(content)
33
- else
34
- hash[mapping.name] = serialize_to_hash(content)
35
- end
36
- end
37
- end
38
-
39
- hash[attribute_name] = hash[attribute_name].compact if attribute_name
40
- hash
41
- end
42
- end
43
- end
44
- end
45
- end