lutaml-uml 0.4.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +22 -0
- data/Gemfile +1 -5
- data/README.adoc +4 -42
- data/Rakefile +0 -5
- data/lutaml-uml.gemspec +23 -38
- metadata +20 -292
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -40
- data/.github/workflows/windows.yml +0 -51
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.travis.yml +0 -6
- data/CODE_OF_CONDUCT.md +0 -74
- data/LUTAML.adoc +0 -372
- data/bin/console +0 -15
- data/bin/folder_yaml2lutaml.sh +0 -6
- data/bin/plantuml2lutaml +0 -59
- data/bin/setup +0 -8
- data/bin/yaml2lutaml +0 -144
- data/exe/lutaml-wsd2uml +0 -59
- data/exe/lutaml-yaml2uml +0 -144
- data/lib/lutaml/layout/engine.rb +0 -15
- data/lib/lutaml/layout/graph_viz_engine.rb +0 -19
- data/lib/lutaml/uml/abstraction.rb +0 -11
- data/lib/lutaml/uml/activity.rb +0 -11
- data/lib/lutaml/uml/actor.rb +0 -19
- data/lib/lutaml/uml/association.rb +0 -43
- data/lib/lutaml/uml/behavior.rb +0 -11
- data/lib/lutaml/uml/class.rb +0 -83
- data/lib/lutaml/uml/classifier.rb +0 -11
- data/lib/lutaml/uml/connector.rb +0 -21
- data/lib/lutaml/uml/constraint.rb +0 -12
- data/lib/lutaml/uml/constructor_end.rb +0 -16
- data/lib/lutaml/uml/data_type.rb +0 -75
- data/lib/lutaml/uml/dependency.rb +0 -21
- data/lib/lutaml/uml/diagram.rb +0 -8
- data/lib/lutaml/uml/document.rb +0 -81
- data/lib/lutaml/uml/enum.rb +0 -45
- data/lib/lutaml/uml/event.rb +0 -12
- data/lib/lutaml/uml/final_state.rb +0 -11
- data/lib/lutaml/uml/formatter/base.rb +0 -67
- data/lib/lutaml/uml/formatter/graphviz.rb +0 -334
- data/lib/lutaml/uml/formatter.rb +0 -21
- data/lib/lutaml/uml/has_attributes.rb +0 -14
- data/lib/lutaml/uml/has_members.rb +0 -30
- data/lib/lutaml/uml/instance.rb +0 -17
- data/lib/lutaml/uml/model.rb +0 -13
- data/lib/lutaml/uml/node/base.rb +0 -21
- data/lib/lutaml/uml/node/class_node.rb +0 -57
- data/lib/lutaml/uml/node/class_relationship.rb +0 -14
- data/lib/lutaml/uml/node/document.rb +0 -18
- data/lib/lutaml/uml/node/field.rb +0 -34
- data/lib/lutaml/uml/node/has_name.rb +0 -15
- data/lib/lutaml/uml/node/has_type.rb +0 -15
- data/lib/lutaml/uml/node/method.rb +0 -29
- data/lib/lutaml/uml/node/method_argument.rb +0 -16
- data/lib/lutaml/uml/node/relationship.rb +0 -28
- data/lib/lutaml/uml/opaque_behavior.rb +0 -11
- data/lib/lutaml/uml/operation.rb +0 -31
- data/lib/lutaml/uml/package.rb +0 -53
- data/lib/lutaml/uml/parsers/attribute.rb +0 -70
- data/lib/lutaml/uml/parsers/dsl.rb +0 -413
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +0 -59
- data/lib/lutaml/uml/parsers/dsl_transform.rb +0 -27
- data/lib/lutaml/uml/parsers/yaml.rb +0 -46
- data/lib/lutaml/uml/port.rb +0 -8
- data/lib/lutaml/uml/primitive_type.rb +0 -14
- data/lib/lutaml/uml/property.rb +0 -27
- data/lib/lutaml/uml/pseudostate.rb +0 -11
- data/lib/lutaml/uml/realization.rb +0 -11
- data/lib/lutaml/uml/region.rb +0 -12
- data/lib/lutaml/uml/serializers/association.rb +0 -58
- data/lib/lutaml/uml/serializers/base.rb +0 -16
- data/lib/lutaml/uml/serializers/class.rb +0 -29
- data/lib/lutaml/uml/serializers/top_element_attribute.rb +0 -14
- data/lib/lutaml/uml/serializers/yaml_view.rb +0 -18
- data/lib/lutaml/uml/state.rb +0 -12
- data/lib/lutaml/uml/state_machine.rb +0 -12
- data/lib/lutaml/uml/top_element.rb +0 -58
- data/lib/lutaml/uml/top_element_attribute.rb +0 -38
- data/lib/lutaml/uml/transition.rb +0 -12
- data/lib/lutaml/uml/trigger.rb +0 -12
- data/lib/lutaml/uml/value.rb +0 -30
- data/lib/lutaml/uml/version.rb +0 -7
- data/lib/lutaml/uml/vertex.rb +0 -11
- data/lib/lutaml/uml.rb +0 -13
- data/spec/fixtures/datamodel/models/AddressClassProfile.yml +0 -90
- data/spec/fixtures/datamodel/models/AddressComponentProfile.yml +0 -63
- data/spec/fixtures/datamodel/models/AddressComponentSpecification.yml +0 -15
- data/spec/fixtures/datamodel/models/AddressProfile.yml +0 -36
- data/spec/fixtures/datamodel/models/AttributeProfile.yml +0 -32
- data/spec/fixtures/datamodel/models/InterchangeAddressClassProfile.yml +0 -79
- data/spec/fixtures/datamodel/models/Localization copy.yml +0 -23
- data/spec/fixtures/datamodel/models/Localization.yml +0 -23
- data/spec/fixtures/datamodel/models/ProfileCompliantAddress.yml +0 -36
- data/spec/fixtures/datamodel/models/ProfileCompliantAddressComponent.yml +0 -15
- data/spec/fixtures/datamodel/models/Signature.yml +0 -20
- data/spec/fixtures/datamodel/models/SignatureBlankDefinition.yml +0 -20
- data/spec/fixtures/datamodel/models/TextDirectionCode copy.yml +0 -16
- data/spec/fixtures/datamodel/models/TextDirectionCode.yml +0 -16
- data/spec/fixtures/datamodel/models/Validity.yml +0 -14
- data/spec/fixtures/datamodel/models/iso19160-1/Address.yml +0 -22
- data/spec/fixtures/datamodel/models/iso19160-1/AddressComponent.yml +0 -2
- data/spec/fixtures/datamodel/style.uml.inc +0 -37
- data/spec/fixtures/datamodel/views/AddressClassProfile.yml +0 -12
- data/spec/fixtures/datamodel/views/AddressProfile.yml +0 -3
- data/spec/fixtures/datamodel/views/CommonModels.yml +0 -9
- data/spec/fixtures/datamodel/views/TopDown.yml +0 -62
- data/spec/fixtures/dsl/broken_diagram.lutaml +0 -34
- data/spec/fixtures/dsl/diagram.lutaml +0 -3
- data/spec/fixtures/dsl/diagram_attributes.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_blank_definion.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_blank_entities.lutaml +0 -8
- data/spec/fixtures/dsl/diagram_class_assocation.lutaml +0 -29
- data/spec/fixtures/dsl/diagram_class_fields.lutaml +0 -25
- data/spec/fixtures/dsl/diagram_commented_includes.lutaml +0 -5
- data/spec/fixtures/dsl/diagram_comments.lutaml +0 -28
- data/spec/fixtures/dsl/diagram_concept_model.lutaml +0 -132
- data/spec/fixtures/dsl/diagram_data_types.lutaml +0 -44
- data/spec/fixtures/dsl/diagram_definitions.lutaml +0 -25
- data/spec/fixtures/dsl/diagram_includes.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_multiply_classes.lutaml +0 -7
- data/spec/fixtures/dsl/diagram_non_existing_include.lutaml +0 -6
- data/spec/fixtures/dsl/shared.lutaml +0 -3
- data/spec/fixtures/dsl/shared1.lutaml +0 -4
- data/spec/fixtures/generated_dot/AddressClassProfile.dot +0 -170
- data/spec/fixtures/generated_dot/AddressProfile.dot +0 -34
- data/spec/lutaml/layout/graph_viz_engine_spec.rb +0 -31
- data/spec/lutaml/uml/formatter/graphviz_spec.rb +0 -41
- data/spec/lutaml/uml/parsers/dsl_spec.rb +0 -345
- data/spec/lutaml/uml/parsers/yaml_spec.rb +0 -18
- data/spec/lutaml/uml/serializers/yaml_view_spec.rb +0 -20
- data/spec/lutaml/uml_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -25
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at ronald.tse@ribose.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: https://contributor-covenant.org
|
74
|
-
[version]: https://contributor-covenant.org/version/1/4/
|
data/LUTAML.adoc
DELETED
@@ -1,372 +0,0 @@
|
|
1
|
-
= LutaML syntax
|
2
|
-
|
3
|
-
== `diagram` syntax
|
4
|
-
|
5
|
-
`diagram` is a root element for each diagram.
|
6
|
-
|
7
|
-
[source,java]
|
8
|
-
----
|
9
|
-
diagram MyView {
|
10
|
-
title "My diagram"
|
11
|
-
caption "My custom caption"
|
12
|
-
fontname "Helvetica"
|
13
|
-
}
|
14
|
-
----
|
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
|
-
|
22
|
-
== DataTypes
|
23
|
-
|
24
|
-
Lutaml supports 3 types of data_types: `data_type`, `primitive` and `enum`.
|
25
|
-
|
26
|
-
Example of data types declaration:
|
27
|
-
|
28
|
-
[source,java]
|
29
|
-
----
|
30
|
-
diagram MyView {
|
31
|
-
enum MyEnum {}
|
32
|
-
|
33
|
-
enum AddressClassProfile {
|
34
|
-
+addressClassProfile: CharacterString
|
35
|
-
}
|
36
|
-
|
37
|
-
data_type "Banking Information" {
|
38
|
-
"art code"
|
39
|
-
"CCT Number"
|
40
|
-
}
|
41
|
-
|
42
|
-
primitive Integer
|
43
|
-
|
44
|
-
enum Profile {
|
45
|
-
imlicistAttributeProfile: CharacterString
|
46
|
-
+attributeProfile: CharacterString
|
47
|
-
-privateAttributeProfile: CharacterString
|
48
|
-
~friendlyAttributeProfile: CharacterString
|
49
|
-
#protectedAttributeProfile: CharacterString
|
50
|
-
}
|
51
|
-
}
|
52
|
-
----
|
53
|
-
|
54
|
-
== Associations
|
55
|
-
|
56
|
-
=== Explicit declaration
|
57
|
-
|
58
|
-
Syntax:
|
59
|
-
|
60
|
-
[source,java]
|
61
|
-
----
|
62
|
-
association name {
|
63
|
-
owned_type association|composition|aggregation|generalization|uses
|
64
|
-
member_type association|composition|aggregation|generalization|uses
|
65
|
-
owned association_name[#attribute_name] [{property_string}][cardinality]
|
66
|
-
member association_name[#attribute_name] [{property_string}][cardinality]
|
67
|
-
}
|
68
|
-
----
|
69
|
-
|
70
|
-
where:
|
71
|
-
|
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`)
|
74
|
-
* `owned|member` - end of association, use `\#attribute_name` to set a role name
|
75
|
-
* `property_string` - property string for attibutes associations
|
76
|
-
* `cardinality` - examples: '1..*', '*'
|
77
|
-
|
78
|
-
Example:
|
79
|
-
|
80
|
-
[source,java]
|
81
|
-
----
|
82
|
-
class Association {
|
83
|
-
+association:
|
84
|
-
}
|
85
|
-
class Type {
|
86
|
-
+endType:
|
87
|
-
}
|
88
|
-
|
89
|
-
association AssociatingTypeAndAssociation {
|
90
|
-
type uses
|
91
|
-
from Association#+association {subsets relationship}[*]
|
92
|
-
to Type#+/endType {readOnly, subsets relatedElement} [1..*]
|
93
|
-
}
|
94
|
-
----
|
95
|
-
|
96
|
-
=== Undirected associations
|
97
|
-
|
98
|
-
The simplest way to define relationship between two classes is to use `generalize` keyword:
|
99
|
-
|
100
|
-
[source,java]
|
101
|
-
----
|
102
|
-
class Pet {}
|
103
|
-
class Cat {
|
104
|
-
generalize Pet
|
105
|
-
}
|
106
|
-
----
|
107
|
-
|
108
|
-
=== Attribute relationship
|
109
|
-
|
110
|
-
Derived attribute `relatedElement` can have 1 to many `Element` associated with it through `union`
|
111
|
-
|
112
|
-
[source,java]
|
113
|
-
----
|
114
|
-
class Relationship {
|
115
|
-
+/relatedElement: Element[1..*] {union}
|
116
|
-
}
|
117
|
-
class Element {}
|
118
|
-
----
|
119
|
-
|
120
|
-
== Class' multiline "definition" property
|
121
|
-
|
122
|
-
=== Definition
|
123
|
-
|
124
|
-
Full syntax:
|
125
|
-
|
126
|
-
[source,java]
|
127
|
-
----
|
128
|
-
definition {
|
129
|
-
inner text
|
130
|
-
}
|
131
|
-
----
|
132
|
-
|
133
|
-
|
134
|
-
== Attributes/entries
|
135
|
-
|
136
|
-
=== Definition
|
137
|
-
|
138
|
-
Full syntax:
|
139
|
-
|
140
|
-
[source,java]
|
141
|
-
----
|
142
|
-
[visibility][/][attribute] name [:type][multiplicity][=initial value][{attribute body}]
|
143
|
-
----
|
144
|
-
|
145
|
-
where:
|
146
|
-
|
147
|
-
* `visibility` can be equal to
|
148
|
-
** `-`: private
|
149
|
-
** `+`: public
|
150
|
-
** `#`: protected
|
151
|
-
** `~`: friendly
|
152
|
-
|
153
|
-
* `attribute` - attrbute keyword
|
154
|
-
* `/` - symbolizes a derived attribute.
|
155
|
-
* `multiplicity` - Multiplicity is in square brackets (e.g. [1..*]).
|
156
|
-
* `initial value` - Default value specifies the initial value of the attribute.
|
157
|
-
* `{attribute body}` - Body of attribute, additional properties for attribute
|
158
|
-
|
159
|
-
|
160
|
-
One can use explicit or implicit syntax for attribute definition
|
161
|
-
|
162
|
-
explicit syntax:
|
163
|
-
|
164
|
-
[source,java]
|
165
|
-
----
|
166
|
-
class A {
|
167
|
-
attribute my_attribute
|
168
|
-
}
|
169
|
-
|
170
|
-
enum A {
|
171
|
-
entry my_val2
|
172
|
-
}
|
173
|
-
----
|
174
|
-
|
175
|
-
implicit syntax:
|
176
|
-
|
177
|
-
[source,java]
|
178
|
-
----
|
179
|
-
class A {
|
180
|
-
my_attribute
|
181
|
-
}
|
182
|
-
|
183
|
-
enum A {
|
184
|
-
my_val2
|
185
|
-
}
|
186
|
-
----
|
187
|
-
|
188
|
-
[[attribute-visibility]]
|
189
|
-
=== Attribute visibility
|
190
|
-
|
191
|
-
Syntax for defining visibility: `[+|-|#|~] [attribute] attribute_name`.
|
192
|
-
|
193
|
-
LutaML uses these modificators to define attribute (entry) visbility:
|
194
|
-
|
195
|
-
`+`:: public
|
196
|
-
`-`:: private
|
197
|
-
`#`:: protected
|
198
|
-
`~`:: package
|
199
|
-
|
200
|
-
example:
|
201
|
-
|
202
|
-
[source,java]
|
203
|
-
----
|
204
|
-
class Figure {
|
205
|
-
// Public attribute `radius`
|
206
|
-
+ radius
|
207
|
-
// private attribute `filled`
|
208
|
-
- filled
|
209
|
-
// protected attribute `length`
|
210
|
-
# length
|
211
|
-
}
|
212
|
-
----
|
213
|
-
|
214
|
-
=== Additional attribute' properties
|
215
|
-
|
216
|
-
example:
|
217
|
-
|
218
|
-
[source,java]
|
219
|
-
----
|
220
|
-
class Figure {
|
221
|
-
+ radius {
|
222
|
-
definition {
|
223
|
-
Radius of the Figure
|
224
|
-
}
|
225
|
-
}
|
226
|
-
}
|
227
|
-
----
|
228
|
-
|
229
|
-
== Methods
|
230
|
-
|
231
|
-
Syntax for defining methods:
|
232
|
-
|
233
|
-
[source,java]
|
234
|
-
----
|
235
|
-
[visbility] method-name (parameter-list): return type {property-modifier}
|
236
|
-
----
|
237
|
-
|
238
|
-
where:
|
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`)
|
253
|
-
|
254
|
-
Syntax for a `parameter-list`:
|
255
|
-
|
256
|
-
[source,java]
|
257
|
-
----
|
258
|
-
[direction] name:type [multiplicity] [=default] [{property string}]
|
259
|
-
----
|
260
|
-
|
261
|
-
where:
|
262
|
-
|
263
|
-
* `direction` can be equal to
|
264
|
-
** `in`
|
265
|
-
** `out`
|
266
|
-
** `inout`
|
267
|
-
** `return`
|
268
|
-
|
269
|
-
== import files
|
270
|
-
|
271
|
-
Use `include` special word:
|
272
|
-
|
273
|
-
[source,java]
|
274
|
-
----
|
275
|
-
include path/to/file
|
276
|
-
----
|
277
|
-
|
278
|
-
== Package syntax
|
279
|
-
|
280
|
-
Namespaces
|
281
|
-
|
282
|
-
A named element is an element that can have a name and a defined visibility (public, private, protected, package):
|
283
|
-
|
284
|
-
[source,java]
|
285
|
-
----
|
286
|
-
+ => public
|
287
|
-
- => private
|
288
|
-
# => protected
|
289
|
-
~ => package
|
290
|
-
----
|
291
|
-
|
292
|
-
The name of the element and its visibility are optional.
|
293
|
-
|
294
|
-
[source,java]
|
295
|
-
----
|
296
|
-
package Customers {
|
297
|
-
class Insurance {}
|
298
|
-
- class PrivateInsurance {}
|
299
|
-
# class ProtectedInsurance {}
|
300
|
-
}
|
301
|
-
----
|
302
|
-
|
303
|
-
== Code comments
|
304
|
-
|
305
|
-
Use `//` notation for LutaML comments skipped by parser, example:
|
306
|
-
|
307
|
-
[source,java]
|
308
|
-
----
|
309
|
-
// TODO: implement
|
310
|
-
abstract class Pet {}
|
311
|
-
----
|
312
|
-
|
313
|
-
== Comment objects diagram
|
314
|
-
|
315
|
-
Use `\**`(one line comment) or `*| |*`(multiline comment) to create comment object for diagram entry.
|
316
|
-
|
317
|
-
If this syntax is used inside a `class`/`enum`/`association` block, it will be created for owner of this block.
|
318
|
-
|
319
|
-
[source,java]
|
320
|
-
----
|
321
|
-
** I am a document comment
|
322
|
-
|
323
|
-
*|
|
324
|
-
This is a
|
325
|
-
multiply
|
326
|
-
lines document comment.
|
327
|
-
*|
|
328
|
-
|
329
|
-
class A
|
330
|
-
enum B {
|
331
|
-
** one line enum comment
|
332
|
-
foo
|
333
|
-
*|
|
334
|
-
This is a
|
335
|
-
multiply
|
336
|
-
lines class comment.
|
337
|
-
*|
|
338
|
-
bar
|
339
|
-
}
|
340
|
-
----
|
341
|
-
|
342
|
-
== Syntax comments
|
343
|
-
|
344
|
-
Use `//` to create syntax comment, chars after `//` will be ignored during processing.
|
345
|
-
|
346
|
-
[source,java]
|
347
|
-
----
|
348
|
-
// TODO: attributes
|
349
|
-
class A
|
350
|
-
enum B {
|
351
|
-
// Write docs
|
352
|
-
foo
|
353
|
-
bar
|
354
|
-
}
|
355
|
-
----
|
356
|
-
|
357
|
-
== Value specification
|
358
|
-
|
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`
|
360
|
-
|
361
|
-
[source,java]
|
362
|
-
----
|
363
|
-
class {Class name, if any} {as ref name, optional} {
|
364
|
-
{attribute name} = {attribute value}
|
365
|
-
{attribute name}:{attribute class} = {attribute value}
|
366
|
-
}
|
367
|
-
|
368
|
-
instance :{Class name, if any} {as ref name, optional} {
|
369
|
-
{attribute name} = {attribute value}
|
370
|
-
{attribute name}:{attribute class} = {attribute value}
|
371
|
-
}
|
372
|
-
----
|
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "lutaml/uml"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|
data/bin/folder_yaml2lutaml.sh
DELETED
data/bin/plantuml2lutaml
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# Script to convert plantuml files into LutaML syntax
|
6
|
-
# Usage: bin/plantuml2lutaml /path/to/plantuml.wsd
|
7
|
-
|
8
|
-
file_path = ARGV[0]
|
9
|
-
FILE_NAME = File.basename(file_path, ".wsd")
|
10
|
-
wsd_file = File.new(ARGV[0])
|
11
|
-
|
12
|
-
def sync_puts(line, level = 0)
|
13
|
-
$stdout.puts("#{''.rjust(level)}#{line}")
|
14
|
-
$stdout.flush
|
15
|
-
end
|
16
|
-
|
17
|
-
SKIPPED_LINES_REGEXP = /^(@startuml|'\*{7}|note|@enduml|\!|'\/)/
|
18
|
-
COMMENT_START = /\/'/
|
19
|
-
COMMENT_END = /'\//
|
20
|
-
ASSOCIATION_MAPPINGS = {
|
21
|
-
/-\|>/ => ",inheritance",
|
22
|
-
/<\|-/ => "inheritance,",
|
23
|
-
/->/ => ",direct",
|
24
|
-
/<-/ => "direct,",
|
25
|
-
}.freeze
|
26
|
-
|
27
|
-
in_comment_block = false
|
28
|
-
|
29
|
-
def transform_line(line)
|
30
|
-
line = line.gsub(/^\s*'/, '** ').gsub(/\|[\sa-zA-Z]+$/, '')
|
31
|
-
return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? { |key| line =~ key }
|
32
|
-
|
33
|
-
owner_type, member_type = ASSOCIATION_MAPPINGS.detect { |(key, _value)| line =~ key }.last.split(",")
|
34
|
-
blocks = line.split(" ")
|
35
|
-
owner = blocks.first
|
36
|
-
member = blocks.last
|
37
|
-
sync_puts("association {", 2)
|
38
|
-
sync_puts("owner #{owner}", 4)
|
39
|
-
sync_puts("member #{member}", 4)
|
40
|
-
sync_puts("owner_type #{owner_type}", 4) if !owner_type.to_s.empty?
|
41
|
-
sync_puts("member_type #{member_type}", 4) if !member_type.to_s.empty?
|
42
|
-
sync_puts("}", 2)
|
43
|
-
end
|
44
|
-
|
45
|
-
sync_puts("diagram #{FILE_NAME} {")
|
46
|
-
wsd_file.readlines.each do |line|
|
47
|
-
if line.match?(COMMENT_START)
|
48
|
-
in_comment_block = true
|
49
|
-
end
|
50
|
-
|
51
|
-
if line.match?(COMMENT_END)
|
52
|
-
in_comment_block = false
|
53
|
-
end
|
54
|
-
|
55
|
-
next if in_comment_block || line =~ SKIPPED_LINES_REGEXP
|
56
|
-
|
57
|
-
transform_line(line)
|
58
|
-
end
|
59
|
-
sync_puts("}")
|
data/bin/setup
DELETED
data/bin/yaml2lutaml
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# Script to convert datamodel yaml files into LutaML syntax
|
6
|
-
# Usage: bin/yaml2lutaml /path/to/datamodel/view/file.yml
|
7
|
-
|
8
|
-
require "yaml"
|
9
|
-
|
10
|
-
view_yaml = YAML.safe_load(File.read(ARGV[0]))
|
11
|
-
models_path = File.expand_path("../../models", ARGV[0])
|
12
|
-
|
13
|
-
def sync_puts(line, level = 0)
|
14
|
-
$stdout.puts("#{''.rjust(level)}#{line}")
|
15
|
-
$stdout.flush
|
16
|
-
end
|
17
|
-
|
18
|
-
encountered_relations = Hash.new { |h, key| h[key] = [] }
|
19
|
-
# relations:
|
20
|
-
# - target: AttributeProfile
|
21
|
-
# relationship:
|
22
|
-
# source:
|
23
|
-
# type: aggregation
|
24
|
-
# attribute:
|
25
|
-
# addressClassProfile:
|
26
|
-
# target:
|
27
|
-
# type: direct
|
28
|
-
# attribute:
|
29
|
-
# attributeProfile:
|
30
|
-
# cardinality:
|
31
|
-
# min: 0
|
32
|
-
# max: '*'
|
33
|
-
def process_association(owner, values, encountered_relations)
|
34
|
-
target_name = values["target"]
|
35
|
-
return if encountered_relations[owner].include?(target_name)
|
36
|
-
|
37
|
-
encountered_relations[owner].push(target_name)
|
38
|
-
sync_puts("association {", 2)
|
39
|
-
|
40
|
-
relationship_block = values["relationship"] || {}
|
41
|
-
|
42
|
-
if relationship_block["source"] && relationship_block["source"]["type"]
|
43
|
-
source = relationship_block["source"]
|
44
|
-
sync_puts("owner_type #{source['type']}", 4)
|
45
|
-
if source["attribute"]
|
46
|
-
source_attribute_name = source["attribute"].keys.first
|
47
|
-
owner += "##{source_attribute_name}"
|
48
|
-
if source["attribute"][source_attribute_name] && source["attribute"][source_attribute_name]["cardinality"]
|
49
|
-
cardinality = source["attribute"][source_attribute_name]["cardinality"]
|
50
|
-
owner += " [#{cardinality['min']}..#{cardinality['max']}]"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
sync_puts("owner #{owner}", 4)
|
55
|
-
|
56
|
-
member = target_name
|
57
|
-
if relationship_block["target"]
|
58
|
-
target = relationship_block["target"]
|
59
|
-
type = target["type"] || "direct"
|
60
|
-
sync_puts("member_type #{type}", 4)
|
61
|
-
if target["attribute"]
|
62
|
-
target_attribute_name = target["attribute"].keys.first
|
63
|
-
member += "##{target_attribute_name}"
|
64
|
-
if target["attribute"][target_attribute_name] && target["attribute"][target_attribute_name]["cardinality"]
|
65
|
-
cardinality = target["attribute"][target_attribute_name]["cardinality"]
|
66
|
-
member += " [#{cardinality['min']}..#{cardinality['max']}]"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
else
|
70
|
-
sync_puts("member_type direct", 4)
|
71
|
-
end
|
72
|
-
sync_puts("member #{member}", 4)
|
73
|
-
|
74
|
-
sync_puts("}", 2)
|
75
|
-
end
|
76
|
-
sync_puts("diagram #{File.basename(ARGV[0], 'yml')[0..-2]} {")
|
77
|
-
sync_puts("title '#{view_yaml['title']}'", 2)
|
78
|
-
sync_puts("caption '#{view_yaml['caption']}'", 2)
|
79
|
-
|
80
|
-
# Class associations notations
|
81
|
-
view_yaml["relations"]&.each do |values|
|
82
|
-
process_association(values["source"], values, encountered_relations)
|
83
|
-
end
|
84
|
-
|
85
|
-
view_yaml["imports"].keys.each do |entry|
|
86
|
-
import = YAML.safe_load(File.read(File.join(models_path, "#{entry}.yml")))
|
87
|
-
import_name = import["name"] || File.basename(entry)
|
88
|
-
# Class notation
|
89
|
-
sync_puts("#{import['modelType']} #{import_name} {", 2)
|
90
|
-
if import["definition"]
|
91
|
-
definition = <<~TEXT
|
92
|
-
definition {
|
93
|
-
#{import['definition']}
|
94
|
-
}
|
95
|
-
TEXT
|
96
|
-
sync_puts(definition, 4)
|
97
|
-
end
|
98
|
-
import["values"]&.each_pair do |key, values|
|
99
|
-
result_string = key
|
100
|
-
if values["definition"]
|
101
|
-
result_string += <<~TEXT
|
102
|
-
{
|
103
|
-
definition {
|
104
|
-
#{values['definition']}
|
105
|
-
}
|
106
|
-
}
|
107
|
-
TEXT
|
108
|
-
end
|
109
|
-
sync_puts(result_string, 4)
|
110
|
-
end
|
111
|
-
import["attributes"]&.each_pair do |key, values|
|
112
|
-
definition = values["definition"]
|
113
|
-
cardinality = if values["cardinality"]
|
114
|
-
cardinality_val = values["cardinality"]
|
115
|
-
"[#{cardinality_val['min']}..#{cardinality_val['max']}]"
|
116
|
-
else
|
117
|
-
""
|
118
|
-
end
|
119
|
-
result_string = "+#{key}"
|
120
|
-
if values["type"]
|
121
|
-
result_string += ": #{values['type']}"
|
122
|
-
end
|
123
|
-
if cardinality
|
124
|
-
result_string += " #{cardinality}"
|
125
|
-
end
|
126
|
-
if definition
|
127
|
-
result_string += <<~TEXT
|
128
|
-
{
|
129
|
-
definition
|
130
|
-
#{definition}
|
131
|
-
end definition
|
132
|
-
}
|
133
|
-
TEXT
|
134
|
-
end
|
135
|
-
sync_puts(result_string, 4)
|
136
|
-
end
|
137
|
-
sync_puts("}", 2)
|
138
|
-
|
139
|
-
# Associations notations
|
140
|
-
import["relations"]&.each do |values|
|
141
|
-
process_association(import_name, values, encountered_relations)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
sync_puts("}")
|