lutaml-uml 0.2.9 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e25b300c9a636999a7861a78ea5c677d1c0c6767180a81f8b63cc6f9af2f8aa
4
- data.tar.gz: b78902b23e27ec296913e2943c5fb966d17268f6c28e2b1c50409450e0310ed8
3
+ metadata.gz: b394ba93cd4b9fd8a7136abd42d8302a1f66825ecccafdf5395466b6e3bd4c81
4
+ data.tar.gz: b48168115e95037e6edc9de0e12dd4521d715c75ed3264f17ec7b5c42c96297a
5
5
  SHA512:
6
- metadata.gz: 287de7e6b28b6ff2c1dffab0db3a4503257c3b75c00409cd56184629875f3196e9a91dee7acb21a8cf1d1e484a59a9d5188836d33002599d8a4407da4a51f68c
7
- data.tar.gz: 14f5782e4d85885c3fca50f486cf8107648fac50e50acdeb2d931dc6a68c4e0e8fe1c9b9927dfd4449a02186ea36a969d1591fd55712334dca72cb49d7fba103
6
+ metadata.gz: 190d8fb433ea68c26b35d49ec6de1e0d89fcc475bc2fa34f75cc43d587eedf451bdf4ca2c6b0a0661b809d56298c650b19cba1dddb31577e72a71d1b98a7bcc9
7
+ data.tar.gz: f5767e05d2d2726ae524053392a5d61fbcec3d0dd163064b3ea7f2607359f61d4730d1697649f0e02aa7e9e8420e84cf2ae4eafdbbc06d6782d621d1b0f40d5f
data/LUTAML.adoc CHANGED
@@ -7,13 +7,18 @@
7
7
  [source,java]
8
8
  ----
9
9
  diagram MyView {
10
- import Relationship, Element
11
- render_option typed_as_associations
12
- file "my_view.png"
10
+ title "My diagram"
11
+ caption "My custom caption"
13
12
  fontname "Helvetica"
14
13
  }
15
14
  ----
16
15
 
16
+ where:
17
+
18
+ * `fontname` - optional, configuration option to use supplied font name
19
+ * `title` - optional, set custom title for diagram
20
+ * `caption` - optional, set custom caption for diagram
21
+
17
22
  == DataTypes
18
23
 
19
24
  Lutaml supports 3 types of data_types: `data_type`, `primitive` and `enum`. Example of data types declaration:
data/README.adoc CHANGED
@@ -1,5 +1,11 @@
1
1
  # Lutaml::Uml
2
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
+
3
9
  Lutaml is a language for specifying UML class diagrams and a tool for converting it into various different formats.
4
10
 
5
11
  ## Install
@@ -35,4 +41,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
35
41
 
36
42
  ## Code of Conduct
37
43
 
38
- 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).
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).
@@ -3,6 +3,7 @@
3
3
  require "lutaml/uml/has_members"
4
4
  require "lutaml/uml/classifier"
5
5
  require "lutaml/uml/association"
6
+ require "lutaml/uml/constraint"
6
7
  require "lutaml/uml/top_element_attribute"
7
8
 
8
9
  module Lutaml
@@ -17,7 +18,8 @@ module Lutaml
17
18
  attr_reader :associations,
18
19
  :attributes,
19
20
  :members,
20
- :modifier
21
+ :modifier,
22
+ :constraints
21
23
 
22
24
  def initialize(attributes = {})
23
25
  @nested_classifier = []
@@ -43,6 +45,12 @@ module Lutaml
43
45
  end
44
46
  end
45
47
 
48
+ def constraints=(value)
49
+ @constraints = value.to_a.map do |attr|
50
+ Constraint.new(attr)
51
+ end
52
+ end
53
+
46
54
  def methods
47
55
  # @members&.select { |member| member.class == Method }
48
56
  []
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lutaml/uml/class"
4
- require "lutaml/uml/enum"
5
4
  require "lutaml/uml/data_type"
5
+ require "lutaml/uml/enum"
6
+ require "lutaml/uml/package"
6
7
  require "lutaml/uml/primitive_type"
7
8
 
8
9
  module Lutaml
@@ -18,23 +19,27 @@ module Lutaml
18
19
  :fidelity,
19
20
  :fontname,
20
21
  :comments
22
+ attr_reader :packages
21
23
 
22
24
  # rubocop:disable Rails/ActiveRecordAliases
23
25
  def initialize(attributes = {})
24
26
  update_attributes(attributes)
25
27
  end
26
28
  # rubocop:enable Rails/ActiveRecordAliases
27
-
28
29
  def classes=(value)
29
30
  @classes = value.to_a.map { |attributes| Class.new(attributes) }
30
31
  end
31
32
 
33
+ def data_types=(value)
34
+ @data_types = value.to_a.map { |attributes| DataType.new(attributes) }
35
+ end
36
+
32
37
  def enums=(value)
33
38
  @enums = value.to_a.map { |attributes| Enum.new(attributes) }
34
39
  end
35
40
 
36
- def data_types=(value)
37
- @data_types = value.to_a.map { |attributes| DataType.new(attributes) }
41
+ def packages=(value)
42
+ @packages = value.to_a.map { |attributes| Package.new(attributes) }
38
43
  end
39
44
 
40
45
  def primitives=(value)
@@ -59,6 +64,10 @@ module Lutaml
59
64
  @data_types || []
60
65
  end
61
66
 
67
+ def packages
68
+ @packages || []
69
+ end
70
+
62
71
  def primitives
63
72
  @primitives || []
64
73
  end
@@ -3,16 +3,37 @@
3
3
  module Lutaml
4
4
  module Uml
5
5
  class Package < TopElement
6
+ include HasAttributes
7
+
6
8
  attr_accessor :imports, :contents
9
+ attr_reader :classes, :enums
10
+
11
+ def initialize(attributes)
12
+ update_attributes(attributes)
13
+ end
14
+
15
+ def classes=(value)
16
+ @classes = value.to_a.map { |attributes| Class.new(attributes) }
17
+ end
18
+
19
+ def enums=(value)
20
+ @enums = value.to_a.map { |attributes| Enum.new(attributes) }
21
+ end
22
+
23
+ def packages=(value)
24
+ @packages = value.to_a.map { |attributes| Package.new(attributes) }
25
+ end
26
+
27
+ def classes
28
+ @classes || []
29
+ end
30
+
31
+ def enums
32
+ @enums || []
33
+ end
7
34
 
8
- def initialize
9
- @imports = []
10
- @contents = []
11
- @name = nil
12
- @xmi_id = nil
13
- @xmi_uuid = nil
14
- @namespace = nil
15
- @href = nil
35
+ def packages
36
+ @packages || []
16
37
  end
17
38
  end
18
39
  end
@@ -117,7 +117,7 @@ module Lutaml
117
117
  attribute_keyword? >>
118
118
  spaces? >>
119
119
  match['"\''].maybe >>
120
- match['a-zA-Z0-9_\- '].repeat(1).as(:type) >>
120
+ match['a-zA-Z0-9_\- \/\+'].repeat(1).as(:type) >>
121
121
  match['"\''].maybe >>
122
122
  spaces?
123
123
  )
@@ -126,7 +126,7 @@ module Lutaml
126
126
  attribute_type.maybe
127
127
  end
128
128
 
129
- rule(:attribute_name) { name.as(:name) }
129
+ rule(:attribute_name) { match['a-zA-Z0-9_\- \/\+'].repeat(1).as(:name) }
130
130
  rule(:attribute_definition) do
131
131
  (visibility?.as(:visibility) >>
132
132
  match['"\''].maybe >>
@@ -329,7 +329,10 @@ module Lutaml
329
329
  # -- data_type
330
330
  rule(:data_type_keyword) { kw_data_type >> spaces }
331
331
  rule(:data_type_inner_definitions) do
332
- attribute_definition
332
+ definition_body |
333
+ attribute_definition |
334
+ comment_definition |
335
+ comment_multiline_definition
333
336
  end
334
337
  rule(:data_type_inner_definition) do
335
338
  data_type_inner_definitions >> whitespace?
@@ -347,6 +350,7 @@ module Lutaml
347
350
  match['"\''].maybe >>
348
351
  class_name.as(:name) >>
349
352
  match['"\''].maybe >>
353
+ attribute_keyword? >>
350
354
  data_type_body?
351
355
  end
352
356
 
@@ -13,7 +13,8 @@ module Lutaml
13
13
  :contain,
14
14
  :static,
15
15
  :cardinality,
16
- :keyword
16
+ :keyword,
17
+ :is_derived
17
18
 
18
19
  # rubocop:disable Rails/ActiveRecordAliases
19
20
  def initialize(attributes = {})
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Uml
5
- VERSION = "0.2.9"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
data/lutaml-uml.gemspec CHANGED
@@ -28,10 +28,10 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency "parslet", "~> 1.7.1"
29
29
  spec.add_runtime_dependency "ruby-graphviz", "~> 1.2"
30
30
  spec.add_runtime_dependency "thor", "~> 1.0"
31
+ spec.add_runtime_dependency "nokogiri", "~> 1.10"
31
32
 
32
33
  spec.add_development_dependency "bundler", "~> 2.0"
33
34
  spec.add_development_dependency "byebug"
34
- spec.add_development_dependency "nokogiri", "~> 1.10"
35
35
  spec.add_development_dependency "pry", "~> 0.12.2"
36
36
  spec.add_development_dependency "rake", "~> 10.0"
37
37
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -15,5 +15,11 @@ diagram MyView {
15
15
  ~friendlyAttributeProfile: <<Type>> "CharacterString" [1..*]
16
16
  ~friendlyAttributeProfile1: <<Type>> "CharacterString"
17
17
  #protectedAttributeProfile: CharacterString
18
+ type/text: String
19
+ slashType: slash/type
20
+ application/docbook+xml
21
+ application/tei+xml
22
+ text/x-asciidoc
23
+ application/x-isodoc+xml
18
24
  }
19
25
  }
@@ -8,10 +8,30 @@ diagram MyView {
8
8
  }
9
9
 
10
10
  data_type "Banking Information" {
11
- "art code"
11
+ definition {
12
+ Common code types used in banking.
13
+ }
14
+ "art code" {
15
+ definition {
16
+ The bank ART code.
17
+ }
18
+ }
12
19
  "CCT Number"
13
20
  }
14
21
 
22
+ data_type DateTimeType {
23
+ definition {
24
+ Type of date time value.
25
+ }
26
+ year {
27
+ definition {
28
+ The value only provides year.
29
+ }
30
+ }
31
+ monthYear
32
+ dayMonthYear
33
+ }
34
+
15
35
  primitive Integer
16
36
 
17
37
  enum Profile {
@@ -68,7 +68,22 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
68
68
  expect(by_name(classes, "AddressClassProfile")
69
69
  .attributes.length).to eq(1)
70
70
  expect(by_name(classes, "AttributeProfile")
71
- .attributes.length).to eq(7)
71
+ .attributes.length).to eq(13)
72
+ expect(by_name(classes, "AttributeProfile")
73
+ .attributes.map(&:name))
74
+ .to(eq(["imlicistAttributeProfile",
75
+ "attributeProfile",
76
+ "attributeProfile1",
77
+ "privateAttributeProfile",
78
+ "friendlyAttributeProfile",
79
+ "friendlyAttributeProfile1",
80
+ "protectedAttributeProfile",
81
+ "type/text",
82
+ "slashType",
83
+ "application/docbook+xml",
84
+ "application/tei+xml",
85
+ "text/x-asciidoc",
86
+ "application/x-isodoc+xml"]))
72
87
  end
73
88
 
74
89
  it "creates the correct attributes with the correct visibility" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-uml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-10 00:00:00.000000000 Z
11
+ date: 2021-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -67,47 +67,47 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: bundler
70
+ name: nokogiri
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :development
75
+ version: '1.10'
76
+ type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '1.10'
83
83
  - !ruby/object:Gem::Dependency
84
- name: byebug
84
+ name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '2.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '2.0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: nokogiri
98
+ name: byebug
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '1.10'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '1.10'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0'
321
321
  requirements: []
322
- rubygems_version: 3.0.3
322
+ rubygems_version: 3.1.6
323
323
  signing_key:
324
324
  specification_version: 4
325
325
  summary: UML model module for LutaML.