lutaml 0.9.40 → 0.9.42

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +7 -1
  3. data/docs/lutaml-express.adoc +35 -0
  4. data/docs/lutaml-sysml.adoc +10 -0
  5. data/docs/lutaml-uml.adoc +111 -0
  6. data/docs/lutaml-xmi.adoc +33 -0
  7. data/exe/lutaml-yaml2uml +1 -1
  8. data/lib/lutaml/converter/xmi_to_uml.rb +440 -0
  9. data/lib/lutaml/express.rb +0 -1
  10. data/lib/lutaml/sysml/allocate.rb +1 -1
  11. data/lib/lutaml/sysml/allocated.rb +1 -1
  12. data/lib/lutaml/sysml/binding_connector.rb +1 -1
  13. data/lib/lutaml/sysml/block.rb +1 -1
  14. data/lib/lutaml/sysml/constraint_block.rb +1 -1
  15. data/lib/lutaml/sysml/copy.rb +1 -1
  16. data/lib/lutaml/sysml/derive_requirement.rb +1 -1
  17. data/lib/lutaml/sysml/nested_connector_end.rb +1 -1
  18. data/lib/lutaml/sysml/refine.rb +1 -1
  19. data/lib/lutaml/sysml/requirement_related.rb +1 -1
  20. data/lib/lutaml/sysml/satisfy.rb +1 -1
  21. data/lib/lutaml/sysml/test_case.rb +1 -1
  22. data/lib/lutaml/sysml/trace.rb +1 -1
  23. data/lib/lutaml/sysml/verify.rb +1 -1
  24. data/lib/lutaml/sysml/xmi_file.rb +1 -1
  25. data/lib/lutaml/sysml.rb +0 -1
  26. data/lib/lutaml/uml/association_generalization.rb +17 -0
  27. data/lib/lutaml/uml/class.rb +2 -3
  28. data/lib/lutaml/uml/classifier.rb +4 -2
  29. data/lib/lutaml/uml/diagram.rb +7 -0
  30. data/lib/lutaml/uml/general_attribute.rb +22 -0
  31. data/lib/lutaml/uml/generalization.rb +35 -0
  32. data/lib/lutaml/uml/top_element_attribute.rb +4 -0
  33. data/lib/lutaml/uml.rb +3 -0
  34. data/lib/lutaml/version.rb +1 -1
  35. data/lib/lutaml/xmi/parsers/xmi_base.rb +13 -1
  36. data/lib/lutaml/xmi/parsers/xml.rb +3 -4
  37. metadata +11 -10
  38. data/docs/UML_README.adoc +0 -44
  39. data/lib/lutaml/converter/xmi_hash_to_uml.rb +0 -196
  40. data/lib/lutaml/express/README.adoc +0 -55
  41. data/lib/lutaml/express/version.rb +0 -7
  42. data/lib/lutaml/sysml/README.md +0 -40
  43. data/lib/lutaml/sysml/version.rb +0 -5
  44. data/lib/lutaml/xmi/README.adoc +0 -24
  45. /data/{LUTAML.adoc → docs/lutaml_syntax.adoc} +0 -0
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class BindingConnector < Lutaml::Uml::Connector
4
4
  attr_accessor :base_connector
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Block < Lutaml::Uml::Class
4
4
  attr_accessor :base_class
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class ConstraintBlock < Block
4
4
  def initialize # rubocop:disable Lint/MissingSuper
5
5
  @xmi_id = nil
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Copy < Trace
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class DeriveRequirement < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class NestedConnectorEnd < Lutaml::Uml::ConnectorEnd
4
4
  attr_accessor :base_connectorend, :property_path
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Refine < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class RequirementRelated < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_named_element, :satisfies, :refines
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Satisfy < Trace
4
4
  attr_accessor :base_realization
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class TestCase < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_behavior, :verifies
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Trace < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Verify < Trace
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class XmiFile
4
4
  attr_accessor :package_list, :model_list, :class_list, :activity_list,
5
5
  :property_list, :port_list,
data/lib/lutaml/sysml.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "lutaml/sysml/version"
2
1
  require "lutaml/uml"
3
2
  require "nokogiri"
4
3
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class AssociationGeneralization < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :type, :string
8
+ attribute :general, :string
9
+
10
+ yaml do
11
+ map "id", to: :id
12
+ map "type", to: :type
13
+ map "general", to: :general
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "lutaml/uml/package"
4
3
  require "lutaml/uml/association"
5
4
  require "lutaml/uml/constraint"
6
5
  require "lutaml/uml/operation"
7
6
  require "lutaml/uml/data_type"
7
+ require "lutaml/uml/generalization"
8
8
 
9
9
  module Lutaml
10
10
  module Uml
@@ -13,7 +13,6 @@ module Lutaml
13
13
  default: -> { [] }
14
14
  attribute :is_abstract, :boolean, default: false
15
15
  attribute :type, :string
16
- attribute :package, Package
17
16
  attribute :attributes, TopElementAttribute, collection: true
18
17
  attribute :modifier, :string
19
18
  attribute :constraints, Constraint, collection: true
@@ -22,12 +21,12 @@ module Lutaml
22
21
  attribute :methods, :string, collection: true, default: -> { [] }
23
22
 
24
23
  attribute :associations, Association, collection: true
24
+ attribute :generalization, Generalization
25
25
 
26
26
  yaml do
27
27
  map "nested_classifier", to: :nested_classifier
28
28
  map "is_abstract", to: :is_abstract
29
29
  map "type", to: :type
30
- map "package", to: :package
31
30
  map "attributes", to: :attributes
32
31
  map "modifier", to: :modifier
33
32
  map "constraints", to: :constraints
@@ -3,10 +3,12 @@
3
3
  module Lutaml
4
4
  module Uml
5
5
  class Classifier < TopElement
6
- attribute :generalization, :string, collection: true, default: -> { [] }
6
+ attribute :association_generalization,
7
+ ::Lutaml::Uml::AssociationGeneralization,
8
+ collection: true, default: -> { [] }
7
9
 
8
10
  yaml do
9
- map "generalization", to: :generalization
11
+ map "generalization", to: :association_generalization
10
12
  end
11
13
  end
12
14
  end
@@ -3,6 +3,13 @@
3
3
  module Lutaml
4
4
  module Uml
5
5
  class Diagram < TopElement
6
+ attribute :package_id, :string
7
+ attribute :package_name, :string
8
+
9
+ yaml do
10
+ map "package_id", to: :package_id
11
+ map "package_name", to: :package_name
12
+ end
6
13
  end
7
14
  end
8
15
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class GeneralAttribute < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :name, :string
8
+ attribute :type, :string
9
+ attribute :xmi_id, :string
10
+ attribute :is_derived, :boolean, default: false
11
+ attribute :cardinality, Cardinality
12
+ attribute :definition, :string
13
+ attribute :association, :string
14
+ attribute :has_association, :boolean, default: false
15
+ attribute :type_ns, :string
16
+ attribute :name_ns, :string
17
+ attribute :gen_name, :string
18
+ attribute :upper_klass, :string
19
+ attribute :level, :integer
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class Generalization < Lutaml::Model::Serializable
6
+ attribute :general_id, :string
7
+ attribute :general_name, :string
8
+ attribute :general_attributes,
9
+ ::Lutaml::Uml::GeneralAttribute,
10
+ collection: true, default: -> { [] }
11
+ attribute :general_upper_klass, :string
12
+ attribute :has_general, :boolean, default: false
13
+ attribute :general, ::Lutaml::Uml::Generalization
14
+ attribute :name, :string
15
+ attribute :type, :string
16
+ attribute :definition, :string
17
+ attribute :stereotype, :string
18
+ attribute :attributes,
19
+ ::Lutaml::Uml::GeneralAttribute,
20
+ collection: true, default: -> { [] }
21
+ attribute :owned_props,
22
+ ::Lutaml::Uml::GeneralAttribute,
23
+ collection: true, default: -> { [] }
24
+ attribute :assoc_props,
25
+ ::Lutaml::Uml::GeneralAttribute,
26
+ collection: true, default: -> { [] }
27
+ attribute :inherited_props,
28
+ ::Lutaml::Uml::GeneralAttribute,
29
+ collection: true, default: -> { [] }
30
+ attribute :inherited_assoc_props,
31
+ ::Lutaml::Uml::GeneralAttribute,
32
+ collection: true, default: -> { [] }
33
+ end
34
+ end
35
+ end
@@ -15,6 +15,8 @@ module Lutaml
15
15
  attribute :is_derived, :boolean, default: false
16
16
 
17
17
  attribute :definition, :string
18
+ attribute :association, :string
19
+ attribute :type_ns, :string
18
20
 
19
21
  yaml do
20
22
  map "name", to: :name
@@ -31,6 +33,8 @@ module Lutaml
31
33
  map "definition", to: :definition, with: {
32
34
  to: :definition_to_yaml, from: :definition_from_yaml
33
35
  }
36
+ map "association", to: :association
37
+ map "type_ns", to: :type_ns
34
38
  end
35
39
 
36
40
  def definition_to_yaml(model, doc)
data/lib/lutaml/uml.rb CHANGED
@@ -10,6 +10,9 @@ require "lutaml/uml/fidelity"
10
10
  require "lutaml/uml/top_element"
11
11
  require "lutaml/uml/top_element_attribute"
12
12
  require "lutaml/uml/value"
13
+ require "lutaml/uml/association_generalization"
14
+ require "lutaml/uml/general_attribute"
15
+ require "lutaml/uml/generalization"
13
16
  require "lutaml/uml/action"
14
17
  require "lutaml/uml/classifier"
15
18
  require "lutaml/uml/dependency"
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.9.40".freeze
2
+ VERSION = "0.9.42".freeze
3
3
  end
@@ -151,7 +151,7 @@ module Lutaml
151
151
  # @param with_gen: [Boolean]
152
152
  # @param with_absolute_path: [Boolean]
153
153
  # @return [Hash]
154
- def build_klass_hash(klass, model, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
154
+ def build_klass_hash(klass, model, # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity
155
155
  with_gen: false, with_absolute_path: false, absolute_path: "")
156
156
  klass_hash = {
157
157
  xmi_id: klass.id,
@@ -173,6 +173,18 @@ module Lutaml
173
173
  klass_hash[:generalization] = serialize_generalization(klass)
174
174
  end
175
175
 
176
+ if klass.generalization && !klass.generalization.empty?
177
+ klass_hash[:association_generalization] = []
178
+ klass.generalization.each do |gen|
179
+ association_generalization_hash = {}
180
+ association_generalization_hash[:id] = gen.id
181
+ association_generalization_hash[:type] = gen.type
182
+ association_generalization_hash[:general] = gen.general
183
+ klass_hash[:association_generalization] <<
184
+ association_generalization_hash
185
+ end
186
+ end
187
+
176
188
  klass_hash
177
189
  end
178
190
 
@@ -4,14 +4,14 @@ require "lutaml/xmi"
4
4
  require "xmi"
5
5
  require "lutaml/xmi/parsers/xmi_base"
6
6
  require "lutaml/uml"
7
- require "lutaml/converter/xmi_hash_to_uml"
7
+ require "lutaml/converter/xmi_to_uml"
8
8
 
9
9
  module Lutaml
10
10
  module XMI
11
11
  module Parsers
12
12
  # Class for parsing .xmi schema files into ::Lutaml::Uml::Document
13
13
  class XML
14
- include Lutaml::Converter::XmiHashToUml
14
+ include Lutaml::Converter::XmiToUml
15
15
 
16
16
  @id_name_mapping_static = {}
17
17
  @xmi_root_model_cache_static = {}
@@ -99,8 +99,7 @@ module Lutaml
99
99
  # @return [Lutaml::Uml::Document]
100
100
  def parse(xmi_model)
101
101
  set_xmi_model(xmi_model)
102
- serialized_hash = serialize_xmi(xmi_model)
103
- create_uml_document(serialized_hash)
102
+ create_uml_document(xmi_model)
104
103
  end
105
104
 
106
105
  # @param xmi_model [Lutaml::Model::Serializable]
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.40
4
+ version: 0.9.42
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-08-21 00:00:00.000000000 Z
11
+ date: 2025-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir
@@ -197,7 +197,6 @@ files:
197
197
  - ".rubocop.yml"
198
198
  - CODE_OF_CONDUCT.md
199
199
  - Gemfile
200
- - LUTAML.adoc
201
200
  - Makefile
202
201
  - README.adoc
203
202
  - Rakefile
@@ -206,7 +205,11 @@ files:
206
205
  - bin/plantuml2lutaml
207
206
  - bin/setup
208
207
  - bin/yaml2lutaml
209
- - docs/UML_README.adoc
208
+ - docs/lutaml-express.adoc
209
+ - docs/lutaml-sysml.adoc
210
+ - docs/lutaml-uml.adoc
211
+ - docs/lutaml-xmi.adoc
212
+ - docs/lutaml_syntax.adoc
210
213
  - exe/lutaml
211
214
  - exe/lutaml-sysml
212
215
  - exe/lutaml-wsd2uml
@@ -214,11 +217,9 @@ files:
214
217
  - lib/lutaml.rb
215
218
  - lib/lutaml/command_line.rb
216
219
  - lib/lutaml/converter/dsl_to_uml.rb
217
- - lib/lutaml/converter/xmi_hash_to_uml.rb
220
+ - lib/lutaml/converter/xmi_to_uml.rb
218
221
  - lib/lutaml/express.rb
219
- - lib/lutaml/express/README.adoc
220
222
  - lib/lutaml/express/parsers/exp.rb
221
- - lib/lutaml/express/version.rb
222
223
  - lib/lutaml/formatter.rb
223
224
  - lib/lutaml/formatter/base.rb
224
225
  - lib/lutaml/formatter/graphviz.rb
@@ -226,7 +227,6 @@ files:
226
227
  - lib/lutaml/layout/graph_viz_engine.rb
227
228
  - lib/lutaml/parser.rb
228
229
  - lib/lutaml/sysml.rb
229
- - lib/lutaml/sysml/README.md
230
230
  - lib/lutaml/sysml/allocate.rb
231
231
  - lib/lutaml/sysml/allocated.rb
232
232
  - lib/lutaml/sysml/binding_connector.rb
@@ -242,7 +242,6 @@ files:
242
242
  - lib/lutaml/sysml/test_case.rb
243
243
  - lib/lutaml/sysml/trace.rb
244
244
  - lib/lutaml/sysml/verify.rb
245
- - lib/lutaml/sysml/version.rb
246
245
  - lib/lutaml/sysml/xmi_file.rb
247
246
  - lib/lutaml/uml.rb
248
247
  - lib/lutaml/uml/abstraction.rb
@@ -250,6 +249,7 @@ files:
250
249
  - lib/lutaml/uml/activity.rb
251
250
  - lib/lutaml/uml/actor.rb
252
251
  - lib/lutaml/uml/association.rb
252
+ - lib/lutaml/uml/association_generalization.rb
253
253
  - lib/lutaml/uml/behavior.rb
254
254
  - lib/lutaml/uml/cardinality.rb
255
255
  - lib/lutaml/uml/class.rb
@@ -265,6 +265,8 @@ files:
265
265
  - lib/lutaml/uml/event.rb
266
266
  - lib/lutaml/uml/fidelity.rb
267
267
  - lib/lutaml/uml/final_state.rb
268
+ - lib/lutaml/uml/general_attribute.rb
269
+ - lib/lutaml/uml/generalization.rb
268
270
  - lib/lutaml/uml/group.rb
269
271
  - lib/lutaml/uml/has_attributes.rb
270
272
  - lib/lutaml/uml/has_members.rb
@@ -305,7 +307,6 @@ files:
305
307
  - lib/lutaml/uml/vertex.rb
306
308
  - lib/lutaml/version.rb
307
309
  - lib/lutaml/xmi.rb
308
- - lib/lutaml/xmi/README.adoc
309
310
  - lib/lutaml/xmi/liquid_drops/association_drop.rb
310
311
  - lib/lutaml/xmi/liquid_drops/attribute_drop.rb
311
312
  - lib/lutaml/xmi/liquid_drops/cardinality_drop.rb
data/docs/UML_README.adoc DELETED
@@ -1,44 +0,0 @@
1
- # Lutaml::Uml
2
-
3
- image:https://badge.fury.io/rb/lutaml-uml.svg["Gem Version", link="https://badge.fury.io/rb/lutaml-uml"]
4
-
5
- image:https://github.com/lutaml/lutaml-uml/actions/workflows/macos.yml/badge.svg["macos", link="https://github.com/lutaml/lutaml-uml/actions/workflows/macos.yml"]
6
- image:https://github.com/lutaml/lutaml-uml/actions/workflows/ubuntu.yml/badge.svg["ubuntu", link="https://github.com/lutaml/lutaml-uml/actions/workflows/ubuntu.yml"]
7
- image:https://github.com/lutaml/lutaml-uml/actions/workflows/windows.yml/badge.svg["windows", link="https://github.com/lutaml/lutaml-uml/actions/workflows/windows.yml"]
8
-
9
- Lutaml is a language for specifying UML class diagrams and a tool for converting it into various different formats.
10
-
11
- ## Install
12
-
13
- ### Bundler: `gem "lutaml-uml"`
14
-
15
- ### RubyGems: `gem install lutaml-uml`
16
-
17
- ## Language
18
-
19
- See link:LUTAML.adoc[LUTAML.adoc]
20
-
21
- ## Usage
22
-
23
- Converter executables are available:
24
-
25
- * PlantUML WSD to LutaML UML: `lutaml-wsd2uml`
26
- * LutaML YAML to LutaML UML: `lutaml-yaml2uml`
27
-
28
- EXAMPLE: `lutaml-wsd2uml mn/metanorma-model-standoc/models/StandardDoc_Blocks_New.wsd`
29
-
30
-
31
- ## Development
32
-
33
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
-
35
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
-
37
- ## Contributing
38
-
39
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lutaml-uml. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/lutaml-uml/blob/master/CODE_OF_CONDUCT.md).
40
-
41
-
42
- ## Code of Conduct
43
-
44
- Everyone interacting in the Lutaml::Uml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lutaml-uml/blob/master/CODE_OF_CONDUCT.md).