metanorma-plugin-lutaml 0.4.5 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,8 +3,8 @@
3
3
  {% elsif is_klass_spare == 'Spare' %}{% continue %}
4
4
  {% endif %}
5
5
  {% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
6
- [[tab-P-{{ package_name }}-C-{{ klass_name }}]]
7
- .Elements of {{ package.name }}::{{ klass.name }}
6
+ [[section-{{ klass.xmi_id }}]]
7
+ .Elements of “{{ package.name }}::{{ klass.name }}” (class)
8
8
  [width="100%",cols="a,a,a,a,a,a,a,a"]
9
9
  |===
10
10
 
@@ -24,14 +24,14 @@ h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
24
24
  h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
25
25
  {% endif %}
26
26
 
27
- h|Abstract: 7+| {{ klass.is_abstract }}
27
+ h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
28
28
  {% assign aggregations = klass.associations | where: "member_end_type", "aggregation" %}
29
29
  {% if aggregations.size > 0 %}
30
30
  .{{aggregations.size | plus: 1}}+h|Associations:
31
- 4+|_Association with:_
32
- |_Obligation_
31
+ 4+| _Association with_
32
+ | _Obligation_
33
33
  | _Maximum occurrence_
34
- |_Provides:_
34
+ | _Provides_
35
35
 
36
36
  {% for assoc in aggregations %}
37
37
  4+| {{assoc.member_end}}
@@ -41,9 +41,9 @@ h|Abstract: 7+| {{ klass.is_abstract }}
41
41
 
42
42
  {% endfor %}
43
43
  {% else %}
44
-
45
- .1+h|Associations: 7+| (none)
44
+ h| Associations: 7+| (none)
46
45
  {% endif %}
46
+
47
47
  {% if klass.attributes.size > 0 %}
48
48
  .{{klass.attributes.size | plus: 1}}+h|Public attributes:
49
49
  | _Name_
@@ -63,12 +63,12 @@ h|Abstract: 7+| {{ klass.is_abstract }}
63
63
 
64
64
  {% endfor %}
65
65
  {% else %}
66
- .1+h|Public attributes:
66
+ h| Public attributes:
67
67
  7+| (none)
68
68
  {% endif %}
69
69
 
70
70
  {% if klass.constraints.size > 0 %}
71
- .{{ klass.constraints.size }}+|*Constraints:*
71
+ .{{ klass.constraints.size }}+h| Constraints:
72
72
  {% for constr in klass.constraints %}
73
73
  7+| `{{ constr.body }}`
74
74
 
@@ -0,0 +1,201 @@
1
+ {% for package in context.packages %}
2
+ {% assign package_name = package.name | downcase | replace: ":", "" | replace: " ", "_" %}
3
+ {% if additional_context.before and additional_context.before.size > 0 %}
4
+ {% for before in additional_context.before %}
5
+ {{ before.text }}
6
+ {% endfor %}
7
+ {% endif %}
8
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}{{equalsigns}} {{ package.name }}
9
+
10
+ {% assign before_package_key = 'before;' | append: package.name %}
11
+ {% if additional_context[before_package_key] and additional_context[before_package_key].size > 0 %}
12
+ {% for before in additional_context[before_package_key] %}
13
+ {{ before.text }}
14
+ {% endfor %}
15
+ {% endif %}
16
+
17
+ [cols="1a,4a"]
18
+ |===
19
+
20
+ h|Description: | {{ package.definition }}
21
+ h|Parent package: | {{ context.name }}
22
+ h|Stereotype: | «{{ package.stereotype }}»
23
+
24
+ |===
25
+
26
+ {% assign basic_types = package.classes | where: "stereotype", "BasicType" %}
27
+ {% assign unions = package.data_types | where: "stereotype", "Union" %}
28
+ {% assign code_lists = package.classes | where: "stereotype", "CodeList" %}
29
+ {% assign not_classes_length = basic_types.size | plus: code_lists.size %}
30
+ {% assign not_classes_stereoptypes = 'DataType,BasicType,Enumeration,CodeList' | split: ','%}
31
+ {{equalsigns}}= Classes
32
+
33
+ {% unless not_classes_length == package.classes.size %}
34
+
35
+ {% for klass in package.classes %}
36
+ {% unless not_classes_stereoptypes contains klass.stereotype %}
37
+ {% include "packages_data_dictionary_class" %}
38
+ {% endunless %}
39
+ {% endfor %}
40
+ {% else %}
41
+ None
42
+ {% endunless %}
43
+
44
+ {{equalsigns}}= Basic types
45
+
46
+ {% if basic_types.size > 0 %}
47
+
48
+ {% include "packages_data_dictionary_classes", classes: basic_types %}
49
+ {% else %}
50
+ None
51
+ {% endif %}
52
+
53
+ {{equalsigns}}= Unions
54
+
55
+ {% if unions.size > 0 %}
56
+
57
+ {% include "packages_data_dictionary_classes", classes: unions %}
58
+ {% else %}
59
+ None
60
+ {% endif %}
61
+
62
+ {{equalsigns}}= Code lists
63
+
64
+ {% if code_lists.size > 0 %}
65
+
66
+ {% include "packages_data_dictionary_classes", classes: code_lists %}
67
+ {% else %}
68
+ None
69
+ {% endif %}
70
+
71
+ {{equalsigns}}= Data types
72
+
73
+ {% assign non_unions = package.data_types | where: "stereotype", "DataType" %}
74
+ {% if non_unions.size > 0 %}
75
+
76
+ {% for data_type in non_unions %}
77
+ {% capture generalizations %}{% assign inheritance = data_type.associations | where: "member_end_type", "inheritance" %}{% for assoc in inheritance %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
78
+ [[{{ data_type.name }}-section]]
79
+ [cols="1a"]
80
+ |===
81
+ |*{{ data_type.name }}*
82
+ |[cols="1,4"]
83
+ !===
84
+ !Definition: ! {{ data_type.definition }}
85
+ !Subclass of: ! {% if generalizations.size > 4 %}{{ generalizations }}{% else %}None{% endif %}
86
+ !Stereotype: ! «{{ data_type.stereotype }}»
87
+ !===
88
+ {% if data_type.associations.size > 0 %}
89
+ {% capture rendered_associations %}
90
+ {% for assoc in data_type.associations %}
91
+ {% if assoc.member_end_attribute_name.size > 0 %}
92
+ {% 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 %}
93
+ ! {{ assoc.member_end_attribute_name }} !<<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }} ! {{ assoc.definition }}
94
+ {% endif %}
95
+ {% endfor %}
96
+ {% endcapture %}
97
+ {% if rendered_associations.size > 100 %}
98
+ |
99
+ [cols="15,20,60",options="header"]
100
+ !===
101
+ ! Role name !Target class and multiplicity !Definition
102
+ {{ rendered_associations }}
103
+ !===
104
+ {% endif %}
105
+ {% endif %}
106
+ {% if data_type.attributes.size > 0 %}
107
+ |
108
+ [cols="15,20,60",options="header"]
109
+ !===
110
+ ! Attribute ! Value type and multiplicity ! Definition
111
+ {% for attr in data_type.attributes %}
112
+ {% 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 %}
113
+ ! {{ attr.name }} !<<{{ attr.type }}-section,{{ attr.type }}>> {{ cardinality }} !{{ attr.definition }}
114
+ {% endfor %}
115
+ !===
116
+ | NOTE: Unless otherwise specified, all attributes and role names have the stereotype «Property».
117
+ {% endif %}
118
+ |===
119
+
120
+ {% endfor %}
121
+ {% else %}
122
+ None
123
+ {% endif %}
124
+
125
+ {{equalsigns}}= Enumerations
126
+
127
+ {% if package.enums.size > 0 %}
128
+
129
+ {% for enum in package.enums %}
130
+ [[{{ enum.name }}-section]]
131
+ [cols="1a"]
132
+ |===
133
+ |*{{ enum.name }}*
134
+ |
135
+ [cols="1,4"]
136
+ !===
137
+ !Definition: ! {{ enum.definition }}
138
+ !Stereotype: ! «Enumeration»
139
+ !===
140
+ {% if enum.values.size > 0 %}
141
+ |
142
+ [cols="1,4",options="header"]
143
+ !===
144
+ ! Literal value !Definition
145
+
146
+ {% for val in enum.values %}
147
+ ! {{ val.name }} !{{ val.definition }}
148
+ {% endfor %}
149
+ !===
150
+ {% endif %}
151
+ |===
152
+
153
+ {% endfor %}
154
+ {% else %}
155
+ None
156
+ {% endif %}
157
+
158
+ {% if additional_context.include_block and additional_context.include_block.size > 0 %}
159
+ {% for block in additional_context.include_block %}
160
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
161
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
162
+ {% unless block_content contains "Liquid error" %}
163
+ {% if block.text %}
164
+ {{ block.text }}
165
+ {% endif %}
166
+ {{ block_content }}
167
+ {% endunless %}
168
+ {% endfor %}
169
+ {% endif %}
170
+
171
+ {% assign include_block_package_key = 'include_block;' | append: package.name %}
172
+ {% if additional_context[include_block_package_key] and additional_context[include_block_package_key].size > 0 %}
173
+ {% for block in additional_context[include_block_package_key] %}
174
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
175
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
176
+ {% unless block_content contains "Liquid error" %}
177
+ {% if block.text %}
178
+ {{ block.text }}
179
+ {% endif %}
180
+ {{ block_content }}
181
+ {% endunless %}
182
+ {% endfor %}
183
+ {% endif %}
184
+
185
+ {% assign after_package_key = 'after;' | append: package.name %}
186
+ {% if additional_context[after_package_key] %}
187
+ {{equalsigns}}= Additional information
188
+ {% for after in additional_context[after_package_key] %}
189
+ {{ after.text }}
190
+ {% endfor %}
191
+ {% endif %}
192
+ {% if package.packages.size > 0 and render_nested_packages %}
193
+ {% assign nested_depth = depth | plus: 1 %}{% include "packages_data_dictionary", depth: nested_depth, context: package %}
194
+ {% endif %}
195
+ {% endfor %}
196
+
197
+ {% if additional_context.after and additional_context.after.size > 0 %}
198
+ {% for after in additional_context.after %}
199
+ {{ after.text }}
200
+ {% endfor %}
201
+ {% endif %}
@@ -0,0 +1,67 @@
1
+ {% capture generalizations %}{% assign inheritance = klass.associations | where: "member_end_type", "inheritance" %}{% for assoc in inheritance %}{{ assoc.member_end }} {% endfor %}{% endcapture %}
2
+ [[{{ klass.name }}-section]]
3
+ [cols="1a"]
4
+ |===
5
+ |*{{ klass.name }}*
6
+ |
7
+ [cols="1,4"]
8
+ !===
9
+ ! Definition: ! {{ klass.definition }}
10
+ ! Subclass of: ! {% if generalizations.size > 4 %}{{ generalizations }}{% else %}None{% endif %}
11
+ ! Stereotype: ! «{{ klass.stereotype }}»
12
+ {% if klass.constraints.size > 0 %}
13
+ {% for constraint in klass.constraints %}
14
+ ! Constraint: ! {{ constraint.body }}: {{ constraint.definition | replace: '|', '\|' }}
15
+ {% endfor %}
16
+ {% endif %}
17
+ !===
18
+
19
+ {% if klass.associations.size > 0 %}
20
+ {% capture rendered_associations %}
21
+ {% for assoc in klass.associations %}
22
+
23
+ {% if assoc.member_end_attribute_name.size > 0 %}
24
+
25
+ {% 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 %}
26
+
27
+ ! {{ assoc.member_end_attribute_name }}
28
+ ! <<{{assoc.member_end}}-section,{{assoc.member_end}}>> {{ cardinality }}
29
+ ! {{ assoc.definition }}
30
+
31
+ {% endif %}
32
+ {% endfor %}
33
+ {% endcapture %}
34
+
35
+ {% if rendered_associations.size > 100 %}
36
+ |
37
+ [cols="15,20,60",options="header"]
38
+ !===
39
+ ! *Role name*
40
+ ! *Target class and multiplicity*
41
+ ! *Definition*
42
+ {{ rendered_associations }}
43
+ !===
44
+ {% endif %}
45
+
46
+ {% endif %}
47
+ {% if klass.attributes.size > 0 %}
48
+ |
49
+ [cols="15,20,60",options="header"]
50
+ !===
51
+ ! *Attribute*
52
+ ! *Value type and multiplicity*
53
+ ! *Definition*
54
+ {% for attr in klass.attributes %}
55
+
56
+ {% 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 %}
57
+
58
+ ! {{ attr.name }}
59
+ !<<{{ attr.type }}-section,{{ attr.type }}>> {{ cardinality }}
60
+ !{{ attr.definition }}
61
+
62
+ {% endfor %}
63
+ !===
64
+
65
+ | NOTE: Unless otherwise specified, all attributes and role names have the stereotype «Property».
66
+ {% endif %}
67
+ |===
@@ -0,0 +1,3 @@
1
+ {% for klass in classes %}
2
+ {% include "packages_data_dictionary_class" %}
3
+ {% endfor %}
@@ -3,8 +3,8 @@
3
3
  {% elsif is_klass_spare == 'Spare' %}{% continue %}
4
4
  {% endif %}
5
5
  {% assign klass_name = klass.name | downcase | replace: ':', '' | replace: ' ', '_' %}
6
- [[tab-P-{{ package_name }}-DT-{{ klass_name }}]]
7
- .Elements of {{ package.name }}::{{ klass.name }}
6
+ [[section-{{ klass.xmi_id }}]]
7
+ .Elements of {{ package.name }}::{{ klass.name }}&#8221; (data_type)
8
8
  [width="100%",cols="a,a,a,a,a,a,a,a"]
9
9
  |===
10
10
 
@@ -24,14 +24,14 @@ h|Inheritance from: 7+| {{ inherited | map: 'member_end' | join: ", " }}
24
24
  h|Generalization of: 7+| {{ generalizations | map: 'member_end' | join: ", " }}
25
25
  {% endif %}
26
26
 
27
- h|Abstract: 7+| {{ klass.is_abstract }}
27
+ h|Abstract: 7+| {% if klass.is_abstract %}True{% else %}False{% endif %}
28
28
  {% assign aggregations = klass.associations | where: "member_end_type", "aggregation" %}
29
29
  {% if aggregations.size > 0 %}
30
30
  .{{aggregations.size | plus: 1}}+h|Associations:
31
- 4+|_Association with:_
32
- |_Obligation_
31
+ 4+| _Association with_
32
+ | _Obligation_
33
33
  | _Maximum occurrence_
34
- |_Provides:_
34
+ | _Provides_
35
35
 
36
36
  {% for assoc in aggregations %}
37
37
  4+| {{assoc.member_end}}
@@ -41,12 +41,11 @@ h|Abstract: 7+| {{ klass.is_abstract }}
41
41
 
42
42
  {% endfor %}
43
43
  {% else %}
44
-
45
- .1+h|Associations: 7+| (none)
44
+ h| Associations: 7+| (none)
46
45
  {% endif %}
47
46
 
48
47
  {% if klass.attributes.size > 0 %}
49
- .{{klass.attributes.size | plus: 1}}+h|Values:
48
+ .{{klass.attributes.size | plus: 1}}+h| Values:
50
49
  | _Name_
51
50
  6+| _Definition_
52
51
 
@@ -56,7 +55,7 @@ h|Abstract: 7+| {{ klass.is_abstract }}
56
55
 
57
56
  {% endfor %}
58
57
  {% else %}
59
- .1+h|Values:
58
+ h| Values:
60
59
  7+| (none)
61
60
  {% endif %}
62
61
 
@@ -0,0 +1,136 @@
1
+ {% for package in context.packages %}
2
+ {% assign package_name = package.name | downcase | replace: ":", "" | replace: " ", "_" %}
3
+ {% if additional_context.before and additional_context.before.size > 0 %}
4
+ {% for before in additional_context.before %}
5
+ {{ before.text }}
6
+ {% endfor %}
7
+ {% endif %}
8
+ {% if depth %}
9
+ [[rc_{{ package_name }}-model_section]]
10
+ {% capture equalsigns %}{% for count in (1..depth) %}={% endfor %}{% endcapture %}{{equalsigns}} {{ package.name }}
11
+ {% endif %}
12
+
13
+ {% if additional_context.all_macroses.size > 0 %}
14
+ {% assign sorted_all_macroses = additional_context.all_macroses | where: "position", "before" | sort: 'index' %}
15
+ {% for block in sorted_all_macroses %}
16
+ {% case block.type %}
17
+ {% when 'include_block' %}
18
+ {% unless block.package and block.package != package.name %}
19
+ {% capture block_filename %}{{ block.base_path }}{{ package_name }}{% endcapture %}
20
+ {% capture block_content %}{% include block_filename %}{% endcapture %}
21
+ {% unless block_content contains "Liquid error" %}
22
+ {% if block.text %}
23
+
24
+ {{ block.text }}
25
+ {% endif %}
26
+
27
+ {{ block_content }}
28
+ {% endunless %}
29
+ {% endunless %}
30
+ {% when 'package_text' %}
31
+ {% unless block.package and block.package != package.name %}
32
+
33
+ {{ block.text }}
34
+ {% endunless %}
35
+ {% else %}
36
+ {% endcase %}
37
+ {% endfor %}
38
+ {% endif %}
39
+
40
+ // TODO: move to all_macroses block
41
+ {% if additional_context.diagram_include_block %}
42
+ {% for diagram_include_block in additional_context.diagram_include_block %}
43
+ {% include "diagrams_block", package_name: package_name, image_base_path: diagram_include_block.base_path, text: diagram_include_block.text %}
44
+ {% endfor %}
45
+ {% endif %}
46
+
47
+ {% if package.classes.size > 0 %}
48
+ {{equalsigns}}= Class definitions
49
+
50
+ {% comment %} {% assign data_types = package.classes | where: "stereotype", "DataType" %} {% endcomment %}
51
+ {% assign basic_types = package.classes | where: "stereotype", "BasicType" %}
52
+ {% comment %} {% assign enumerations = package.classes | where: "stereotype", "Enumeration" %} {% endcomment %}
53
+ {% assign code_lists = package.classes | where: "stereotype", "CodeList" %}
54
+
55
+ {% assign not_classes_length = plus: basic_types.size | plus: code_lists.size %}
56
+ {% assign not_classes_stereoptypes = 'DataType,BasicType,Enumeration,CodeList' | split: ','%}
57
+ {% unless not_classes_length == package.classes.size %}
58
+ .Classes used in {{ package.name }}
59
+ [cols="2a,6a",options="header"]
60
+ |===
61
+ |Name |Description
62
+ {% for klass in package.classes %}
63
+ {% unless not_classes_stereoptypes contains klass.stereotype %}
64
+ |<<{{ klass.name }}-section,{{ klass.name }}>> «{{ klass.stereotype }}»
65
+ |{{ klass.definition }}
66
+
67
+ {% endunless %}
68
+ {% endfor %}
69
+ |===
70
+ {% endunless %}
71
+
72
+ {% if package.data_types.size > 0 %}
73
+ {% include "packages_entity_list_classes", classes: package.data_types, type: "Data Types" %}
74
+ {% endif %}
75
+
76
+ {% if basic_types.size > 0 %}
77
+ {% include "packages_entity_list_classes", classes: basic_types, type: "Primitive Data Types" %}
78
+ {% endif %}
79
+
80
+ {% if package.enums.size > 0 %}
81
+ {% include "packages_entity_list_classes", classes: package.enums, type: "Enumerated Classes" %}
82
+ {% endif %}
83
+
84
+ {% if code_lists.size > 0 %}
85
+ {% include "packages_entity_list_classes", classes: code_lists, type: "CodeList Classes" %}
86
+ {% endif %}
87
+
88
+ {% endif %}
89
+
90
+ {% comment %} {% if package.data_types.size > 0 %}
91
+ .Data types used in {{ package.name }}
92
+ [cols="2,6",options="header"]
93
+ |===
94
+ |Name |Description
95
+
96
+ {% for klass in package.data_types %}
97
+ |<<{{ klass.name }}-section,{{ klass.name }}>> «{{ klass.stereotype }}»
98
+ |{{ klass.definition }}
99
+
100
+ {% endfor %}
101
+
102
+ |===
103
+ {% endif %}
104
+
105
+ {% if package.enums.size > 0 %}
106
+ .Enumerated Classes used in {{ package.name }}
107
+ [cols="2a,6a",options="header"]
108
+ |===
109
+ |Name |Description
110
+
111
+ {% for klass in package.enums %}
112
+ |<<{{ klass.name }}-section,{{ klass.name }}>> «{{ klass.stereotype }}»
113
+ |{{ klass.definition }}
114
+
115
+ {% endfor %}
116
+
117
+ |===
118
+ {% endif %} {% endcomment %}
119
+
120
+ {% assign after_package_key = 'after;' | append: package.name %}
121
+ {% if additional_context[after_package_key] %}
122
+ {{equalsigns}}= Additional information
123
+ {% for after in additional_context[after_package_key] %}
124
+ {{ after.text }}
125
+ {% endfor %}
126
+ {% endif %}
127
+ {% if package.packages.size > 0 and render_nested_packages %}
128
+ {% assign nested_depth = depth | plus: 1 %}{% include "packages_entity_list", depth: nested_depth, context: package %}
129
+ {% endif %}
130
+ {% endfor %}
131
+
132
+ {% if additional_context.after and additional_context.after.size > 0 %}
133
+ {% for after in additional_context.after %}
134
+ {{ after.text }}
135
+ {% endfor %}
136
+ {% endif %}