lutaml 0.7.7 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -6
  3. data/.rubocop.yml +1 -0
  4. data/LUTAML.adoc +372 -0
  5. data/Makefile +2 -0
  6. data/bin/console +5 -0
  7. data/bin/folder_yaml2lutaml.sh +6 -0
  8. data/bin/plantuml2lutaml +59 -0
  9. data/bin/yaml2lutaml +144 -0
  10. data/exe/lutaml-sysml +20 -0
  11. data/exe/lutaml-wsd2uml +59 -0
  12. data/exe/lutaml-yaml2uml +144 -0
  13. data/lib/lutaml/express/README.adoc +55 -0
  14. data/lib/lutaml/express/parsers/exp.rb +21 -0
  15. data/lib/lutaml/express/version.rb +7 -0
  16. data/lib/lutaml/express.rb +9 -0
  17. data/lib/lutaml/parser.rb +7 -0
  18. data/lib/lutaml/sysml/README.md +40 -0
  19. data/lib/lutaml/sysml/allocate.rb +8 -0
  20. data/lib/lutaml/sysml/allocated.rb +7 -0
  21. data/lib/lutaml/sysml/binding_connector.rb +7 -0
  22. data/lib/lutaml/sysml/block.rb +27 -0
  23. data/lib/lutaml/sysml/constraint_block.rb +12 -0
  24. data/lib/lutaml/sysml/copy.rb +6 -0
  25. data/lib/lutaml/sysml/derive_requirement.rb +7 -0
  26. data/lib/lutaml/sysml/nested_connector_end.rb +11 -0
  27. data/lib/lutaml/sysml/refine.rb +7 -0
  28. data/lib/lutaml/sysml/requirement.rb +34 -0
  29. data/lib/lutaml/sysml/requirement_related.rb +7 -0
  30. data/lib/lutaml/sysml/satisfy.rb +7 -0
  31. data/lib/lutaml/sysml/test_case.rb +22 -0
  32. data/lib/lutaml/sysml/trace.rb +7 -0
  33. data/lib/lutaml/sysml/verify.rb +6 -0
  34. data/lib/lutaml/sysml/version.rb +5 -0
  35. data/lib/lutaml/sysml/xmi_file.rb +417 -0
  36. data/lib/lutaml/sysml.rb +10 -0
  37. data/lib/lutaml/uml/README.adoc +44 -0
  38. data/lib/lutaml/uml/abstraction.rb +11 -0
  39. data/lib/lutaml/uml/activity.rb +11 -0
  40. data/lib/lutaml/uml/actor.rb +19 -0
  41. data/lib/lutaml/uml/association.rb +43 -0
  42. data/lib/lutaml/uml/behavior.rb +11 -0
  43. data/lib/lutaml/uml/class.rb +83 -0
  44. data/lib/lutaml/uml/classifier.rb +11 -0
  45. data/lib/lutaml/uml/connector.rb +21 -0
  46. data/lib/lutaml/uml/constraint.rb +12 -0
  47. data/lib/lutaml/uml/constructor_end.rb +16 -0
  48. data/lib/lutaml/uml/data_type.rb +75 -0
  49. data/lib/lutaml/uml/dependency.rb +21 -0
  50. data/lib/lutaml/uml/diagram.rb +8 -0
  51. data/lib/lutaml/uml/document.rb +81 -0
  52. data/lib/lutaml/uml/enum.rb +45 -0
  53. data/lib/lutaml/uml/event.rb +12 -0
  54. data/lib/lutaml/uml/final_state.rb +11 -0
  55. data/lib/lutaml/uml/formatter/base.rb +67 -0
  56. data/lib/lutaml/uml/formatter/graphviz.rb +334 -0
  57. data/lib/lutaml/uml/formatter.rb +21 -0
  58. data/lib/lutaml/uml/has_attributes.rb +14 -0
  59. data/lib/lutaml/uml/has_members.rb +30 -0
  60. data/lib/lutaml/uml/instance.rb +17 -0
  61. data/lib/lutaml/uml/model.rb +13 -0
  62. data/lib/lutaml/uml/node/base.rb +21 -0
  63. data/lib/lutaml/uml/node/class_node.rb +57 -0
  64. data/lib/lutaml/uml/node/class_relationship.rb +14 -0
  65. data/lib/lutaml/uml/node/document.rb +18 -0
  66. data/lib/lutaml/uml/node/field.rb +34 -0
  67. data/lib/lutaml/uml/node/has_name.rb +15 -0
  68. data/lib/lutaml/uml/node/has_type.rb +15 -0
  69. data/lib/lutaml/uml/node/method.rb +29 -0
  70. data/lib/lutaml/uml/node/method_argument.rb +16 -0
  71. data/lib/lutaml/uml/node/relationship.rb +28 -0
  72. data/lib/lutaml/uml/opaque_behavior.rb +11 -0
  73. data/lib/lutaml/uml/operation.rb +31 -0
  74. data/lib/lutaml/uml/package.rb +53 -0
  75. data/lib/lutaml/uml/parsers/attribute.rb +70 -0
  76. data/lib/lutaml/uml/parsers/dsl.rb +413 -0
  77. data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +59 -0
  78. data/lib/lutaml/uml/parsers/dsl_transform.rb +27 -0
  79. data/lib/lutaml/uml/parsers/yaml.rb +46 -0
  80. data/lib/lutaml/uml/port.rb +8 -0
  81. data/lib/lutaml/uml/primitive_type.rb +14 -0
  82. data/lib/lutaml/uml/property.rb +27 -0
  83. data/lib/lutaml/uml/pseudostate.rb +11 -0
  84. data/lib/lutaml/uml/realization.rb +11 -0
  85. data/lib/lutaml/uml/region.rb +12 -0
  86. data/lib/lutaml/uml/serializers/association.rb +58 -0
  87. data/lib/lutaml/uml/serializers/base.rb +16 -0
  88. data/lib/lutaml/uml/serializers/class.rb +29 -0
  89. data/lib/lutaml/uml/serializers/top_element_attribute.rb +14 -0
  90. data/lib/lutaml/uml/serializers/yaml_view.rb +18 -0
  91. data/lib/lutaml/uml/state.rb +12 -0
  92. data/lib/lutaml/uml/state_machine.rb +12 -0
  93. data/lib/lutaml/uml/top_element.rb +58 -0
  94. data/lib/lutaml/uml/top_element_attribute.rb +39 -0
  95. data/lib/lutaml/uml/transition.rb +12 -0
  96. data/lib/lutaml/uml/trigger.rb +12 -0
  97. data/lib/lutaml/uml/value.rb +31 -0
  98. data/lib/lutaml/uml/version.rb +7 -0
  99. data/lib/lutaml/uml/vertex.rb +11 -0
  100. data/lib/lutaml/uml.rb +13 -0
  101. data/lib/lutaml/version.rb +1 -1
  102. data/lib/lutaml/xmi/README.adoc +24 -0
  103. data/lib/lutaml/xmi/parsers/xml.rb +600 -0
  104. data/lib/lutaml/xmi/version.rb +5 -0
  105. data/lib/lutaml/xmi.rb +7 -0
  106. data/lib/lutaml/xml/lutaml_path/document_wrapper.rb +45 -0
  107. data/lib/lutaml/xml/mapper.rb +448 -0
  108. data/lib/lutaml/xml/parsers/xml.rb +57 -0
  109. data/lib/lutaml/xml.rb +9 -0
  110. data/lutaml.gemspec +8 -3
  111. metadata +192 -16
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hashie"
4
+
5
+ module Lutaml
6
+ module Uml
7
+ module Serializers
8
+ class Base < Hashie::Dash
9
+ include Hashie::Extensions::Dash::PropertyTranslation
10
+ include Hashie::Extensions::Dash::IndifferentAccess
11
+ include Hashie::Extensions::Dash::Coercion
12
+ include Hashie::Extensions::IgnoreUndeclared
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/uml/serializers/base"
4
+ require "lutaml/uml/serializers/top_element_attribute"
5
+ require "lutaml/uml/serializers/association"
6
+
7
+ module Lutaml
8
+ module Uml
9
+ module Serializers
10
+ class Class < Base
11
+ property :attributes,
12
+ transform_with: (lambda do |entry|
13
+ entry
14
+ .to_a
15
+ .map do |(name, attributes)|
16
+ attributes.merge(name: name)
17
+ end
18
+ end)
19
+ property :associations,
20
+ from: :relations,
21
+ coerce: Array[::Lutaml::Uml::Serializers::Association]
22
+ property :name
23
+ # property :type, from: :modelType
24
+ # property :relations,
25
+ # coerce: Array[Relation]
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/uml/serializers/base"
4
+
5
+ module Lutaml
6
+ module Uml
7
+ module Serializers
8
+ class TopElementAttribute < Base
9
+ property :cardinality
10
+ property :type
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/uml/serializers/base"
4
+ require "lutaml/uml/serializers/class"
5
+
6
+ module Lutaml
7
+ module Uml
8
+ module Serializers
9
+ class YamlView < Base
10
+ property :name
11
+ property :title
12
+ property :caption
13
+ property :groups
14
+ property :fidelity
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## Behaviour metamodel
5
+ ##
6
+ module Lutaml
7
+ module Uml
8
+ class State < Vertex
9
+ attr_accessor :exit, :entry, :do_activity
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## Behaviour metamodel
5
+ ##
6
+
7
+ module Lutaml
8
+ module Uml
9
+ class StateMachine < Behavior
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class TopElement
6
+ include HasAttributes
7
+
8
+ attr_accessor :name,
9
+ :definition,
10
+ :xmi_id,
11
+ :xmi_uuid,
12
+ :namespace,
13
+ :keyword,
14
+ :stereotype,
15
+ :href,
16
+ :visibility,
17
+ :comments
18
+
19
+ # rubocop:disable Rails/ActiveRecordAliases
20
+ def initialize(attributes = {})
21
+ @visibility = "public"
22
+ @name = attributes["name"]
23
+ update_attributes(attributes)
24
+ end
25
+ # rubocop:enable Rails/ActiveRecordAliases
26
+
27
+ def full_name
28
+ if name == nil
29
+ return nil
30
+ end
31
+
32
+ the_name = name
33
+ next_namespace = namespace
34
+
35
+ while !next_namespace.nil?
36
+ the_name = if !next_namespace.name.nil?
37
+ next_namespace.name + "::" + the_name
38
+ else
39
+ "::" + the_name
40
+ end
41
+ next_namespace = next_namespace.namespace
42
+ end
43
+
44
+ the_name
45
+ end
46
+
47
+ def definition=(value)
48
+ @definition = value
49
+ .to_s
50
+ .gsub(/\\}/, '}')
51
+ .gsub(/\\{/, '{')
52
+ .split("\n")
53
+ .map(&:strip)
54
+ .join("\n")
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class TopElementAttribute
6
+ include HasAttributes
7
+ include HasMembers
8
+
9
+ attr_accessor :name,
10
+ :visibility,
11
+ :type,
12
+ :id,
13
+ :xmi_id,
14
+ :definition,
15
+ :contain,
16
+ :static,
17
+ :cardinality,
18
+ :keyword,
19
+ :is_derived
20
+
21
+ # rubocop:disable Rails/ActiveRecordAliases
22
+ def initialize(attributes = {})
23
+ @visibility = "public"
24
+ update_attributes(attributes)
25
+ end
26
+ # rubocop:enable Rails/ActiveRecordAliases
27
+
28
+ def definition=(value)
29
+ @definition = value
30
+ .to_s
31
+ .gsub(/\\}/, '}')
32
+ .gsub(/\\{/, '{')
33
+ .split("\n")
34
+ .map(&:strip)
35
+ .join("\n")
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## Behaviour metamodel
5
+ ##
6
+ module Lutaml
7
+ module Uml
8
+ class Transition < TopElement
9
+ attr_accessor :source, :target, :guard, :effect
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## Behaviour metamodel
5
+ ##
6
+ module Lutaml
7
+ module Uml
8
+ class Trigger < TopElement
9
+ attr_accessor :event
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class Value
6
+ include HasAttributes
7
+ include HasMembers
8
+
9
+ attr_accessor :definition,
10
+ :name,
11
+ :id,
12
+ :type
13
+
14
+ # rubocop:disable Rails/ActiveRecordAliases
15
+ def initialize(attributes = {})
16
+ update_attributes(attributes)
17
+ end
18
+ # rubocop:enable Rails/ActiveRecordAliases
19
+
20
+ def definition=(value)
21
+ @definition = value
22
+ .to_s
23
+ .gsub(/\\}/, '}')
24
+ .gsub(/\\{/, '{')
25
+ .split("\n")
26
+ .map(&:strip)
27
+ .join("\n")
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ VERSION = "0.4.3"
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## Behaviour metamodel
5
+ ##
6
+ module Lutaml
7
+ module Uml
8
+ class Vertex < TopElement
9
+ end
10
+ end
11
+ end
data/lib/lutaml/uml.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/uml/version"
4
+ require "lutaml/uml/parsers/dsl"
5
+ require "lutaml/uml/parsers/yaml"
6
+ require "lutaml/uml/parsers/attribute"
7
+ require "lutaml/uml/formatter"
8
+
9
+ module Lutaml
10
+ module Uml
11
+ class Error < StandardError; end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.7.7".freeze
2
+ VERSION = "0.8.0".freeze
3
3
  end
@@ -0,0 +1,24 @@
1
+ # Lutaml::Uml
2
+
3
+ Lutaml-xmi is a parser for XML Metadata Interchange (XMI) Specification files.
4
+
5
+ ## Install
6
+
7
+ ### Bundler: `gem "lutaml-xmi"`
8
+
9
+ ### RubyGems: `gem install lutaml-xmi`
10
+
11
+ ## Development
12
+
13
+ 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.
14
+
15
+ 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).
16
+
17
+ ## Contributing
18
+
19
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lutaml-xmi. 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-xmi/blob/master/CODE_OF_CONDUCT.md).
20
+
21
+
22
+ ## Code of Conduct
23
+
24
+ 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-xmi/blob/master/CODE_OF_CONDUCT.md).