lutaml-uml 0.3.1 → 0.4.3

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: 3327c8c125b9d4b538b648b7b20d112dc70a4bfbc78b9f542bb33b6c57c5eeea
4
- data.tar.gz: efe632c537b96ee01417bededb2ccd45a5e4dca4660c88952f39ff71c0061fa7
3
+ metadata.gz: 5d7db5a90a481773906ffcd2985d36777ba62f2c79a1de83390c7890a4c9f7c4
4
+ data.tar.gz: 7d9229702c7b58d2a2d0c8f2261230eb941f7fd76a0f17c784d48da01a22c5c0
5
5
  SHA512:
6
- metadata.gz: 5e51c58f53a8743b0ca43e96cf3e98eee5dd99dcd7ba66ae8d87728c8c4d8270851518c98058275ea867a1879444909d547e956a6062d424c28f4145f031732e
7
- data.tar.gz: '085f6c41da759ed7fb4b3a8aae3a53b28241d564a21f3ebf992c0a98e877483ed0d9f885d51a1ec23c54ce9cf719e2e3902a98012d4031376e973ffe73b0453b'
6
+ metadata.gz: ec111d11c2354621c95c3708296356906977f9c949f96a07c8e1ee71928733ff68089b5339bb2017f824fa76274fe2e043693ca48b7cbd1305c85756791097a0
7
+ data.tar.gz: 81de391a9fc9a1d546d82dcfde50b802a67e4bc28ffee88f08699faa6f54b3e7052107e2824c77dfd2b5cd40f3c78518757e7e1955c2715584225508f543389d
data/LUTAML.adoc CHANGED
@@ -21,7 +21,9 @@ where:
21
21
 
22
22
  == DataTypes
23
23
 
24
- Lutaml supports 3 types of data_types: `data_type`, `primitive` and `enum`. Example of data types declaration:
24
+ Lutaml supports 3 types of data_types: `data_type`, `primitive` and `enum`.
25
+
26
+ Example of data types declaration:
25
27
 
26
28
  [source,java]
27
29
  ----
@@ -67,8 +69,8 @@ association name {
67
69
 
68
70
  where:
69
71
 
70
- * `owned_type` - optional, use to define bidirectional association(association|composition|aggregation|generalization|uses)
71
- * `member_type` - association type(association|composition|aggregation|generalization|uses)
72
+ * `owned_type` - optional, use to define a bidirectional association (`association`|`composition`|`aggregation`|`generalization`|`uses`)
73
+ * `member_type` - association type (`association`|`composition`|`aggregation`|`generalization`|`uses`)
72
74
  * `owned|member` - end of association, use `\#attribute_name` to set a role name
73
75
  * `property_string` - property string for attibutes associations
74
76
  * `cardinality` - examples: '1..*', '*'
@@ -142,7 +144,12 @@ Full syntax:
142
144
 
143
145
  where:
144
146
 
145
- * `visibility` can be equal to `-` - private, `+` - public, `#` - protected, `~` - friendly
147
+ * `visibility` can be equal to
148
+ ** `-`: private
149
+ ** `+`: public
150
+ ** `#`: protected
151
+ ** `~`: friendly
152
+
146
153
  * `attribute` - attrbute keyword
147
154
  * `/` - symbolizes a derived attribute.
148
155
  * `multiplicity` - Multiplicity is in square brackets (e.g. [1..*]).
@@ -178,14 +185,17 @@ enum A {
178
185
  }
179
186
  ----
180
187
 
188
+ [[attribute-visibility]]
181
189
  === Attribute visibility
182
190
 
183
- Syntax for defining visibility: [+|-|#|~] [attribute] attribute_name. LutaML uses these modificators to define attribute(entry) visbility:
191
+ Syntax for defining visibility: `[+|-|#|~] [attribute] attribute_name`.
184
192
 
185
- + => public
186
- - => private
187
- # => protected
188
- ~ => package
193
+ LutaML uses these modificators to define attribute (entry) visbility:
194
+
195
+ `+`:: public
196
+ `-`:: private
197
+ `#`:: protected
198
+ `~`:: package
189
199
 
190
200
  example:
191
201
 
@@ -226,9 +236,20 @@ Syntax for defining methods:
226
236
  ----
227
237
 
228
238
  where:
229
- - `visibility` can be equal to `-` - private, `+` - public, `#` - protected, `~` - friendly
230
- - `parameter-list` - parameter list
231
- - `property-modifier` - can be equal to `redefines`, `query`, `ordered`(`unordered`), `unique`(`nonunique`)
239
+
240
+ * `visibility` can be equal to
241
+ ** `-`: private
242
+ ** `+`: public
243
+ ** `#`: protected
244
+ ** `~`: friendly
245
+
246
+ * `parameter-list`: parameter list
247
+
248
+ * `property-modifier`: can be equal to
249
+ ** `redefines`
250
+ ** `query`
251
+ ** `ordered` (defaults to `unordered`)
252
+ ** `unique`(defaults to `nonunique`)
232
253
 
233
254
  Syntax for a `parameter-list`:
234
255
 
@@ -238,7 +259,12 @@ Syntax for a `parameter-list`:
238
259
  ----
239
260
 
240
261
  where:
241
- - `direction` - can be equal to `in`, `out`, `inout` or `return`
262
+
263
+ * `direction` can be equal to
264
+ ** `in`
265
+ ** `out`
266
+ ** `inout`
267
+ ** `return`
242
268
 
243
269
  == import files
244
270
 
@@ -252,7 +278,8 @@ include path/to/file
252
278
  == Package syntax
253
279
 
254
280
  Namespaces
255
- Def.-A named element is an element that can have a name and a defined visibility (public, private, protected, package):
281
+
282
+ A named element is an element that can have a name and a defined visibility (public, private, protected, package):
256
283
 
257
284
  [source,java]
258
285
  ----
@@ -286,7 +313,8 @@ abstract class Pet {}
286
313
  == Comment objects diagram
287
314
 
288
315
  Use `\**`(one line comment) or `*| |*`(multiline comment) to create comment object for diagram entry.
289
- If this syntax used inside class/enum/association block it will be created for owner of this block.
316
+
317
+ If this syntax is used inside a `class`/`enum`/`association` block, it will be created for owner of this block.
290
318
 
291
319
  [source,java]
292
320
  ----
@@ -313,7 +341,7 @@ enum B {
313
341
 
314
342
  == Syntax comments
315
343
 
316
- Use `//` to create syntax comment, chars after // will be ignored during processing
344
+ Use `//` to create syntax comment, chars after `//` will be ignored during processing.
317
345
 
318
346
  [source,java]
319
347
  ----
@@ -328,7 +356,7 @@ enum B {
328
356
 
329
357
  == Value specification
330
358
 
331
- A value specification indicates one or several values in a model. Examples for value specifications include simple, mathematical expressions, such as 4+2, and expressions with values from the object model, Integer::MAX_INT-1
359
+ A value specification indicates one or several values in a model. Examples for value specifications include simple, mathematical expressions, such as `4+2`, and expressions with values from the object model, `Integer::MAX_INT-1`
332
360
 
333
361
  [source,java]
334
362
  ----
@@ -341,4 +369,4 @@ instance :{Class name, if any} {as ref name, optional} {
341
369
  {attribute name} = {attribute value}
342
370
  {attribute name}:{attribute class} = {attribute value}
343
371
  }
344
- ----
372
+ ----
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).
data/exe/lutaml-wsd2uml CHANGED
@@ -27,7 +27,7 @@ ASSOCIATION_MAPPINGS = {
27
27
  in_comment_block = false
28
28
 
29
29
  def transform_line(line)
30
- line = line.gsub(/^\s*'/, '** ').gsub(/\|[\sa-zA-Z]+$/, '')
30
+ line = line.gsub(/^\s*'/, '** ').gsub(/\|[\sa-zA-Z]+$/, '').gsub(/\r/, '')
31
31
  return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? { |key| line =~ key }
32
32
 
33
33
  owner_type, member_type = ASSOCIATION_MAPPINGS.detect { |(key, _value)| line =~ key }.last.split(",")
@@ -9,8 +9,10 @@ module Lutaml
9
9
  :owner_end_attribute_name,
10
10
  :owner_end_cardinality,
11
11
  :owner_end_type,
12
+ :owner_end_xmi_id,
12
13
  :member_end,
13
14
  :member_end_attribute_name,
15
+ :member_end_xmi_id,
14
16
  :member_end_cardinality,
15
17
  :member_end_type,
16
18
  :static,
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "lutaml/uml/has_members"
4
3
  require "lutaml/uml/classifier"
4
+
5
+ require "lutaml/uml/has_members"
5
6
  require "lutaml/uml/association"
6
7
  require "lutaml/uml/constraint"
8
+ require "lutaml/uml/data_type"
9
+ require "lutaml/uml/operation"
7
10
  require "lutaml/uml/top_element_attribute"
8
11
 
9
12
  module Lutaml
@@ -13,13 +16,16 @@ module Lutaml
13
16
 
14
17
  attr_accessor :nested_classifier,
15
18
  :is_abstract,
16
- :type
19
+ :type,
20
+ :package
17
21
 
18
22
  attr_reader :associations,
19
23
  :attributes,
20
24
  :members,
21
25
  :modifier,
22
- :constraints
26
+ :constraints,
27
+ :operations,
28
+ :data_types
23
29
 
24
30
  def initialize(attributes = {})
25
31
  @nested_classifier = []
@@ -51,6 +57,18 @@ module Lutaml
51
57
  end
52
58
  end
53
59
 
60
+ def operations=(value)
61
+ @operations = value.to_a.map do |attr|
62
+ Operation.new(attr)
63
+ end
64
+ end
65
+
66
+ def data_types=(value)
67
+ @data_types = value.to_a.map do |attr|
68
+ DataType.new(attr)
69
+ end
70
+ end
71
+
54
72
  def methods
55
73
  # @members&.select { |member| member.class == Method }
56
74
  []
@@ -1,14 +1,75 @@
1
1
  # frozen_string_literal: true
2
+ require "lutaml/uml/classifier"
2
3
 
3
4
  module Lutaml
4
5
  module Uml
5
- class DataType < Class
6
- attr_reader :keyword
6
+ class DataType < Classifier
7
+ include HasMembers
8
+
9
+ attr_accessor :nested_classifier,
10
+ :is_abstract,
11
+ :type
12
+
13
+ attr_reader :associations,
14
+ :attributes,
15
+ :members,
16
+ :modifier,
17
+ :constraints,
18
+ :operations,
19
+ :data_types
7
20
 
8
21
  def initialize(attributes = {})
22
+ @nested_classifier = []
23
+ @stereotype = []
24
+ @generalization = []
25
+ @is_abstract = false
9
26
  super
10
27
  @keyword = "dataType"
11
28
  end
29
+
30
+ def modifier=(value)
31
+ @modifier = value.to_s # TODO: Validate?
32
+ end
33
+
34
+ def attributes=(value)
35
+ @attributes = value.to_a.map do |attr|
36
+ TopElementAttribute.new(attr)
37
+ end
38
+ end
39
+
40
+ def associations=(value)
41
+ @associations = value.to_a.map do |attr|
42
+ Association.new(attr.to_h.merge(owner_end: name))
43
+ end
44
+ end
45
+
46
+ def constraints=(value)
47
+ @constraints = value.to_a.map do |attr|
48
+ Constraint.new(attr)
49
+ end
50
+ end
51
+
52
+ def operations=(value)
53
+ @operations = value.to_a.map do |attr|
54
+ Operation.new(attr)
55
+ end
56
+ end
57
+
58
+ def data_types=(value)
59
+ @data_types = value.to_a.map do |attr|
60
+ DataType.new(attr)
61
+ end
62
+ end
63
+
64
+ def methods
65
+ # @members&.select { |member| member.class == Method }
66
+ []
67
+ end
68
+
69
+ def relationships
70
+ # @members&.select { |member| member.class == ClassRelationship }
71
+ []
72
+ end
12
73
  end
13
74
  end
14
75
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class Diagram < TopElement
6
+ end
7
+ end
8
+ end
@@ -3,6 +3,7 @@
3
3
  require "lutaml/uml/class"
4
4
  require "lutaml/uml/data_type"
5
5
  require "lutaml/uml/enum"
6
+ require "lutaml/uml/diagram"
6
7
  require "lutaml/uml/package"
7
8
  require "lutaml/uml/primitive_type"
8
9
 
@@ -4,6 +4,7 @@ require "lutaml/uml/has_members"
4
4
  require "lutaml/uml/classifier"
5
5
  require "lutaml/uml/association"
6
6
  require "lutaml/uml/top_element_attribute"
7
+ require "lutaml/uml/value"
7
8
 
8
9
  module Lutaml
9
10
  module Uml
@@ -14,19 +15,27 @@ module Lutaml
14
15
  :members,
15
16
  :modifier,
16
17
  :definition,
17
- :keyword
18
+ :keyword,
19
+ :values
18
20
 
19
21
  def initialize(attributes = {})
20
22
  super
21
23
  @keyword = "enumeration"
22
24
  end
23
25
 
26
+ # TODO: delete?
24
27
  def attributes=(value)
25
28
  @attributes = value.to_a.map do |attr|
26
29
  TopElementAttribute.new(attr)
27
30
  end
28
31
  end
29
32
 
33
+ def values=(value)
34
+ @values = value.to_a.map do |attr|
35
+ Value.new(attr)
36
+ end
37
+ end
38
+
30
39
  # TODO: reserved name, change
31
40
  def methods
32
41
  []
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class Operation
6
+ include HasAttributes
7
+ include HasMembers
8
+
9
+ attr_accessor :definition,
10
+ :name,
11
+ :return_type,
12
+ :parameter_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
@@ -6,10 +6,11 @@ module Lutaml
6
6
  include HasAttributes
7
7
 
8
8
  attr_accessor :imports, :contents
9
- attr_reader :classes, :enums
9
+ attr_reader :classes, :enums, :data_types, :children_packages
10
10
 
11
11
  def initialize(attributes)
12
12
  update_attributes(attributes)
13
+ @children_packages ||= packages.map { |pkg| [pkg, pkg.packages, pkg.packages.map(&:children_packages)] }.flatten.uniq
13
14
  end
14
15
 
15
16
  def classes=(value)
@@ -20,10 +21,18 @@ module Lutaml
20
21
  @enums = value.to_a.map { |attributes| Enum.new(attributes) }
21
22
  end
22
23
 
24
+ def data_types=(value)
25
+ @data_types = value.to_a.map { |attributes| DataType.new(attributes) }
26
+ end
27
+
23
28
  def packages=(value)
24
29
  @packages = value.to_a.map { |attributes| Package.new(attributes) }
25
30
  end
26
31
 
32
+ def diagrams=(value)
33
+ @diagrams = value.to_a.map { |attributes| Diagram.new(attributes) }
34
+ end
35
+
27
36
  def classes
28
37
  @classes || []
29
38
  end
@@ -35,6 +44,10 @@ module Lutaml
35
44
  def packages
36
45
  @packages || []
37
46
  end
47
+
48
+ def diagrams
49
+ @diagrams || []
50
+ end
38
51
  end
39
52
  end
40
53
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "parslet"
4
+ require "parslet/convenience"
4
5
  require "lutaml/uml/parsers/dsl_preprocessor"
5
6
  require "lutaml/uml/parsers/dsl_transform"
6
7
  require "lutaml/uml/node/document"
@@ -8,6 +9,7 @@ require "lutaml/uml/node/document"
8
9
  module Lutaml
9
10
  module Uml
10
11
  module Parsers
12
+ class ParsingError < StandardError; end
11
13
  # Class for parsing LutaML dsl into Lutaml::Uml::Document
12
14
  class Dsl < Parslet::Parser
13
15
  # @param [String] io - LutaML string representation
@@ -20,7 +22,15 @@ module Lutaml
20
22
 
21
23
  def parse(input_file, _options = {})
22
24
  data = Lutaml::Uml::Parsers::DslPreprocessor.call(input_file)
23
- ::Lutaml::Uml::Document.new(DslTransform.new.apply(super(data)))
25
+ # https://kschiess.github.io/parslet/tricks.html#Reporter engines
26
+ # Parslet::ErrorReporter::Deepest allows more
27
+ # detailed display of error
28
+ reporter = Parslet::ErrorReporter::Deepest.new
29
+ ::Lutaml::Uml::Document
30
+ .new(DslTransform.new.apply(super(data, reporter: reporter)))
31
+ rescue Parslet::ParseFailed => e
32
+ raise(ParsingError,
33
+ "#{e.message}\ncause: #{e.parse_failure_cause.ascii_tree}")
24
34
  end
25
35
 
26
36
  KEYWORDS = %w[
@@ -141,14 +151,14 @@ module Lutaml
141
151
  rule(:title_keyword) { kw_title >> spaces }
142
152
  rule(:title_text) do
143
153
  match['"\''].maybe >>
144
- match['a-zA-Z0-9_\- '].repeat(1).as(:title) >>
154
+ match['a-zA-Z0-9_\- ,.:;'].repeat(1).as(:title) >>
145
155
  match['"\''].maybe
146
156
  end
147
157
  rule(:title_definition) { title_keyword >> title_text }
148
158
  rule(:caption_keyword) { kw_caption >> spaces }
149
159
  rule(:caption_text) do
150
160
  match['"\''].maybe >>
151
- match['a-zA-Z0-9_\- '].repeat(1).as(:caption) >>
161
+ match['a-zA-Z0-9_\- ,.:;'].repeat(1).as(:caption) >>
152
162
  match['"\''].maybe
153
163
  end
154
164
  rule(:caption_definition) { caption_keyword >> caption_text }
@@ -292,9 +302,7 @@ module Lutaml
292
302
  str("definition") >>
293
303
  whitespace? >>
294
304
  str("{") >>
295
- whitespace? >>
296
- (match("[\n\s]}").absent? >> any).repeat.as(:definition) >>
297
- whitespace? >>
305
+ ((str("\\") >> any) | (str("}").absent? >> any)).repeat.maybe.as(:definition) >>
298
306
  str('}')
299
307
  end
300
308
 
@@ -387,12 +395,11 @@ module Lutaml
387
395
  diagram_inner_definition.repeat.as(:members) >>
388
396
  str("}")
389
397
  end
390
- rule(:diagram_body?) { diagram_body.maybe }
391
398
  rule(:diagram_definition) do
392
399
  diagram_keyword >>
393
400
  spaces? >>
394
401
  class_name.as(:name) >>
395
- diagram_body? >>
402
+ diagram_body >>
396
403
  whitespace?
397
404
  end
398
405
  rule(:diagram_definitions) { diagram_definition >> whitespace? }
@@ -5,16 +5,28 @@ module Lutaml
5
5
  module Parsers
6
6
  # Class for preprocessing dsl ascii file special directives:
7
7
  # - include
8
- module DslPreprocessor
9
- module_function
8
+ class DslPreprocessor
9
+ attr_reader :input_file
10
10
 
11
- def call(input_file)
11
+ def initialize(input_file)
12
+ @input_file = input_file
13
+ end
14
+
15
+ class << self
16
+ def call(input_file)
17
+ new(input_file).call
18
+ end
19
+ end
20
+
21
+ def call
12
22
  include_root = File.dirname(input_file.path)
13
23
  input_file.read.split("\n").reduce([]) do |res, line|
14
24
  res.push(*process_dsl_line(include_root, line))
15
25
  end.join("\n")
16
26
  end
17
27
 
28
+ private
29
+
18
30
  def process_dsl_line(include_root, line)
19
31
  process_include_line(include_root, process_comment_line(line))
20
32
  end
@@ -28,7 +40,7 @@ module Lutaml
28
40
 
29
41
  def process_include_line(include_root, line)
30
42
  include_path_match = line.match(/^\s*include\s+(.+)/)
31
- return line if include_path_match.nil?
43
+ return line if include_path_match.nil? || line =~ /^\s\*\*/
32
44
 
33
45
  path_to_file = include_path_match[1].strip
34
46
  path_to_file = if path_to_file.match?(/^\//)
@@ -37,6 +49,9 @@ module Lutaml
37
49
  File.join(include_root, path_to_file)
38
50
  end
39
51
  File.read(path_to_file).split("\n")
52
+ rescue Errno::ENOENT
53
+ puts("No such file or directory @ rb_sysopen - #{path_to_file}, \
54
+ include file paths need to be supplied relative to the main document")
40
55
  end
41
56
  end
42
57
  end
@@ -9,6 +9,7 @@ module Lutaml
9
9
  attr_accessor :name,
10
10
  :visibility,
11
11
  :type,
12
+ :xmi_id,
12
13
  :definition,
13
14
  :contain,
14
15
  :static,
@@ -0,0 +1,30 @@
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
+ :type
12
+
13
+ # rubocop:disable Rails/ActiveRecordAliases
14
+ def initialize(attributes = {})
15
+ update_attributes(attributes)
16
+ end
17
+ # rubocop:enable Rails/ActiveRecordAliases
18
+
19
+ def definition=(value)
20
+ @definition = value
21
+ .to_s
22
+ .gsub(/\\}/, '}')
23
+ .gsub(/\\{/, '{')
24
+ .split("\n")
25
+ .map(&:strip)
26
+ .join("\n")
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Uml
5
- VERSION = "0.3.1"
5
+ VERSION = "0.4.3"
6
6
  end
7
7
  end
data/lutaml-uml.gemspec CHANGED
@@ -25,13 +25,13 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = %w[lutaml-wsd2uml lutaml-yaml2uml]
26
26
 
27
27
  spec.add_runtime_dependency "hashie", "~> 4.1.0"
28
- spec.add_runtime_dependency "parslet", "~> 1.7.1"
28
+ spec.add_runtime_dependency "parslet", "~> 2.0.0"
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"
@@ -0,0 +1,34 @@
1
+ diagram MyView {
2
+ title "my diagram"
3
+
4
+ class AddressClassProfile {
5
+ addressClassProfile
6
+ }
7
+ class AttributeProfile {
8
+ attributeProfile
9
+ }
10
+
11
+ association BidirectionalAsscoiation {
12
+ owner_type aggregation
13
+ member_type direct
14
+ owner AddressClassProfile#addressClassProfile
15
+ member AttributeProfile#attributeProfile [0..*]
16
+ }
17
+
18
+ association DirectAsscoiation {
19
+ member_type direct
20
+ owner AddressClassProfile
21
+ member AttributeProfile#attributeProfile
22
+ }
23
+
24
+ class Foo {
25
+ +structuredidentifier[0..*]: StructuredIdentifierType
26
+ +technicalcommittee[1..*]: TechnicalCommitteeType
27
+ }
28
+
29
+ association ReverseAsscoiation {
30
+ owner_type aggregation
31
+ owner AddressClassProfile#addressClassProfile
32
+ member AttributeProfile
33
+ }
34
+ }
@@ -1,5 +1,6 @@
1
1
  diagram MyView {
2
2
  fontname "Arial"
3
- title "my diagram"
3
+ title "my diagram, another symbols: text."
4
4
  class Foo {}
5
+ caption "Block elements of StandardDocument, adapted from BasicDocument. Another - symbol"
5
6
  }
@@ -0,0 +1,6 @@
1
+ diagram MyView {
2
+ class ImageMapAreaType {
3
+ definition {
4
+ }
5
+ }
6
+ }
@@ -0,0 +1,8 @@
1
+ diagram MyView {
2
+ class ImageMapAreaType {
3
+ }
4
+ enum SomeEnum {
5
+ }
6
+ data_type SomeEnum {
7
+ }
8
+ }
@@ -0,0 +1,5 @@
1
+ diagram MyView {
2
+ title "my diagram"
3
+
4
+ ** include ../models/bipm_document/BipmCommitteeAcronym.lutaml
5
+ }
@@ -0,0 +1,6 @@
1
+ diagram MyView {
2
+ fontname "Arial"
3
+ title "my diagram"
4
+ include none_existing.lutaml
5
+ include none_existing1.lutaml
6
+ }
@@ -34,7 +34,9 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
34
34
 
35
35
  it "creates Lutaml::Uml::Document object and sets its attributes" do
36
36
  expect(parse).to be_instance_of(Lutaml::Uml::Document)
37
- expect(parse.title).to eq("my diagram")
37
+ expect(parse.title).to eq("my diagram, another symbols: text.")
38
+ expect(parse.caption)
39
+ .to(eq("Block elements of StandardDocument, adapted from BasicDocument. Another - symbol"))
38
40
  expect(parse.fontname).to eq("Arial")
39
41
  end
40
42
 
@@ -287,5 +289,57 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
287
289
 
288
290
  it_behaves_like "the correct graphviz formatting"
289
291
  end
292
+
293
+ context "when defninition is blank" do
294
+ let(:content) do
295
+ File.new(fixtures_path("dsl/diagram_blank_definion.lutaml"))
296
+ end
297
+
298
+ it "successfully renders" do
299
+ expect { parse }.to_not(raise_error)
300
+ end
301
+ end
302
+
303
+ context "when there are blank definitions" do
304
+ let(:content) do
305
+ File.new(fixtures_path("dsl/diagram_blank_entities.lutaml"))
306
+ end
307
+
308
+ it "successfully renders" do
309
+ expect { parse }.to_not(raise_error)
310
+ end
311
+ end
312
+
313
+ context "when its a non existing include file" do
314
+ let(:content) do
315
+ File.new(fixtures_path("dsl/diagram_non_existing_include.lutaml"))
316
+ end
317
+
318
+ it "successfully renders" do
319
+ expect { parse }.to_not(raise_error)
320
+ end
321
+ end
322
+
323
+ context "when there are commented preprocessor lines" do
324
+ let(:content) do
325
+ File.new(fixtures_path("dsl/diagram_commented_includes.lutaml"))
326
+ end
327
+
328
+ it "successfully renders" do
329
+ expect { parse }.to_not(raise_error)
330
+ end
331
+ end
332
+
333
+ context "when broken lutaml file passed" do
334
+ let(:content) do
335
+ File.new(fixtures_path("dsl/broken_diagram.lutaml"))
336
+ end
337
+
338
+ it "returns error object and prints line number" do
339
+ expect { described_class.parse(content, {}) }
340
+ .to(raise_error(Lutaml::Uml::Parsers::ParsingError,
341
+ /but got ":" at line 25 char 32/))
342
+ end
343
+ end
290
344
  end
291
345
  end
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.3.1
4
+ version: 0.4.3
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-04-14 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.1
33
+ version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.7.1
40
+ version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby-graphviz
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -206,6 +206,7 @@ files:
206
206
  - lib/lutaml/uml/constructor_end.rb
207
207
  - lib/lutaml/uml/data_type.rb
208
208
  - lib/lutaml/uml/dependency.rb
209
+ - lib/lutaml/uml/diagram.rb
209
210
  - lib/lutaml/uml/document.rb
210
211
  - lib/lutaml/uml/enum.rb
211
212
  - lib/lutaml/uml/event.rb
@@ -228,6 +229,7 @@ files:
228
229
  - lib/lutaml/uml/node/method_argument.rb
229
230
  - lib/lutaml/uml/node/relationship.rb
230
231
  - lib/lutaml/uml/opaque_behavior.rb
232
+ - lib/lutaml/uml/operation.rb
231
233
  - lib/lutaml/uml/package.rb
232
234
  - lib/lutaml/uml/parsers/attribute.rb
233
235
  - lib/lutaml/uml/parsers/dsl.rb
@@ -251,6 +253,7 @@ files:
251
253
  - lib/lutaml/uml/top_element_attribute.rb
252
254
  - lib/lutaml/uml/transition.rb
253
255
  - lib/lutaml/uml/trigger.rb
256
+ - lib/lutaml/uml/value.rb
254
257
  - lib/lutaml/uml/version.rb
255
258
  - lib/lutaml/uml/vertex.rb
256
259
  - lutaml-uml.gemspec
@@ -276,16 +279,21 @@ files:
276
279
  - spec/fixtures/datamodel/views/AddressProfile.yml
277
280
  - spec/fixtures/datamodel/views/CommonModels.yml
278
281
  - spec/fixtures/datamodel/views/TopDown.yml
282
+ - spec/fixtures/dsl/broken_diagram.lutaml
279
283
  - spec/fixtures/dsl/diagram.lutaml
280
284
  - spec/fixtures/dsl/diagram_attributes.lutaml
285
+ - spec/fixtures/dsl/diagram_blank_definion.lutaml
286
+ - spec/fixtures/dsl/diagram_blank_entities.lutaml
281
287
  - spec/fixtures/dsl/diagram_class_assocation.lutaml
282
288
  - spec/fixtures/dsl/diagram_class_fields.lutaml
289
+ - spec/fixtures/dsl/diagram_commented_includes.lutaml
283
290
  - spec/fixtures/dsl/diagram_comments.lutaml
284
291
  - spec/fixtures/dsl/diagram_concept_model.lutaml
285
292
  - spec/fixtures/dsl/diagram_data_types.lutaml
286
293
  - spec/fixtures/dsl/diagram_definitions.lutaml
287
294
  - spec/fixtures/dsl/diagram_includes.lutaml
288
295
  - spec/fixtures/dsl/diagram_multiply_classes.lutaml
296
+ - spec/fixtures/dsl/diagram_non_existing_include.lutaml
289
297
  - spec/fixtures/dsl/shared.lutaml
290
298
  - spec/fixtures/dsl/shared1.lutaml
291
299
  - spec/fixtures/generated_dot/AddressClassProfile.dot
@@ -319,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
327
  - !ruby/object:Gem::Version
320
328
  version: '0'
321
329
  requirements: []
322
- rubygems_version: 3.0.3
330
+ rubygems_version: 3.1.6
323
331
  signing_key:
324
332
  specification_version: 4
325
333
  summary: UML model module for LutaML.