metanorma-plugin-lutaml 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +55 -35
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages.liquid +13 -7
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_class.liquid +11 -10
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary.liquid +26 -22
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_dictionary_classes.liquid +33 -11
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_data_type.liquid +10 -10
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_entity_list.liquid +7 -7
- data/lib/metanorma/plugin/lutaml/liquid_templates/_packages_enum.liquid +11 -10
- data/lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb +1 -1
- data/lib/metanorma/plugin/lutaml/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 202335c2a56ade17a5bdfedd489b6c39363b256ebbaa2e2cbfe812a6bb6995e5
|
4
|
+
data.tar.gz: 9637bc5a68bbbe8cda105e74a537ae7e41d5676f584e64e907ad26ba6cf50082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e183219067f431d7b839d59ab3e5c8a8b3f54b335cb1e232297f1fa997e7f7abafa4a0858d5398a034c2a025d46feef240f3e71b14db7730fb1789b2dd11afb
|
7
|
+
data.tar.gz: 400132cae1b7b1b3f03414f4c4ab8b16edde68ab285cd192bd0894d913bee26985182aaf880c2a4ddac1935541bac62913679424e433d88bacc8242c7fcabede
|
data/README.adoc
CHANGED
@@ -1,21 +1,36 @@
|
|
1
|
-
= metanorma-plugin-lutaml
|
1
|
+
= Metanorma LutaML plugin (metanorma-plugin-lutaml)
|
2
2
|
|
3
3
|
image:https://github.com/metanorma/metanorma-plugin-lutaml/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-plugin-lutaml/actions?workflow=rake"]
|
4
4
|
|
5
|
-
==
|
5
|
+
== Purpose
|
6
6
|
|
7
|
-
|
7
|
+
LutaML is a data model accessor that supports various data model formats,
|
8
|
+
including:
|
8
9
|
|
9
|
-
|
10
|
+
* EXPRESS (`*.exp` files)
|
11
|
+
* OMG UML in XMI format (`*.xmi` files)
|
12
|
+
|
13
|
+
This plugin allows you to access LutaML models from within a Metanorma document.
|
14
|
+
|
15
|
+
== Installation
|
10
16
|
|
11
17
|
[source,console]
|
12
18
|
----
|
13
19
|
$ gem install metanorma-plugin-lutaml
|
14
20
|
----
|
15
21
|
|
16
|
-
=== Usage, `lutaml` macro
|
17
22
|
|
18
|
-
|
23
|
+
== Usage with EXPRESS
|
24
|
+
|
25
|
+
=== General
|
26
|
+
|
27
|
+
LutaML supports accessing EXPRESS models via the
|
28
|
+
https://github.com/lutaml/expressir[Expressir] parser.
|
29
|
+
|
30
|
+
|
31
|
+
=== Usage of the `lutaml_express` EXPRESS macro
|
32
|
+
|
33
|
+
Given an `example.exp` EXPRESS file with the content:
|
19
34
|
|
20
35
|
[source,exp]
|
21
36
|
----
|
@@ -42,11 +57,11 @@ SCHEMA test_schema 'test';
|
|
42
57
|
END_SCHEMA;
|
43
58
|
----
|
44
59
|
|
45
|
-
And the `
|
60
|
+
And the `lutaml_express` macro block:
|
46
61
|
|
47
62
|
[source,adoc]
|
48
63
|
-----
|
49
|
-
[
|
64
|
+
[lutaml_express,example.exp,my_context]
|
50
65
|
----
|
51
66
|
|
52
67
|
{% for schema in my_context.schemas %}
|
@@ -67,13 +82,15 @@ Where:
|
|
67
82
|
* `{example.exp}` is the location of the EXPRESS schema file (`*.exp`) that
|
68
83
|
contains data to be loaded. Location of the file is computed relative to the
|
69
84
|
source directory that `[lutaml]` is used (e.g., if
|
70
|
-
`[
|
85
|
+
`[lutaml_express,example.exp,my_context]` is invoked in an `.adoc` file located at
|
71
86
|
`/foo/bar/doc.adoc`, the data file is expected to be found at
|
72
87
|
`/foo/bar/example.exp`);
|
73
88
|
|
74
|
-
* `{my_context}` is the name where the EXPRESS Repository read from the
|
75
|
-
file can be accessed with.
|
76
|
-
|
89
|
+
* `{my_context}` is the name where the EXPRESS Repository read from the `.exp`
|
90
|
+
file can be accessed with.
|
91
|
+
|
92
|
+
** The `context` object is a serialized `Expressir::Model::Repository` object
|
93
|
+
with all variable names available. See
|
77
94
|
https://github.com/lutaml/expressir[Expressir] docs for reference.
|
78
95
|
`{my_context}` has `schemas` method to access Expressir
|
79
96
|
https://github.com/lutaml/expressir/blob/master/lib/expressir/model/schema.rb[schemas]
|
@@ -121,7 +138,7 @@ Example of usage:
|
|
121
138
|
= Document title
|
122
139
|
Author
|
123
140
|
:lutaml-express-index: my_custom_name; /path/to/express_files; cache=/path/to/cache_file.yaml
|
124
|
-
[
|
141
|
+
[lutaml_express,my_custom_name,my_context]
|
125
142
|
----
|
126
143
|
{% for schema in my_context.schemas %}
|
127
144
|
== {{schema.id}}
|
@@ -142,7 +159,7 @@ diagram MyView {
|
|
142
159
|
enum AddressClassProfile {
|
143
160
|
imlicistAttributeProfile: CharacterString [0..1] {
|
144
161
|
definition
|
145
|
-
this is multiline with `
|
162
|
+
this is multiline with `asciidoc`
|
146
163
|
end definition
|
147
164
|
}
|
148
165
|
}
|
@@ -193,7 +210,7 @@ diagram MyView {
|
|
193
210
|
----
|
194
211
|
|
195
212
|
|
196
|
-
=== Usage
|
213
|
+
=== Usage of `lutaml_uml_attributes_table` macro
|
197
214
|
|
198
215
|
This macro allows to quickly render data model attributes/values tables.
|
199
216
|
|
@@ -246,7 +263,7 @@ Will produce this output:
|
|
246
263
|
|===
|
247
264
|
-----
|
248
265
|
|
249
|
-
In case of "enumeration"(AddressClassProfile) entity:
|
266
|
+
In case of "enumeration" (AddressClassProfile) entity:
|
250
267
|
|
251
268
|
[source,adoc]
|
252
269
|
-----
|
@@ -264,12 +281,12 @@ Will produce this output:
|
|
264
281
|
|===
|
265
282
|
|Name |Definition
|
266
283
|
|
267
|
-
|imlicistAttributeProfile |this is multiline with `
|
284
|
+
|imlicistAttributeProfile |this is multiline with `asciidoc`
|
268
285
|
|
269
286
|
|===
|
270
287
|
-----
|
271
288
|
|
272
|
-
=== Usage
|
289
|
+
=== Usage of `lutaml_uml_datamodel_description` macro
|
273
290
|
|
274
291
|
This macro allows to quickly render data model packages and its dependent
|
275
292
|
objects for supplied XMI file.
|
@@ -338,7 +355,7 @@ Where:
|
|
338
355
|
|
339
356
|
* `[.after, package="Another"]` - macro with text to be inserted before(after in case of `.before` name) the package
|
340
357
|
|
341
|
-
* `[.diagram_include_block]` - macro to automatically include diagram images. Attribute `base_path` is a required attribute to supply path prefix where to look for a
|
358
|
+
* `[.diagram_include_block]` - macro to automatically include diagram images. Attribute `base_path` is a required attribute to supply path prefix where to look for a diagram image. `format` is an optional attribute that tells what file extension to use when including diagram file. The logic is as follows:
|
342
359
|
[source,adoc]
|
343
360
|
-----
|
344
361
|
{% for diagram in package.diagrams %}
|
@@ -351,22 +368,23 @@ image::{{ image_base_path }}/{{ diagram.xmi_id }}.{{ format | default: 'png' }}[
|
|
351
368
|
{% endif %}
|
352
369
|
{% endfor %}
|
353
370
|
-----
|
354
|
-
|
371
|
+
|
372
|
+
For instance, the script will take package diagrams supplied in the XMI file and will try to include `image` with the name equal to diagram' xmi_id attribute plus `.png`. Also one can add any text to the macro text, it will be added as paragraph before each image include.
|
355
373
|
|
356
374
|
* `[.diagram_include_block, package="Another"]` - same as above, but diagram will be included only for supplied package name
|
357
375
|
|
358
|
-
* `[.include_block, base_path="spec/fixtures"]` - macro to
|
376
|
+
* `[.include_block, base_path="spec/fixtures"]` - macro to include files (`*.adoc` or `*.liquid`) for each package name. Attribute `base_path` is a required attribute to supply path prefix where to look for file to include. Macro will look for a file called `base_path` + `/` `_package_name`(downcase, replace : -> '', ' ' -> '_') + `.adoc`[`.liquid`], eg for package 'My Package name' and `base_path` eq to `my/path`, macro will look for the following file path: `my/path/_my_package_name.adoc`.
|
359
377
|
|
360
378
|
* `[.include_block, package="Another", base_path="spec/fixtures"]` - same as above, but include block will be included only for supplied package name
|
361
379
|
|
362
|
-
In addition to
|
380
|
+
In addition to the macros listed above that can be used only inside `lutaml_uml_datamodel_description` macro there is another macro called `lutaml_figure`. `lutaml_figure` is used to lookup and reference xmi package diagrams. The syntax is as follows:
|
363
381
|
|
364
382
|
[source,adoc]
|
365
383
|
-----
|
366
384
|
This is lutaml_figure::[package="Wrapper root package", name="Fig B1 Full model"] figure
|
367
385
|
-----
|
368
386
|
|
369
|
-
This code will be transformed into `<<figure-{diagram.xmi_id}>>` and will point to diagram figure. One can only use this macro when document rendered `lutaml_uml_datamodel_description` macro as it needs diagram lookup table in order to
|
387
|
+
This code will be transformed into `<<figure-{diagram.xmi_id}>>` and will point to diagram figure. One can only use this macro when document rendered `lutaml_uml_datamodel_description` macro as it needs diagram lookup table in order to reference package diagram.
|
370
388
|
|
371
389
|
Will produce this output:
|
372
390
|
|
@@ -380,18 +398,17 @@ Diagram text
|
|
380
398
|
|
381
399
|
[[figure-EAID_ACBB5EE3_3428_40f5_9C7C_E41923419F29]]
|
382
400
|
.CityGML Package Diagram
|
383
|
-
image::requirements
|
401
|
+
image::requirements/EAID_ACBB5EE3_3428_40f5_9C7C_E41923419F29.png[]
|
384
402
|
|
385
403
|
BuildingFurnitureFunctionValue is a code list that enumerates the different purposes of a BuildingFurniture.
|
386
404
|
|
387
405
|
[[figure-EAID_938AE961_1C57_4052_B964_997D1894A58D]]
|
388
406
|
.Use of ISO and OASIS standards in CityGML
|
389
|
-
image::requirements
|
407
|
+
image::requirements/EAID_938AE961_1C57_4052_B964_997D1894A58D.png[]
|
390
408
|
|
391
409
|
The CityGML package is organized into
|
392
410
|
2 packages with 1 modules:
|
393
411
|
|
394
|
-
[arabic]
|
395
412
|
. Another package
|
396
413
|
. CityTML package
|
397
414
|
|
@@ -401,18 +418,17 @@ Content for CityGML package
|
|
401
418
|
|
402
419
|
==== Defining tables
|
403
420
|
|
404
|
-
|
405
|
-
.<<tab-P-another-C-abstractatomictimeseries>> -- Elements of Another::AbstractAtomicTimeseries
|
421
|
+
.<<tab-P-another-C-{XMI_ID}>> -- Elements of “Another::AbstractAtomicTimeseries” (class)
|
406
422
|
|
407
|
-
[[tab-P-another-C-
|
408
|
-
.Elements of Another::AbstractAtomicTimeseries
|
423
|
+
[[tab-P-another-C-{XMI_ID}]]
|
424
|
+
.Elements of “Another::AbstractAtomicTimeseries” (class)
|
409
425
|
[width="100%",cols="a,a,a,a,a,a,a,a"]
|
410
426
|
|===
|
411
427
|
h|Name: 7+| AbstractAtomicTimeseries
|
412
428
|
h|Definition: 7+|
|
413
429
|
h|Stereotype: 7+| interface
|
414
430
|
h|Abstract: 7+|
|
415
|
-
|
431
|
+
h|Associations: 7+| (none)
|
416
432
|
.4+h|Public attributes:
|
417
433
|
| _Name_
|
418
434
|
2+| _Definition_
|
@@ -446,7 +462,7 @@ h|Constraints: 7+| (none)
|
|
446
462
|
text after CityGML package
|
447
463
|
-----
|
448
464
|
|
449
|
-
In addition to just supplying XMI file, this macro also supports YAML
|
465
|
+
In addition to just supplying an XMI file, this macro also supports a YAML
|
450
466
|
configuration file.
|
451
467
|
|
452
468
|
The format for using YAML is this:
|
@@ -480,10 +496,14 @@ NOTE: In this example, it is equal to the following regular expression: `/^Packa
|
|
480
496
|
Usage with macro:
|
481
497
|
|
482
498
|
[source,adoc]
|
483
|
-
|
499
|
+
--
|
484
500
|
[lutaml_uml_datamodel_description, path/to/example.xmi, path/to/config.yml]
|
485
|
-
|
486
|
-
|
501
|
+
----
|
502
|
+
[.diagram_include_block, base_path="models/Images", format="png"]
|
503
|
+
...
|
504
|
+
...
|
505
|
+
----
|
506
|
+
--
|
487
507
|
|
488
508
|
The macro processor will read supplied YAML file and arrange packages according
|
489
509
|
to the order supplied in the config file, also all packages supplied as `skip`
|
@@ -10,7 +10,11 @@
|
|
10
10
|
{% elsif is_package_spare == 'Spare' %}{% continue %}
|
11
11
|
{% endif %}
|
12
12
|
|
13
|
-
{% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
|
13
|
+
{% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}
|
14
|
+
|
15
|
+
[[lutaml-section-{{ package_name }}]]
|
16
|
+
{{equalsigns}} {{ package.name }} package
|
17
|
+
|
14
18
|
{{equalsigns}}= {{ package.name }} overview
|
15
19
|
|
16
20
|
{% assign before_package_key = 'before;' | append: package.name %}
|
@@ -28,7 +32,7 @@
|
|
28
32
|
{% if package.packages.size > 0 %}The {{ package.name }} package is organized into
|
29
33
|
{{ package.packages.size }} packages{% assign modules_nested_size = 0 %}{% for module in package.packages %}{% assign modules_nested_size = modules_nested_size | plus: module.packages.size %}{% endfor %}{% if modules_nested_size > 0 %} with {{modules_nested_size}} modules{% endif %}:
|
30
34
|
{% endif %}
|
31
|
-
|
35
|
+
|
32
36
|
{% for module in package.packages %}
|
33
37
|
{% if module.packages.length > 0 %}
|
34
38
|
. {{ module.name }} package comprises:
|
@@ -44,14 +48,14 @@
|
|
44
48
|
|
45
49
|
{{equalsigns}}= Defining tables
|
46
50
|
|
47
|
-
[arabic]
|
48
51
|
{% for klass in package.classes %}
|
49
52
|
{% assign is_klass_spare = klass.name | slice: 0,5 %}
|
50
53
|
{% if is_klass_spare == 'old: ' %}{% continue %}
|
51
54
|
{% elsif is_klass_spare == 'Spare' %}{% continue %}
|
52
55
|
{% endif %}
|
53
56
|
{% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
|
54
|
-
|
57
|
+
{% assign klass_xid = klass.xmi_id %}
|
58
|
+
.<<tab-P-{{ package_name }}-C-{{ klass_xid }}>> -- Elements of "{{ package.name }}::{{ klass.name }}"
|
55
59
|
|
56
60
|
{% endfor %}
|
57
61
|
{% for enum in package.enums %}
|
@@ -60,7 +64,8 @@
|
|
60
64
|
{% elsif is_enum_spare == 'Spare' %}{% continue %}
|
61
65
|
{% endif %}
|
62
66
|
{% assign enum_name = enum.name | downcase | replace: ':', '' | replace: ' ', '_' %}
|
63
|
-
|
67
|
+
{% assign enum_xid = enum.xmi_id %}
|
68
|
+
.<<tab-P-{{ package_name }}-E-{{ enum_xid }}>> -- Elements of "{{ package.name }}::{{ enum.name }}"
|
64
69
|
|
65
70
|
{% endfor %}
|
66
71
|
{% for data_type in package.data_types %}
|
@@ -69,7 +74,8 @@
|
|
69
74
|
{% elsif is_data_type_spare == 'Spare' %}{% continue %}
|
70
75
|
{% endif %}
|
71
76
|
{% assign data_type_name = data_type.name | downcase | replace: ':', '' | replace: ' ', '_' %}
|
72
|
-
|
77
|
+
{% assign data_type_xid = data_type.xmi_id %}
|
78
|
+
.<<tab-P-{{ package_name }}-DT-{{ data_type_xid }}>> -- Elements of "{{ package.name }}::{{ data_type.name }}"
|
73
79
|
|
74
80
|
{% endfor %}
|
75
81
|
|
@@ -116,7 +122,7 @@
|
|
116
122
|
|
117
123
|
{% assign after_package_key = 'after;' | append: package.name %}
|
118
124
|
{% if additional_context[after_package_key] %}
|
119
|
-
{{equalsigns}}= Additional
|
125
|
+
{{equalsigns}}= Additional information
|
120
126
|
{% for after in additional_context[after_package_key] %}
|
121
127
|
{{ after.text }}
|
122
128
|
{% endfor %}
|
@@ -3,8 +3,9 @@
|
|
3
3
|
{% elsif is_klass_spare == 'Spare' %}{% continue %}
|
4
4
|
{% endif %}
|
5
5
|
{% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
|
6
|
-
|
7
|
-
|
6
|
+
{% assign klass_xid = klass.xmi_id %}
|
7
|
+
[[tab-P-{{ package_name }}-C-{{ klass_xid }}]]
|
8
|
+
.Elements of "{{ package.name }}::{{ klass.name }}" (class)
|
8
9
|
[width="100%",cols="a,a,a,a,a,a,a,a"]
|
9
10
|
|===
|
10
11
|
|
@@ -24,14 +25,14 @@ h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
|
|
24
25
|
h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
|
25
26
|
{% endif %}
|
26
27
|
|
27
|
-
h|Abstract: 7+| {
|
28
|
+
h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
|
28
29
|
{% assign aggregations = klass.associations | where: "member_end_type", "aggregation" %}
|
29
30
|
{% if aggregations.size > 0 %}
|
30
31
|
.{{aggregations.size | plus: 1}}+h|Associations:
|
31
|
-
4+|_Association
|
32
|
-
|_Obligation_
|
32
|
+
4+| _Association with_
|
33
|
+
| _Obligation_
|
33
34
|
| _Maximum occurrence_
|
34
|
-
|
|
35
|
+
| _Provides_
|
35
36
|
|
36
37
|
{% for assoc in aggregations %}
|
37
38
|
4+| {{assoc.member_end}}
|
@@ -41,9 +42,9 @@ h|Abstract: 7+| {{ klass.is_abstract }}
|
|
41
42
|
|
42
43
|
{% endfor %}
|
43
44
|
{% else %}
|
44
|
-
|
45
|
-
.1+h|Associations: 7+| (none)
|
45
|
+
h| Associations: 7+| (none)
|
46
46
|
{% endif %}
|
47
|
+
|
47
48
|
{% if klass.attributes.size > 0 %}
|
48
49
|
.{{klass.attributes.size | plus: 1}}+h|Public attributes:
|
49
50
|
| _Name_
|
@@ -63,12 +64,12 @@ h|Abstract: 7+| {{ klass.is_abstract }}
|
|
63
64
|
|
64
65
|
{% endfor %}
|
65
66
|
{% else %}
|
66
|
-
|
67
|
+
h| Public attributes:
|
67
68
|
7+| (none)
|
68
69
|
{% endif %}
|
69
70
|
|
70
71
|
{% if klass.constraints.size > 0 %}
|
71
|
-
.{{ klass.constraints.size }}
|
72
|
+
.{{ klass.constraints.size }}+h| Constraints:
|
72
73
|
{% for constr in klass.constraints %}
|
73
74
|
7+| `{{ constr.body }}`
|
74
75
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|===
|
20
20
|
|
21
21
|
h|Description: | {{ package.definition }}
|
22
|
-
h|Parent
|
22
|
+
h|Parent package: | {{ context.name }}
|
23
23
|
h|Stereotype: | «{{ package.stereotype }}»
|
24
24
|
|
25
25
|
|===
|
@@ -37,7 +37,7 @@ h|Stereotype: | «{{ package.stereotype }}»
|
|
37
37
|
{% endif %}
|
38
38
|
|
39
39
|
{% if basic_types.size > 0 %}
|
40
|
-
{{equalsigns}}= Basic
|
40
|
+
{{equalsigns}}= Basic types
|
41
41
|
|
42
42
|
{% include "packages_data_dictionary_classes", classes: basic_types %}
|
43
43
|
{% endif %}
|
@@ -49,13 +49,13 @@ h|Stereotype: | «{{ package.stereotype }}»
|
|
49
49
|
{% endif %}
|
50
50
|
|
51
51
|
{% if code_lists.size > 0 %}
|
52
|
-
{{equalsigns}}= Code
|
52
|
+
{{equalsigns}}= Code lists
|
53
53
|
|
54
54
|
{% include "packages_data_dictionary_classes", classes: code_lists %}
|
55
55
|
{% endif %}
|
56
56
|
|
57
57
|
{% if package.data_types.size > 0 %}
|
58
|
-
{{equalsigns}}= Data
|
58
|
+
{{equalsigns}}= Data types
|
59
59
|
|
60
60
|
{% for data_type in package.data_types %}
|
61
61
|
{% capture generalizations %}{% for assoc in data_type.associations | where: "member_end_type", "generalization" %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
|
@@ -63,39 +63,41 @@ h|Stereotype: | «{{ package.stereotype }}»
|
|
63
63
|
[cols="1a"]
|
64
64
|
|===
|
65
65
|
|*{{ data_type.name }}*
|
66
|
-
|[cols="1,4"
|
66
|
+
|[cols="1,4"]
|
67
67
|
!===
|
68
|
-
!
|
69
|
-
!
|
70
|
-
!
|
68
|
+
!Definition: ! {{ data_type.definition }}
|
69
|
+
!Subclass of: ! {{ generalizations }}
|
70
|
+
!Stereotype: ! «DataType»
|
71
71
|
!===
|
72
72
|
{% if data_type.associations.size > 0 %}
|
73
73
|
{% capture rendered_associations %}
|
74
74
|
{% for assoc in data_type.associations %}
|
75
75
|
{% if assoc.member_end_attribute_name.size > 0 %}
|
76
76
|
{% capture cardinality %}{% if assoc.member_end_cardinality.min == 'C' %}[0..{{ assoc.member_end_cardinality.max }}]{% elsif assoc.member_end_cardinality.min == 'M' and assoc.member_end_cardinality.max == '1' %}[1..1]{% else %}[{{ assoc.member_end_cardinality.max }}]{% endif %}{% endcapture %}
|
77
|
-
!
|
77
|
+
! {{ assoc.member_end_attribute_name }} !<<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }} ! {{ assoc.definition }}
|
78
78
|
{% endif %}
|
79
79
|
{% endfor %}
|
80
80
|
{% endcapture %}
|
81
81
|
{% if rendered_associations.size > 0 %}
|
82
|
-
|
|
82
|
+
|
|
83
|
+
[cols="15,20,60",options="header"]
|
83
84
|
!===
|
84
|
-
!
|
85
|
+
! Role name !Target class and multiplicity !Definition
|
85
86
|
{{ rendered_associations }}
|
86
87
|
!===
|
87
88
|
{% endif %}
|
88
89
|
{% endif %}
|
89
90
|
{% if data_type.attributes.size > 0 %}
|
90
|
-
|
|
91
|
+
|
|
92
|
+
[cols="15,20,60",options="header"]
|
91
93
|
!===
|
92
|
-
!
|
94
|
+
! Attribute ! Value type and multiplicity ! Definition
|
93
95
|
{% for attr in data_type.attributes %}
|
94
96
|
{% capture cardinality %}{% if attr.cardinality.min == 'C' %}[0..{{ attr.cardinality.max }}]{% elsif assoc.member_end_cardinality.min == 'M' and assoc.member_end_cardinality.max == '1' %}[1..1]{% else %}[{{ attr.cardinality.max }}]{% endif %}{% endcapture %}
|
95
|
-
!
|
97
|
+
! {{ attr.name }} !<<{{ attr.type }}-section,{{ attr.name }}>> {{ cardinality }} !{{ attr.definition }}
|
96
98
|
{% endfor %}
|
97
99
|
!===
|
98
|
-
|
|
100
|
+
| NOTE: Unless otherwise specified, all attributes and role names have the stereotype «Property».
|
99
101
|
{% endif %}
|
100
102
|
|===
|
101
103
|
|
@@ -111,18 +113,20 @@ h|Stereotype: | «{{ package.stereotype }}»
|
|
111
113
|
[cols="1a"]
|
112
114
|
|===
|
113
115
|
|*{{ enum.name }}*
|
114
|
-
|
|
116
|
+
|
|
117
|
+
[cols="1,4"]
|
115
118
|
!===
|
116
|
-
!
|
117
|
-
!
|
119
|
+
!Definition: ! {{ enum.definition }}
|
120
|
+
!Stereotype: ! «Enumeration»
|
118
121
|
!===
|
119
122
|
{% if enum.values.size > 0 %}
|
120
|
-
|
|
123
|
+
|
|
124
|
+
[cols="1,4",options="header"]
|
121
125
|
!===
|
122
|
-
|
126
|
+
! Literal value !Definition
|
123
127
|
|
124
128
|
{% for val in enum.values %}
|
125
|
-
|
129
|
+
! {{ val.name }} !{{ val.definition }}
|
126
130
|
{% endfor %}
|
127
131
|
!===
|
128
132
|
{% endif %}
|
@@ -160,7 +164,7 @@ h|Stereotype: | «{{ package.stereotype }}»
|
|
160
164
|
|
161
165
|
{% assign after_package_key = 'after;' | append: package.name %}
|
162
166
|
{% if additional_context[after_package_key] %}
|
163
|
-
{{equalsigns}}= Additional
|
167
|
+
{{equalsigns}}= Additional information
|
164
168
|
{% for after in additional_context[after_package_key] %}
|
165
169
|
{{ after.text }}
|
166
170
|
{% endfor %}
|
@@ -4,39 +4,61 @@
|
|
4
4
|
[cols="1a"]
|
5
5
|
|===
|
6
6
|
|*{{ klass.name }}*
|
7
|
-
|
|
7
|
+
|
|
8
|
+
[cols="1,4"]
|
8
9
|
!===
|
9
|
-
!
|
10
|
-
!
|
11
|
-
!
|
10
|
+
! Definition: ! {{ klass.definition }}
|
11
|
+
! Subclass of: ! {{ generalizations }}
|
12
|
+
! Stereotype: ! «{{ klass.stereotype }}»
|
12
13
|
!===
|
14
|
+
|
13
15
|
{% if klass.associations.size > 0 %}
|
14
16
|
{% capture rendered_associations %}
|
15
17
|
{% for assoc in klass.associations %}
|
18
|
+
|
16
19
|
{% if assoc.member_end_attribute_name.size > 0 %}
|
20
|
+
|
17
21
|
{% capture cardinality %}{% if assoc.member_end_cardinality.min == 'C' %}[0..{{ assoc.member_end_cardinality.max }}]{% elsif assoc.member_end_cardinality.min == 'M' and assoc.member_end_cardinality.max == '1' %}[1..1]{% else %}[{{ assoc.member_end_cardinality.max }}]{% endif %}{% endcapture %}
|
18
|
-
|
22
|
+
|
23
|
+
! {{ assoc.member_end_attribute_name }}
|
24
|
+
! <<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }}
|
25
|
+
! {{ assoc.definition }}
|
26
|
+
|
19
27
|
{% endif %}
|
20
28
|
{% endfor %}
|
21
29
|
{% endcapture %}
|
30
|
+
|
22
31
|
{% if rendered_associations.size > 0 %}
|
23
|
-
|
|
32
|
+
|
|
33
|
+
[cols="15,20,60",options="header"]
|
24
34
|
!===
|
25
|
-
!
|
35
|
+
! *Role name*
|
36
|
+
! *Target class and multiplicity*
|
37
|
+
! *Definition*
|
26
38
|
{{ rendered_associations }}
|
27
39
|
!===
|
28
40
|
{% endif %}
|
41
|
+
|
29
42
|
{% endif %}
|
30
43
|
{% if klass.attributes.size > 0 %}
|
31
|
-
|
|
44
|
+
|
|
45
|
+
[cols="15,20,60",options="header"]
|
32
46
|
!===
|
33
|
-
!
|
47
|
+
! *Attribute*
|
48
|
+
! *Value type and multiplicity*
|
49
|
+
! *Definition*
|
34
50
|
{% for attr in klass.attributes %}
|
51
|
+
|
35
52
|
{% capture cardinality %}{% if attr.cardinality.min == 'C' %}[0..{{ attr.cardinality.max }}]{% elsif assoc.member_end_cardinality.min == 'M' and assoc.member_end_cardinality.max == '1' %}[1..1]{% else %}[{{ attr.cardinality.max }}]{% endif %}{% endcapture %}
|
36
|
-
|
53
|
+
|
54
|
+
! {{ attr.name }}
|
55
|
+
!<<{{ attr.type }}-section,{{ attr.name }}>> {{ cardinality }}
|
56
|
+
!{{ attr.definition }}
|
57
|
+
|
37
58
|
{% endfor %}
|
38
59
|
!===
|
39
|
-
|
60
|
+
|
61
|
+
| NOTE: Unless otherwise specified, all attributes and role names have the stereotype «Property».
|
40
62
|
{% endif %}
|
41
63
|
|===
|
42
64
|
|
@@ -3,8 +3,9 @@
|
|
3
3
|
{% elsif is_klass_spare == 'Spare' %}{% continue %}
|
4
4
|
{% endif %}
|
5
5
|
{% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
|
6
|
-
|
7
|
-
|
6
|
+
{% assign klass_xid = klass.xmi_id %}
|
7
|
+
[[tab-P-{{ package_name }}-DT-{{ klass_xid }}]]
|
8
|
+
.Elements of "{{ package.name }}::{{ klass.name }}" (data type)
|
8
9
|
[width="100%",cols="a,a,a,a,a,a,a,a"]
|
9
10
|
|===
|
10
11
|
|
@@ -24,14 +25,14 @@ h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
|
|
24
25
|
h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
|
25
26
|
{% endif %}
|
26
27
|
|
27
|
-
h|Abstract: 7+| {
|
28
|
+
h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
|
28
29
|
{% assign aggregations = klass.associations | where: "member_end_type", "aggregation" %}
|
29
30
|
{% if aggregations.size > 0 %}
|
30
31
|
.{{aggregations.size | plus: 1}}+h|Associations:
|
31
|
-
4+|_Association
|
32
|
-
|_Obligation_
|
32
|
+
4+| _Association with_
|
33
|
+
| _Obligation_
|
33
34
|
| _Maximum occurrence_
|
34
|
-
|
|
35
|
+
| _Provides_
|
35
36
|
|
36
37
|
{% for assoc in aggregations %}
|
37
38
|
4+| {{assoc.member_end}}
|
@@ -41,12 +42,11 @@ h|Abstract: 7+| {{ klass.is_abstract }}
|
|
41
42
|
|
42
43
|
{% endfor %}
|
43
44
|
{% else %}
|
44
|
-
|
45
|
-
.1+h|Associations: 7+| (none)
|
45
|
+
h| Associations: 7+| (none)
|
46
46
|
{% endif %}
|
47
47
|
|
48
48
|
{% if klass.attributes.size > 0 %}
|
49
|
-
.{{klass.attributes.size | plus: 1}}+h|Values:
|
49
|
+
.{{klass.attributes.size | plus: 1}}+h| Values:
|
50
50
|
| _Name_
|
51
51
|
6+| _Definition_
|
52
52
|
|
@@ -56,7 +56,7 @@ h|Abstract: 7+| {{ klass.is_abstract }}
|
|
56
56
|
|
57
57
|
{% endfor %}
|
58
58
|
{% else %}
|
59
|
-
|
59
|
+
h| Values:
|
60
60
|
7+| (none)
|
61
61
|
{% endif %}
|
62
62
|
|
@@ -6,6 +6,7 @@
|
|
6
6
|
{% endfor %}
|
7
7
|
{% endif %}
|
8
8
|
{% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}{{equalsigns}} {{ package.name }}
|
9
|
+
|
9
10
|
[[rc_{{ package_name }}-model_section]]
|
10
11
|
{{equalsigns}}= {{ package.name }}
|
11
12
|
|
@@ -48,7 +49,7 @@
|
|
48
49
|
{% endfor %}
|
49
50
|
{% endif %}
|
50
51
|
|
51
|
-
{{equalsigns}}= Class
|
52
|
+
{{equalsigns}}= Class definitions
|
52
53
|
{% if package.classes.size > 0 %}
|
53
54
|
.Classes used in {{ package.name }}
|
54
55
|
[cols="2a,6a",options="header"]
|
@@ -56,8 +57,7 @@
|
|
56
57
|
|Class |Description
|
57
58
|
|
58
59
|
{% for klass in package.classes %}
|
59
|
-
|<<{{ klass.name }}-section,{{ klass.name }}>>
|
60
|
-
«{{ klass.stereotype }}»
|
60
|
+
|<<{{ klass.name }}-section,{{ klass.name }}>> «{{ klass.stereotype }}»
|
61
61
|
|{{ klass.definition }}
|
62
62
|
|
63
63
|
{% endfor %}
|
@@ -65,13 +65,13 @@
|
|
65
65
|
{% endif %}
|
66
66
|
|
67
67
|
{% if package.data_types.size > 0 %}
|
68
|
-
.Data
|
68
|
+
.Data types used in {{ package.name }}
|
69
69
|
[cols="2,6",options="header"]
|
70
70
|
|===
|
71
71
|
|Name |Description
|
72
72
|
|
73
73
|
{% for klass in package.data_types %}
|
74
|
-
|<<{{ klass.name }}-section,{{ klass.name }}>>
|
74
|
+
|<<{{ klass.name }}-section,{{ klass.name }}>> «{{ klass.stereotype }}»
|
75
75
|
|{{ klass.definition }}
|
76
76
|
|
77
77
|
{% endfor %}
|
@@ -86,7 +86,7 @@
|
|
86
86
|
|Name |Description
|
87
87
|
|
88
88
|
{% for klass in package.enums %}
|
89
|
-
|<<{{ klass.name }}-section,{{ klass.name }}>>
|
89
|
+
|<<{{ klass.name }}-section,{{ klass.name }}>> «{{ klass.stereotype }}»
|
90
90
|
|{{ klass.definition }}
|
91
91
|
|
92
92
|
{% endfor %}
|
@@ -96,7 +96,7 @@
|
|
96
96
|
|
97
97
|
{% assign after_package_key = 'after;' | append: package.name %}
|
98
98
|
{% if additional_context[after_package_key] %}
|
99
|
-
{{equalsigns}}= Additional
|
99
|
+
{{equalsigns}}= Additional information
|
100
100
|
{% for after in additional_context[after_package_key] %}
|
101
101
|
{{ after.text }}
|
102
102
|
{% endfor %}
|
@@ -3,8 +3,9 @@
|
|
3
3
|
{% elsif is_klass_spare == 'Spare' %}{% continue %}
|
4
4
|
{% endif %}
|
5
5
|
{% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
|
6
|
-
|
7
|
-
|
6
|
+
{% assign klass_xid = klass.xmi_id %}
|
7
|
+
[[tab-P-{{ package_name }}-E-{{ klass_xid }}]]
|
8
|
+
.Elements of "{{ package.name }}::{{ klass.name }}" (enumeration)
|
8
9
|
[width="100%",cols="a,a,a,a,a,a,a,a"]
|
9
10
|
|===
|
10
11
|
|
@@ -24,14 +25,14 @@ h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
|
|
24
25
|
h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
|
25
26
|
{% endif %}
|
26
27
|
|
27
|
-
h|Abstract: 7+| {
|
28
|
+
h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
|
28
29
|
{% assign aggregations = klass.associations | where: "member_end_type", "aggregation" %}
|
29
30
|
{% if aggregations.size > 0 %}
|
30
31
|
.{{aggregations.size | plus: 1}}+h|Associations:
|
31
|
-
4+|_Association
|
32
|
-
|_Obligation_
|
32
|
+
4+| _Association with_
|
33
|
+
| _Obligation_
|
33
34
|
| _Maximum occurrence_
|
34
|
-
|
|
35
|
+
| _Provides_
|
35
36
|
|
36
37
|
{% for assoc in aggregations %}
|
37
38
|
4+| {{assoc.member_end}}
|
@@ -41,11 +42,11 @@ h|Abstract: 7+| {{ klass.is_abstract }}
|
|
41
42
|
|
42
43
|
{% endfor %}
|
43
44
|
{% else %}
|
44
|
-
|
45
|
-
.1+h|Associations: 7+| (none)
|
45
|
+
h| Associations: 7+| (none)
|
46
46
|
{% endif %}
|
47
|
+
|
47
48
|
{% if klass.values.size > 0 %}
|
48
|
-
.{{klass.values.size | plus: 1}}+h|Values:
|
49
|
+
.{{klass.values.size | plus: 1}}+h| Values:
|
49
50
|
| _Name_
|
50
51
|
6+| _Definition_
|
51
52
|
|
@@ -55,7 +56,7 @@ h|Abstract: 7+| {{ klass.is_abstract }}
|
|
55
56
|
|
56
57
|
{% endfor %}
|
57
58
|
{% else %}
|
58
|
-
|
59
|
+
h| Values:
|
59
60
|
7+| (none)
|
60
61
|
{% endif %}
|
61
62
|
|
@@ -52,7 +52,7 @@ module Metanorma
|
|
52
52
|
|
53
53
|
def process_text_blocks(document, input_lines, express_indexes)
|
54
54
|
line = input_lines.next
|
55
|
-
block_match = line.match(/^\[
|
55
|
+
block_match = line.match(/^\[lutaml_express,([^,]+)?,?([^,]+)?,?([^,]+)?\]/)
|
56
56
|
return [line] if block_match.nil?
|
57
57
|
|
58
58
|
end_mark = input_lines.next
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-plugin-lutaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
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-08-
|
11
|
+
date: 2021-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
296
|
- !ruby/object:Gem::Version
|
297
297
|
version: '0'
|
298
298
|
requirements: []
|
299
|
-
rubygems_version: 3.
|
299
|
+
rubygems_version: 3.0.3
|
300
300
|
signing_key:
|
301
301
|
specification_version: 4
|
302
302
|
summary: Metanorma plugin for LutaML
|