metanorma-plugin-lutaml 0.7.54 → 0.7.55.pre.alpha.1
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 +4 -4
- data/Gemfile +19 -0
- data/Gemfile.devel +3 -3
- data/docs/usages/enterprise_architect.adoc +18 -2
- data/lib/metanorma/plugin/lutaml/config/guidance.rb +13 -0
- data/lib/metanorma/plugin/lutaml/liquid_templates/_klass_table.liquid +26 -21
- data/lib/metanorma/plugin/lutaml/lutaml_data_preprocessor.rb +15 -1
- data/lib/metanorma/plugin/lutaml/lutaml_klass_table_block_macro.rb +2 -1
- data/lib/metanorma/plugin/lutaml/version.rb +1 -1
- data/lib/metanorma/plugin/lutaml/xmi_cache.rb +5 -7
- data/metanorma-plugin-lutaml.gemspec +2 -4
- metadata +8 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d08e2206e64a9c020c1059501939d9a44cfa5e0412368b84e9702442ed38e5ca
|
|
4
|
+
data.tar.gz: 3d1bc9fbb60c1a750ab70d2ffcd98e61257e4a7d21f44886cb485456b56af81c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8777cde7a2a1379e9cabb417192d3bc026786cb04739e10578c2eede1764bdffe2b113be22837f376957c7ba6525ba831fd78192c1c381fc5c70a0ec0151d661
|
|
7
|
+
data.tar.gz: 6ac5da62726d19874eceeb0c39710ad034e890e78402f41f516d1f00b5954aed441b9176ec403c97cd228d7537e6e8e3cd710495e2bee3c2927ae598d39d84a1
|
data/Gemfile
CHANGED
|
@@ -24,3 +24,22 @@ gem "simplecov"
|
|
|
24
24
|
gem "timecop"
|
|
25
25
|
gem "vcr"
|
|
26
26
|
gem "webmock"
|
|
27
|
+
|
|
28
|
+
# leptris 1.9.367.0 is the highest match for standoc's '~> 1.9.361' but
|
|
29
|
+
# publishes only linux prebuilds plus a ruby gem with no vendored
|
|
30
|
+
# libleptris; windows-latest falls back to that ruby gem and dies on
|
|
31
|
+
# require "metanorma-standoc". 1.9.361.1 is the latest that still ships
|
|
32
|
+
# x64-mingw-ucrt (and darwin) binaries. Lift once upstream packs Windows
|
|
33
|
+
# again.
|
|
34
|
+
gem "leptris", "~> 1.9.361.1"
|
|
35
|
+
|
|
36
|
+
# pre-release line pins (see metanorma release wave)
|
|
37
|
+
gem "isodoc", github: "metanorma/isodoc", branch: "main"
|
|
38
|
+
gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
|
|
39
|
+
gem "suma", github: "metanorma/suma", branch: "main"
|
|
40
|
+
# standoc main's block_attributes reference
|
|
41
|
+
# Metanorma::Document::Components::AncillaryBlocks::SvgmapElement, which
|
|
42
|
+
# the released metanorma-document 0.5.1 predates; ref-pinned to the
|
|
43
|
+
# document main tree the suite is green against
|
|
44
|
+
gem "metanorma-document", github: "metanorma/metanorma-document",
|
|
45
|
+
ref: "ca4eb4b26f7ab0d2994a4710d0cf158607a832b4"
|
data/Gemfile.devel
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
gem "metanorma-standoc", github: "metanorma/metanorma-standoc", ref: "5ca49c85bbcc1422e48c4b625a66f7f026dc6832"
|
|
1
|
+
# gem "metanorma-standoc", github: "metanorma/metanorma-standoc", ref: "5ca49c85bbcc1422e48c4b625a66f7f026dc6832"
|
|
2
2
|
gem "metanorma", github: "metanorma/metanorma", ref: "a899a9a6fc933dca0a53166d6633b609311b14e6"
|
|
3
3
|
# relaton v3 prerelease line (rubyzip ~> 3.4, matching lutaml-model);
|
|
4
4
|
# relaton-cli's v2line branch allows relaton 3 while keeping version
|
|
5
5
|
# 2.1.2 for metanorma-standoc's constraint; the metanorma/standoc
|
|
6
6
|
# refs are the known-good pair (newer standoc@main needs unreleased
|
|
7
7
|
# metanorma-document components)
|
|
8
|
-
gem "relaton",
|
|
9
|
-
gem "relaton-cli",
|
|
8
|
+
gem "relaton", "~> 3.0.0.pre.alpha"
|
|
9
|
+
gem "relaton-cli", "~> 3.0.0.pre.alpha"
|
|
10
10
|
|
|
11
11
|
# lutaml-lml 0.1.5 adds Lutaml::Lml.parse + Formatter::Graphviz used by
|
|
12
12
|
# the lutaml_diagram renderer; 0.1.1 (previously resolved) lacks them
|
|
@@ -208,11 +208,19 @@ classes:
|
|
|
208
208
|
used: false
|
|
209
209
|
guidance: |
|
|
210
210
|
Drop guidance message here.
|
|
211
|
+
data_types:
|
|
212
|
+
- name: Name Of Datatype
|
|
213
|
+
attributes:
|
|
214
|
+
- name: Name Of Attribute (e.g. Root:value)
|
|
215
|
+
used: false
|
|
216
|
+
guidance: |
|
|
217
|
+
Drop guidance message here.
|
|
211
218
|
...
|
|
212
219
|
----
|
|
213
220
|
|
|
214
221
|
If you want to define the guidance, you can define the `name` of the class
|
|
215
|
-
under `classes
|
|
222
|
+
under `classes` (or the datatype under `data_types`). Then define which
|
|
223
|
+
`attributes` you want to add guidance by the
|
|
216
224
|
`name`. Set `used` to show the attribute is used or not. Drop the message of
|
|
217
225
|
guidance in `guidance`.
|
|
218
226
|
|
|
@@ -311,11 +319,19 @@ classes:
|
|
|
311
319
|
used: false
|
|
312
320
|
guidance: |
|
|
313
321
|
Drop guidance message here.
|
|
322
|
+
data_types:
|
|
323
|
+
- name: "NameOfDatatype"
|
|
324
|
+
attributes:
|
|
325
|
+
- name: Name Of Attribute (e.g. Root:value)
|
|
326
|
+
used: false
|
|
327
|
+
guidance: |
|
|
328
|
+
Drop guidance message here.
|
|
314
329
|
...
|
|
315
330
|
----
|
|
316
331
|
|
|
317
332
|
If you want to define the guidance, you can define the `name` of the class
|
|
318
|
-
under `classes
|
|
333
|
+
under `classes` (or the datatype under `data_types`). Then define which
|
|
334
|
+
`attributes` you want to add guidance by the
|
|
319
335
|
`name`. Set `used` to show the attribute is used or not. Drop the message of
|
|
320
336
|
guidance in `guidance`.
|
|
321
337
|
|
|
@@ -7,9 +7,22 @@ module Metanorma
|
|
|
7
7
|
class Guidance < ::Lutaml::Model::Serializable
|
|
8
8
|
attribute :classes, GuidanceKlass, collection: true,
|
|
9
9
|
initialize_empty: true
|
|
10
|
+
attribute :data_types, GuidanceKlass, collection: true,
|
|
11
|
+
initialize_empty: true
|
|
10
12
|
|
|
11
13
|
yaml do
|
|
12
14
|
map "classes", to: :classes
|
|
15
|
+
map "data_types", to: :data_types
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Drops index into both keys (KlassDrop reads ["classes"],
|
|
19
|
+
# DataTypeDrop reads ["data_types"]); empty collections are
|
|
20
|
+
# omitted from as_yaml, so pin both keys here.
|
|
21
|
+
def to_yaml_hash
|
|
22
|
+
super.tap do |hash|
|
|
23
|
+
hash["classes"] ||= []
|
|
24
|
+
hash["data_types"] ||= []
|
|
25
|
+
end
|
|
13
26
|
end
|
|
14
27
|
end
|
|
15
28
|
end
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
{%-
|
|
1
|
+
{%- comment -%}
|
|
2
|
+
parentless types (e.g. Union-stereotyped data types) carry no
|
|
3
|
+
generalization: render the drop itself so members are not lost
|
|
4
|
+
{%- endcomment -%}
|
|
5
|
+
{%- assign root = klass.generalization | default: klass -%}
|
|
2
6
|
|
|
3
7
|
{%- capture upper_klass_name -%}
|
|
4
8
|
{{ root.general.upper_klass }}:{{ root.general.name }}
|
|
@@ -21,57 +25,58 @@ h| Stereotype 2+| {{ stereotype }}
|
|
|
21
25
|
|
|
22
26
|
3+h| Inherited Properties
|
|
23
27
|
h| Property Name h| Property Type and Multiplicity h| Definition
|
|
24
|
-
{
|
|
25
|
-
{%- unless attr.has_association? -%}
|
|
26
|
-
{%- capture name_col -%}
|
|
28
|
+
{% for attr in root.inherited_props %}
|
|
29
|
+
{%- unless attr.has_association? -%}
|
|
30
|
+
{%- capture name_col -%}
|
|
27
31
|
{{ attr.name_ns }}:{{ attr.name }}
|
|
28
32
|
({{ attr.gen_name }})
|
|
29
33
|
{%- endcapture -%}
|
|
30
34
|
| {{ name_col | newline_to_br }}
|
|
31
35
|
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
|
32
36
|
| {{ attr.definition }}
|
|
33
|
-
{%- endunless -%}
|
|
34
|
-
{
|
|
37
|
+
{%- endunless -%}
|
|
38
|
+
{% endfor %}
|
|
35
39
|
|
|
36
40
|
3+h| Self-defined Properties
|
|
37
41
|
h| Property Name h| Property Type and Multiplicity h| Definition
|
|
38
|
-
{%-
|
|
39
|
-
{
|
|
40
|
-
{%-
|
|
42
|
+
{%- assign self_props = root.owned_props | default: root.owned_attributes -%}
|
|
43
|
+
{% for attr in self_props %}
|
|
44
|
+
{%- unless attr.has_association? -%}
|
|
45
|
+
{%- capture name_col -%}
|
|
41
46
|
{{ attr.name_ns }}:{{ attr.name }}
|
|
42
47
|
({{ attr.gen_name }})
|
|
43
48
|
{%- endcapture -%}
|
|
44
49
|
| {{ name_col | newline_to_br }}
|
|
45
50
|
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
|
46
51
|
| {{ attr.definition }}
|
|
47
|
-
{%- endunless -%}
|
|
48
|
-
{
|
|
52
|
+
{%- endunless -%}
|
|
53
|
+
{% endfor %}
|
|
49
54
|
|
|
50
55
|
3+h| Properties Inherited from Association
|
|
51
56
|
h| Property Name h| Property Type and Multiplicity h| Definition
|
|
52
|
-
{
|
|
53
|
-
{%- if attr.has_association? -%}
|
|
54
|
-
{%- capture name_col -%}
|
|
57
|
+
{% for attr in root.inherited_assoc_props %}
|
|
58
|
+
{%- if attr.has_association? -%}
|
|
59
|
+
{%- capture name_col -%}
|
|
55
60
|
{{ attr.name_ns }}:{{ attr.name }}
|
|
56
61
|
({{ attr.gen_name }})
|
|
57
62
|
{%- endcapture -%}
|
|
58
63
|
| {{ name_col | newline_to_br }}
|
|
59
64
|
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
|
60
65
|
| {{ attr.definition }}
|
|
61
|
-
{%- endif -%}
|
|
62
|
-
{
|
|
66
|
+
{%- endif -%}
|
|
67
|
+
{% endfor %}
|
|
63
68
|
|
|
64
69
|
3+h| Properties Defined in Association
|
|
65
70
|
h| Property Name h| Property Type and Multiplicity h| Definition
|
|
66
|
-
{
|
|
67
|
-
{%- if attr.has_association? -%}
|
|
68
|
-
{%- capture name_col -%}
|
|
71
|
+
{% for attr in root.assoc_props %}
|
|
72
|
+
{%- if attr.has_association? -%}
|
|
73
|
+
{%- capture name_col -%}
|
|
69
74
|
{{ attr.name_ns }}:{{ attr.name }}
|
|
70
75
|
({{ attr.gen_name }})
|
|
71
76
|
{%- endcapture -%}
|
|
72
77
|
| {{ name_col | newline_to_br }}
|
|
73
78
|
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
|
|
74
79
|
| {{ attr.definition }}
|
|
75
|
-
{%- endif -%}
|
|
76
|
-
{
|
|
80
|
+
{%- endif -%}
|
|
81
|
+
{% endfor %}
|
|
77
82
|
|===
|
|
@@ -117,7 +117,21 @@ module Metanorma
|
|
|
117
117
|
parsed_template = template(lines)
|
|
118
118
|
parsed_template.registers[:file_system] =
|
|
119
119
|
build_file_system(document, options)
|
|
120
|
-
parsed_template.render(context_name => instances.to_h)
|
|
120
|
+
parsed_template.render(context_name => deep_stringify(instances.to_h))
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Liquid resolves variable lookups by string keys; the compiled
|
|
124
|
+
# LML models hash with symbols
|
|
125
|
+
def deep_stringify(value)
|
|
126
|
+
case value
|
|
127
|
+
when Hash
|
|
128
|
+
value.transform_keys(&:to_s)
|
|
129
|
+
.transform_values { |v| deep_stringify(v) }
|
|
130
|
+
when Array
|
|
131
|
+
value.map { |v| deep_stringify(v) }
|
|
132
|
+
else
|
|
133
|
+
value
|
|
134
|
+
end
|
|
121
135
|
end
|
|
122
136
|
|
|
123
137
|
def resolve_data_paths(document, definition_file, instance_file)
|
|
@@ -34,9 +34,6 @@ yaml_config_path = nil)
|
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
37
|
def find_packaged_klass(index, path, root_model_name: nil)
|
|
41
38
|
segments = path.split("::").reject(&:empty?)
|
|
42
39
|
if root_model_name && segments.first == root_model_name
|
|
@@ -108,7 +105,7 @@ yaml_config_path = nil)
|
|
|
108
105
|
def serialize_klass_or_datatype_drop_by_name(xmi_path,
|
|
109
106
|
name, _document = nil, guidance = nil)
|
|
110
107
|
serialize_klass_drop_by_name(xmi_path, name, _document, guidance) ||
|
|
111
|
-
serialize_datatype_drop_by_name(xmi_path, name, _document)
|
|
108
|
+
serialize_datatype_drop_by_name(xmi_path, name, _document, guidance)
|
|
112
109
|
end
|
|
113
110
|
|
|
114
111
|
def serialize_klass_drop_by_name(xmi_path,
|
|
@@ -127,18 +124,19 @@ yaml_config_path = nil)
|
|
|
127
124
|
)
|
|
128
125
|
end
|
|
129
126
|
|
|
130
|
-
def serialize_datatype_drop_by_name(xmi_path, name, _document = nil
|
|
127
|
+
def serialize_datatype_drop_by_name(xmi_path, name, _document = nil,
|
|
128
|
+
guidance = nil)
|
|
131
129
|
GcBudget.gc_when_bloated!
|
|
132
130
|
xmi_path, name, slice = XmiPartialLoadRegistry.rewrite(xmi_path, name)
|
|
133
131
|
parsed = XMI_PARSE_CACHE.fetch(xmi_path, slice: slice)
|
|
134
132
|
datatype = resolve_packaged_datatype(parsed, name)
|
|
135
133
|
if datatype.nil?
|
|
136
134
|
warn "Datatype not found for name: #{name}"
|
|
137
|
-
nil
|
|
135
|
+
return nil
|
|
138
136
|
end
|
|
139
137
|
|
|
140
138
|
::Ea::Xmi::LiquidDrops::DataTypeDrop.new(
|
|
141
|
-
datatype, parsed.drop_options
|
|
139
|
+
datatype, guidance, parsed.drop_options
|
|
142
140
|
)
|
|
143
141
|
end
|
|
144
142
|
|
|
@@ -32,13 +32,11 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.add_dependency "coradoc", "~> 1.1.8"
|
|
33
33
|
spec.add_dependency "ea", ">= 0.6.41" # Ea::Xmi.load/load_graph (lutaml/ea#86): the partial-load API this gem calls
|
|
34
34
|
spec.add_dependency "expressir", "~> 2.3", ">= 2.3.5"
|
|
35
|
-
spec.add_dependency "isodoc"
|
|
36
|
-
spec.add_dependency "liquid"
|
|
35
|
+
spec.add_dependency "isodoc", ">= 3.5.0"
|
|
36
|
+
spec.add_dependency "liquid", "~> 5"
|
|
37
37
|
spec.add_dependency "lutaml-lml"
|
|
38
38
|
spec.add_dependency "lutaml-model", "~> 0.8.4"
|
|
39
39
|
spec.add_dependency "lutaml-uml", ">= 0.5", "< 2"
|
|
40
40
|
spec.add_dependency "ogc-gml", "~> 1.1"
|
|
41
|
-
spec.add_dependency "relaton-cli"
|
|
42
|
-
|
|
43
41
|
spec.metadata["rubygems_mfa_required"] = "true"
|
|
44
42
|
end
|
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.7.
|
|
4
|
+
version: 0.7.55.pre.alpha.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|
|
@@ -78,28 +78,28 @@ dependencies:
|
|
|
78
78
|
requirements:
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
81
|
+
version: 3.5.0
|
|
82
82
|
type: :runtime
|
|
83
83
|
prerelease: false
|
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
86
|
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: 3.5.0
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
90
|
name: liquid
|
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
|
-
- - "
|
|
93
|
+
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
95
|
+
version: '5'
|
|
96
96
|
type: :runtime
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
|
-
- - "
|
|
100
|
+
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
102
|
+
version: '5'
|
|
103
103
|
- !ruby/object:Gem::Dependency
|
|
104
104
|
name: lutaml-lml
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -162,20 +162,6 @@ dependencies:
|
|
|
162
162
|
- - "~>"
|
|
163
163
|
- !ruby/object:Gem::Version
|
|
164
164
|
version: '1.1'
|
|
165
|
-
- !ruby/object:Gem::Dependency
|
|
166
|
-
name: relaton-cli
|
|
167
|
-
requirement: !ruby/object:Gem::Requirement
|
|
168
|
-
requirements:
|
|
169
|
-
- - ">="
|
|
170
|
-
- !ruby/object:Gem::Version
|
|
171
|
-
version: '0'
|
|
172
|
-
type: :runtime
|
|
173
|
-
prerelease: false
|
|
174
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
175
|
-
requirements:
|
|
176
|
-
- - ">="
|
|
177
|
-
- !ruby/object:Gem::Version
|
|
178
|
-
version: '0'
|
|
179
165
|
description: Metanorma plugin for LutaML
|
|
180
166
|
email:
|
|
181
167
|
- open.source@ribose.com
|