metanorma-plugin-lutaml 0.7.16 → 0.7.18

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.
data/README.adoc CHANGED
@@ -4,13 +4,15 @@ image:https://github.com/metanorma/metanorma-plugin-lutaml/workflows/rake/badge.
4
4
 
5
5
  == Purpose
6
6
 
7
- LutaML is a data model accessor that supports various data model formats,
8
- including:
7
+ LutaML is a data model accessor that supports various data model formats.
8
+
9
+ This plugin allows you to access the following types of information models from
10
+ within a Metanorma document:
9
11
 
10
12
  * EXPRESS (`*.exp` files)
11
- * OMG UML in XMI format (`*.xmi` files)
13
+ * LutaML-UML (`*.lutaml` files)
14
+ * Enterprise Architect exported UML in XMI format (`*.xmi` files)
12
15
 
13
- This plugin allows you to access LutaML models from within a Metanorma document.
14
16
 
15
17
  == Installation
16
18
 
@@ -24,11 +26,93 @@ $ gem install metanorma-plugin-lutaml
24
26
 
25
27
  === General
26
28
 
29
+ The LutaML plugin supports working with EXPRESS schema files to render EXPRESS
30
+ models and definitions.
31
+
27
32
  LutaML supports accessing EXPRESS models via the
28
33
  https://github.com/lutaml/expressir[Expressir] parser.
29
34
 
30
35
 
31
- === Usage of the `lutaml` command
36
+ === Document attribute `:lutaml-express-index:`
37
+
38
+ This attribute allows specifying one or more EXPRESS files to defined names
39
+ for later use with `lutaml_express` command.
40
+
41
+ Syntax:
42
+
43
+ [source,adoc]
44
+ ----
45
+ :lutaml-express-index: shortname_of_index; name_of_schemas_listing_file.yml;
46
+ ----
47
+
48
+ Where:
49
+
50
+ `shortname_of_index`:: is name of the parsed EXPRESS files context for the later
51
+ use.
52
+
53
+ `name_of_schemas_listing_file.yml`:: location of the YAML index file to parse
54
+ all EXPRESS files listed within.
55
+
56
+
57
+ [example]
58
+ .Define an index in the document and use it in the `lutaml_express` command
59
+ ====
60
+ [source,adoc]
61
+ -----
62
+ :lutaml-express-index: my_custom_name; /path/to/schemas.yml
63
+
64
+ [lutaml_express,my_custom_name,context]
65
+ ----
66
+ {% for schema in context.schemas %}
67
+ == {{schema.id}}
68
+
69
+ {% for entity in schema.entities %}
70
+ === {{entity.id}}
71
+ {% endfor %}
72
+
73
+ {% endfor %}
74
+ -----
75
+
76
+ Where the `schemas.yml` file contains:
77
+
78
+ [source,yaml]
79
+ ----
80
+ ---
81
+ schemas:
82
+ action_schema:
83
+ path: "../../schemas/resources/action_schema/action_schema.exp"
84
+ application_context_schema:
85
+ path: "../../schemas/resources/application_context_schema/application_context_schema.exp"
86
+ ----
87
+ ====
88
+
89
+
90
+ === Schemas listing file
91
+
92
+ The schemas listing file is a YAML file that lists all EXPRESS files to be
93
+ parsed. The file should have the following structure:
94
+
95
+ [source,yaml]
96
+ ----
97
+ ---
98
+ schemas:
99
+ schema_name:
100
+ path: path/to/schema_file.exp
101
+ schema_name_2:
102
+ path: path/to/schema_file_2.exp
103
+ ----
104
+
105
+ Where:
106
+
107
+ `schema_name`:: is the name of the EXPRESS schema.
108
+
109
+ `path`:: (optional) path to the EXPRESS schema file. When the path is not
110
+ specified, the command will look for the schema file in the directory where the
111
+ YAML file is located using the filename pattern `{schema_name}.exp`. The path
112
+ can be relative to the YAML file or an absolute path.
113
+
114
+
115
+ === Usage of the `lutaml_express` command
32
116
 
33
117
  Given an `example.exp` EXPRESS file with content:
34
118
 
@@ -57,13 +141,16 @@ SCHEMA test_schema 'test';
57
141
  END_SCHEMA;
58
142
  ----
59
143
 
60
- And the `lutaml` block:
144
+ And the `lutaml_express` block:
61
145
 
62
146
  [source,adoc]
63
147
  -----
64
- [lutaml,example.exp,my_context]
148
+ <<<<<<< HEAD
149
+ [lutaml_express,example.exp,my_context]
150
+ =======
151
+ [lutaml_express_liquid,example.exp,my_context]
152
+ >>>>>>> accd8ee (Remove obsolete codes of macros "lutaml" and "lutaml_express")
65
153
  ----
66
-
67
154
  {% for schema in my_context.schemas %}
68
155
  == {{schema.id}}
69
156
 
@@ -75,15 +162,20 @@ And the `lutaml` block:
75
162
  ----
76
163
  -----
77
164
 
165
+ NOTE: The `lutaml` command can auto-detect the EXPRESS schema file type by the
166
+ file extension. If the file extension is `.exp`, the command will use the
167
+ `Expressir` parser to parse the file. If the file extension is `.lutaml`, the
168
+ command will use the `Lutaml` parser to parse the file.
169
+
78
170
  Where:
79
171
 
80
172
  * content within the block is called the "`template`";
81
173
 
82
174
  * `{example.exp}` is the location of the EXPRESS schema file (`*.exp`) that
83
175
  contains data to be loaded. Location of the file is computed relative to the
84
- source directory that `[lutaml]` is used (e.g., if
85
- `[lutaml,example.exp,my_context]` is invoked in an `.adoc` file located at
86
- `/foo/bar/doc.adoc`, the data file is expected to be found at
176
+ source directory that `[lutaml_express_liquid]` is used (e.g., if
177
+ `[lutaml_express_liquid,example.exp,my_context]` is invoked in an `.adoc` file
178
+ located at `/foo/bar/doc.adoc`, the data file is expected to be found at
87
179
  `/foo/bar/example.exp`);
88
180
 
89
181
  * `{my_context}` is the name where the EXPRESS Repository read from the `.exp`
@@ -107,28 +199,27 @@ ____
107
199
  === my_type5
108
200
  ____
109
201
 
110
- This command also supports `.lutaml` files.
111
202
 
112
- Instead of using the direct path to the file one can use `lutaml-express-index`
203
+ Instead of using the direct path to the file one can use `:lutaml-express-index:`
113
204
  document attribute to supply directory with express files or YAML index file to
114
205
  parse as well as the cache file location.
115
206
 
116
- The syntax is as follows:
207
+ Syntax:
117
208
 
118
209
  [source,adoc]
119
- -----
210
+ ----
120
211
  :lutaml-express-index: my_custom_name; dir_or_index_path[; cache=cache_path]
121
- -----
212
+ ----
122
213
 
123
214
  Where:
124
215
 
125
- * `my_custom_name` - is name of the parsed EXPRESS files context for the later
126
- use with lutaml macro
216
+ `my_custom_name`:: is name of the parsed EXPRESS files context for the later
217
+ use with lutaml command
127
218
 
128
- * `dir_or_index_path` - location of directory with EXPRESS files or path to the
219
+ `dir_or_index_path`:: location of directory with EXPRESS files or path to the
129
220
  YAML index file to parse
130
221
 
131
- * `cache_path` - optional, location of the Expressir cache file to use
222
+ `cache_path`:: (optional) location of the Expressir cache file to use
132
223
 
133
224
  Example of usage:
134
225
 
@@ -138,7 +229,7 @@ Example of usage:
138
229
  Author
139
230
  :lutaml-express-index: index_name; /path/to/express_files; cache=/path/to/cache_file.yaml
140
231
 
141
- [lutaml,index_name,context]
232
+ [lutaml_express_liquid,index_name,context]
142
233
  ----
143
234
  {% for schema in context.schemas %}
144
235
  == {{schema.id}}
@@ -146,22 +237,29 @@ Author
146
237
  ----
147
238
  -----
148
239
 
149
- === Using `config.yaml`
240
+ * The `lutaml_express_liquid` macro processes the EXPRESS files specified by
241
+ the `index_name` and makes them available in the `context` as
242
+ Liquid Drops object.
150
243
 
151
- This functionality allows `[lutaml_express]` blocks to load a full set of
244
+ * The Liquid template inside the macro block iterates over the `schemas` in
245
+ the `context` and renders the attributes of each schema such as `id`.
246
+
247
+ === Using `config_yaml`
248
+
249
+ This functionality allows `[lutaml_express_liquid]` blocks to load a full set of
152
250
  EXPRESS schemas in one index, and then provide a select ("filter") option
153
251
  per-block via a separate YAML file.
154
252
 
155
253
  [source,adoc]
156
- ----
254
+ -----
157
255
  :lutaml-express-index: all_schemas; ../schemas_all.yaml;
158
256
 
159
- [lutaml_express,all_schemas,context,leveloffset=+1,config_yaml=schemas.yaml]
257
+ [lutaml_express_liquid,all_schemas,context,config_yaml=schemas.yaml]
160
258
  ---
161
259
  {% assign selected = context.schemas | where: "selected" %}
162
260
  {% render "templates/resources/schema" for selected as schema %}
163
- ---
164
261
  ----
262
+ -----
165
263
 
166
264
  Where `schemas_all.yml` provides all schemas:
167
265
 
@@ -196,17 +294,24 @@ via Liquid:
196
294
 
197
295
  [source,liquid]
198
296
  ----
199
- [lutaml_express,schemas_1,repo,leveloffset=+1,config_yaml=select.yaml]
297
+ [lutaml_express_liquid,schemas_1,repo,config_yaml=select.yaml]
200
298
  ---
201
299
  {% assign selected = repo.schemas | where: "selected" %}
202
300
  ... do things with `selected` ...
203
- ----
301
+ ---
302
+ -----
204
303
 
205
304
  NOTE: This functionality is used in the ISO 10303 SRL to load the full schema
206
305
  set at once but only render the selected schemas in individual documents.
207
306
 
208
307
 
209
- == Usage with UML
308
+ == Usage with Lutaml-UML
309
+
310
+ === General
311
+
312
+ The LutaML plugin supports working with LutaML UML files to render UML diagrams
313
+ and class definitions.
314
+
210
315
 
211
316
  === Rendering a LutaML view: `lutaml_diagram`
212
317
 
@@ -239,9 +344,9 @@ diagram MyView {
239
344
  The `lutaml_diagram` command will add the image to the document.
240
345
 
241
346
  [source,adoc]
242
- -----
347
+ ----
243
348
  lutaml_diagram::example.lutaml[]
244
- -----
349
+ ----
245
350
 
246
351
  The `lutaml_diagram` command can also be used to denote a block with an embedded
247
352
  LutaML view.
@@ -273,172 +378,7 @@ diagram MyView {
273
378
  ....
274
379
  ----
275
380
 
276
- === Rendering a LutaML Enterprise Architect diagram from XMI: `lutaml_ea_diagram`
277
-
278
- This command allows to quickly render a LutaML diagram as an image file by
279
- specifying the name of diagram.
280
-
281
- [source,adoc]
282
- -----
283
- lutaml_ea_diagram::[name="name_of_diagram",base_path="/path/to/xmi-images",format="png"]
284
- -----
285
-
286
- The code will search the diagram with name `name_of_diagram` and then
287
- render it as:
288
-
289
- [source,adoc]
290
- -----
291
- [[figure-{{ diagram.xmi_id }}]]
292
- .{{ diagram.name }}
293
- image::{{ image_base_path }}/{{ diagram.xmi_id }}.{{ format | default: 'png' }}[]
294
- -----
295
-
296
- === Rendering a LutaML GML Dictionary: `lutaml_gml_dictionary`
297
-
298
- This command allows to render a LutaML GML Dictionary by using Liquid Drop.
299
-
300
- GmlDictionaryDrop has the following attributes:
301
-
302
- * name
303
- * file_name
304
- * dictionary_entry
305
-
306
- Each `dictionary_entry` has the following attributes:
307
-
308
- * name
309
- * description
310
-
311
- [source,adoc]
312
- -----
313
- lutaml_gml_dictionary::/path/to/dictionary.xml[template="/path/to/template.liquid",context=dict]
314
- -----
315
-
316
- The command accepts the options listed below:
317
-
318
- * `/path/to/dictionary.xml` specifies the path of xml file of the
319
- GML Dictionary.
320
-
321
- * `template="/path/to/template.liquid"` specifies the liquid template.
322
- For example, you can create a liquid template and link it by `template`.
323
-
324
- * `context=dict` define the context in the template.
325
-
326
- [source,adoc]
327
- -----
328
- [cols="3a,22a"]
329
- |===
330
- | Name | {{ dict.file_name }}
331
-
332
- h| Code h| Description
333
- {% for entry in dict.dictionary_entry %}
334
- | {{ entry.name }} | {{ entry.description }}
335
- {% endfor %}
336
- |===
337
-
338
- [.source]
339
- <<source_link>>
340
- -----
341
-
342
- In spite of specifying the path of the template, you can also define an inline
343
- template within a block by
344
- `[lutaml_gml_dictionary,"/path/to/dictionary.xml",context=dict]`.
345
-
346
- [source,adoc]
347
- -----
348
- [lutaml_gml_dictionary,"/path/to/dictionary.xml",context=dict]
349
- --
350
- {% capture link %}https://www.test.com/{{ dict.file_name }}{% endcapture %}
351
-
352
- [cols="3a,22a"]
353
- |===
354
- | File Name | {{ dict.file_name }}
355
- h| URL | {{ link }}
356
- h| Help | Description
357
- {% for entry in dict.dictionary_entry %}
358
- | {{ entry.name }} | {{ entry.description }}
359
- {% endfor %}
360
- |===
361
-
362
- [.source]
363
- <<source_link>>
364
- --
365
- -----
366
-
367
- === Rendering a LutaML table of a class: `lutaml_klass_table`
368
-
369
- This command allows to render a LutaML table of a class by using Liquid Drop.
370
-
371
- The table will show:
372
-
373
- * Class Name
374
- * Class Definition
375
- * Inherited Properties
376
- * Self-defined Properties
377
- * Properties Inherited from Association
378
- * Properties Defined in Association
379
-
380
- [source,adoc]
381
- -----
382
- lutaml_klass_table::/path/to/example.xmi[name="NameOfClass",template="/path/to/templates/_my_klass_table.liquid"]
383
- -----
384
-
385
- The command accepts the options listed below:
386
-
387
- * `/path/to/example.xmi` specifies the path of xmi file.
388
-
389
- * `name` option only, `name` option with `package` option or `path` option.
390
- One of 3 forms of options can be used to specify the name of the class.
391
-
392
- ** `name="NameOfClass"` specifies the name of the `class`.
393
- (e.g. `name="Building"`)
394
- If there are multiple classes with the same name, other form of options
395
- are recommended to specify the class.
396
-
397
- ** `package="NameOfPackage"name="NameOfClass"` specifies the name of the
398
- `class` (specified by `name` option) inside the `package`
399
- (specified by `package` option).
400
- The `package` option must be used with the `name` option.
401
- (e.g. `package="uro",name="_BoundarySurface"`)
402
-
403
- ** `path="PathOfClass"` specifies the `absolute` path of the `class`
404
- which is started with `::`
405
- (e.g. `path="::EA_Model::Conceptual Models::i-UR::Urban Planning ADE 3.
406
- 1::uro::_BoundarySurface"`)
407
- or `relative` path of the `class` which is not started with `::`
408
- (e.g. `path="uro::_BoundarySurface"`).
409
- The last part of the path separated by `::` is the name of the `class`.
410
- The other parts of the path are the names of the `packages`.
411
-
412
- * `template="/path/to/templates/_my_klass_table.liquid"` specifies the path of
413
- the liquid template. (Optional)
414
- By default, it will look for the template `_klass_table.liquid` defined in
415
- `lib/metanorma/plugin/lutaml/templates`. This template can be customized by
416
- changing the template path in the `template` option.
417
-
418
- * `guidance="/path/to/my_guidance.yml"` specifies the path of
419
- the yaml file of the guidance. (Optional)
420
-
421
- The guidance file should be in the following format:
422
-
423
- [source,yaml]
424
- ----
425
- ---
426
- classes:
427
- - name: Name Of Class
428
- attributes:
429
- - name: Name Of Attribute (e.g. gml:boundedBy)
430
- used: false
431
- guidance: |
432
- Drop guidance message here.
433
- ...
434
- ----
435
-
436
- If you want to define the guidance, you can define the `name` of the class
437
- under `classes`. Then define which `attributes` you want to add guidance by the
438
- `name`. Set `used` to show the attribute is used or not. Drop the message of
439
- guidance in `guidance`.
440
-
441
- === Generating UML class and attributes: `lutaml_uml_class`
381
+ === Generating a UML class and attributes clause: `lutaml_uml_class`
442
382
 
443
383
  This command allows rendering a definition clause for a UML class.
444
384
 
@@ -503,17 +443,17 @@ ____
503
443
 
504
444
  The command accepts two options:
505
445
 
506
- * `skip_headers=true` (or just `skip_headers`). The initial heading (the UML class name)
446
+ `skip_headers=true`:: (or just `skip_headers`) The initial heading (the UML class name)
507
447
  will not be generated. This is useful if additional content is to be supplied
508
448
  to the clause, such as diagrams that are defined outside the UML model.
509
449
 
510
- * `depth={n}`. (default: `2`) This determines the depth of the generated headings.
450
+ `depth={n}`:: (default: `2`) This determines the depth of the generated headings.
511
451
  A depth of `2` means the initial heading will have 2 equal signs, and so forth.
512
452
  The heading depth of the attributes are in relation to the initial depth, so
513
453
  a depth of `2` will have the "Attributes" section at depth `3`.
514
454
 
515
455
 
516
- === `lutaml_uml_attributes_table`
456
+ === Generating a UML attributes table: `lutaml_uml_attributes_table`
517
457
 
518
458
  This command allows rendering definition tables for a UML model.
519
459
 
@@ -541,12 +481,12 @@ diagram MyView {
541
481
  }
542
482
  ----
543
483
 
544
- And the `lutaml_uml_attributes_table` macro:
484
+ And the `lutaml_uml_attributes_table` command:
545
485
 
546
486
  [source,adoc]
547
- -----
487
+ ----
548
488
  [lutaml_uml_attributes_table, example.lutaml, AttributeProfile]
549
- -----
489
+ ----
550
490
 
551
491
  Will produce this output:
552
492
 
@@ -568,9 +508,9 @@ ____
568
508
  In case of "enumeration" (AddressClassProfile) entity:
569
509
 
570
510
  [source,adoc]
571
- -----
511
+ ----
572
512
  [lutaml_uml_attributes_table, example.lutaml, AddressClassProfile]
573
- -----
513
+ ----
574
514
 
575
515
  Will produce this output:
576
516
 
@@ -586,20 +526,305 @@ ____
586
526
  |===
587
527
  ____
588
528
 
589
- === Usage of `lutaml_uml_datamodel_description` macro
590
529
 
591
- This command allows to quickly render data model packages and its dependent
592
- objects for supplied XMI file.
530
+ == Usage with Enterprise Architect (UML in XMI)
593
531
 
594
- Given an Enterprise Architect `example.xmi` file with 2 packages:
532
+ === General
595
533
 
596
- * 'Another'
597
- * 'CityGML'
534
+ The LutaML plugin supports working with Enterprise Architect exported XMI files
535
+ to render UML diagrams and class definitions.
536
+
537
+ The commands are prefixed as `lutaml_ea_*` to denote their specific use with
538
+ Enterprise Architect XMI files.
539
+
540
+
541
+ === Document attribute `:lutaml-xmi-index:`
542
+
543
+ This attribute allows specifying one or more XMI files to defined names
544
+ for later use with `lutaml_ea_*` commands.
598
545
 
599
- The `lutaml_uml_datamodel_description` macro can be used:
546
+ Syntax:
600
547
 
601
548
  [source,adoc]
602
- -----
549
+ ----
550
+ :lutaml-xmi-index: index_name; index_path[; config=config_path]
551
+ ----
552
+
553
+ where:
554
+
555
+ `index_name`:: name of index
556
+ `index_path`:: path to XMI file for the later use with `lutaml_ea_*` command
557
+ `config_path`:: optional, location of YAML configuration file that specifies
558
+ what packages to include in the render, what render style is desired and
559
+ location of the root package.
560
+
561
+
562
+ [example]
563
+ .Define two indexes in the document and use them in the `lutaml_ea_xmi` command
564
+ ====
565
+ [source,adoc]
566
+ ----
567
+ :lutaml-xmi-index: first-xmi-index; /path/to/first.xmi
568
+ :lutaml-xmi-index: second-xmi-index; /path/to/second.xmi; config=/path/to/config.yml
569
+
570
+ [lutaml_ea_xmi,index=first-xmi-index]
571
+ --
572
+ ...
573
+ --
574
+
575
+ lutaml_ea_diagram::[name="NameOfDiagramInSecondXmiIndex",base_path="./xmi-images",format="png",index="second-xmi-index"]
576
+ ...
577
+ ----
578
+
579
+ The command `lutaml_ea_xmi` will load the XMI file from the path
580
+ `/path/to/first.xmi` which is specified by the `index`: `first-xmi-index`.
581
+
582
+ The command `lutaml_ea_diagram` will load the XMI file from the path
583
+ `/path/to/second.xmi` which is specified by the `index`: `second-xmi-index`.
584
+ ====
585
+
586
+
587
+ === Rendering a Enterprise Architect diagram from XMI: `lutaml_ea_diagram`
588
+
589
+ This command allows to quickly render a LutaML diagram as an image file by
590
+ specifying the name of diagram.
591
+
592
+ Syntax:
593
+
594
+ [source,adoc]
595
+ ----
596
+ lutaml_ea_diagram::[{options}]
597
+ ----
598
+
599
+ where `{options}` is a hash of options, where:
600
+
601
+ `name`:: (mandatory) name of the diagram to render.
602
+ `base_path`:: (mandatory) base path where the diagram images are located.
603
+ `format`:: (optional) format of the image file. Defaults to `png`.
604
+ `index`:: (optional) index name of the XMI file. If the index is not provided,
605
+ the command will look for the diagram in the first XMI file specified through
606
+ the `lutaml_ea_xmi` command.
607
+ `package`:: (optional) name of the package which contains the diagram. If the
608
+ package is not provided, the command will look for the diagram across all
609
+ packages in the XMI file.
610
+
611
+ The diagram with name `name_of_diagram` will be converted into the following
612
+ Metanorma block:
613
+
614
+ [source,adoc]
615
+ ----
616
+ [[figure-{{ diagram.xmi_id }}]]
617
+ .{{ diagram.name }}
618
+ image::{{ image_base_path }}/{{ diagram.xmi_id }}.{{ format | default: 'png' }}[]
619
+ ----
620
+
621
+ [example]
622
+ .Specifying a diagram within an XMI file
623
+ ====
624
+ [source,adoc]
625
+ ----
626
+ lutaml_ea_diagram::[name="name_of_diagram",base_path="/path/to/xmi-images",format="png"]
627
+ ----
628
+
629
+ Renders the diagram with name `name_of_diagram` from the XMI file in PNG format,
630
+ where the EA images exported with the XMI file are at `/path/to/xmi-images`.
631
+ ====
632
+
633
+ [example]
634
+ .Specifying a diagram within a specific package (if there are multiple diagrams with the same name)
635
+ ====
636
+ [source,adoc]
637
+ ----
638
+ lutaml_ea_diagram::[name="DiagramName",package="PackageA",base_path="/path/to/xmi-images"]
639
+ ----
640
+
641
+ The search wil be restricted to the diagrams named `DiagramName` in the
642
+ `PackageA` package.
643
+ ====
644
+
645
+ [example]
646
+ .Specifying a diagram using a specific index
647
+ ====
648
+ [source,adoc]
649
+ ----
650
+ :lutaml-xmi-index: index_name; /path/to/xmi-file.xmi
651
+
652
+ ...
653
+
654
+ lutaml_ea_diagram::[name="name_of_diagram",base_path="/path/to/xmi-images",format="png",index="index_name"]
655
+ ----
656
+
657
+ Renders the diagram with name `name_of_diagram` from the XMI file in PNG format,
658
+ where the EA images exported with the XMI file are at `/path/to/xmi-images` and
659
+ the XMI file defined in the index `index_name`.
660
+ ====
661
+
662
+
663
+
664
+ === Generating a class definition table for a class: `lutaml_klass_table`
665
+
666
+ This command allows to render a LutaML table of a class by using Liquid Drop.
667
+
668
+ The table will show:
669
+
670
+ * Class Name
671
+ * Class Definition
672
+ * Inherited Properties
673
+ * Self-defined Properties
674
+ * Properties Inherited from Association
675
+ * Properties Defined in Association
676
+
677
+ [source,adoc]
678
+ ----
679
+ lutaml_klass_table::/path/to/example.xmi[name="NameOfClass",template="/path/to/templates/_my_klass_table.liquid"]
680
+ ----
681
+
682
+ The command accepts the options listed below:
683
+
684
+ * `/path/to/example.xmi` specifies the path of xmi file.
685
+
686
+ * `name` option only, `name` option with `package` option or `path` option.
687
+ One of 3 forms of options can be used to specify the name of the class.
688
+
689
+ ** `name="NameOfClass"` specifies the name of the `class`.
690
+ (e.g. `name="Building"`)
691
+ If there are multiple classes with the same name, other form of options
692
+ are recommended to specify the class.
693
+
694
+ ** `package="NameOfPackage"name="NameOfClass"` specifies the name of the
695
+ `class` (specified by `name` option) inside the `package`
696
+ (specified by `package` option).
697
+ The `package` option must be used with the `name` option.
698
+ (e.g. `package="uro",name="_BoundarySurface"`)
699
+
700
+ ** `path="PathOfClass"` specifies the `absolute` path of the `class`
701
+ which is started with `::`
702
+ (e.g. `path="::EA_Model::Conceptual Models::i-UR::Urban Planning ADE 3.
703
+ 1::uro::_BoundarySurface"`)
704
+ or `relative` path of the `class` which is not started with `::`
705
+ (e.g. `path="uro::_BoundarySurface"`).
706
+ The last part of the path separated by `::` is the name of the `class`.
707
+ The other parts of the path are the names of the `packages`.
708
+
709
+ * `template="/path/to/templates/_my_klass_table.liquid"` specifies the path of
710
+ the liquid template. (Optional)
711
+ By default, it will look for the template `_klass_table.liquid` defined in
712
+ `lib/metanorma/plugin/lutaml/templates`. This template can be customized by
713
+ changing the template path in the `template` option.
714
+
715
+ * `guidance="/path/to/my_guidance.yml"` specifies the path of
716
+ the yaml file of the guidance. (Optional)
717
+
718
+ The guidance file should be in the following format:
719
+
720
+ [source,yaml]
721
+ ----
722
+ ---
723
+ classes:
724
+ - name: Name Of Class
725
+ attributes:
726
+ - name: Name Of Attribute (e.g. gml:boundedBy)
727
+ used: false
728
+ guidance: |
729
+ Drop guidance message here.
730
+ ...
731
+ ----
732
+
733
+ If you want to define the guidance, you can define the `name` of the class
734
+ under `classes`. Then define which `attributes` you want to add guidance by the
735
+ `name`. Set `used` to show the attribute is used or not. Drop the message of
736
+ guidance in `guidance`.
737
+
738
+
739
+
740
+
741
+ === Usage of `lutaml_ea_xmi` command
742
+
743
+ The `lutaml_ea_xmi` command supersedes the `lutaml_uml_datamodel_description`
744
+ command which it is functionally equivalent to.
745
+
746
+ This command renders data model packages and its dependent objects for supplied
747
+ XMI file, by using Liquid Drop objects.
748
+
749
+ NOTE: The performance of `lutaml_ea_xmi` exceeds
750
+ `lutaml_uml_datamodel_description` by 10~20 times (Tested with a 10.6MB XMI file
751
+ with 120,000+ lines).
752
+
753
+ NOTE: To migrate to this command from `lutaml_uml_datamodel_description`, just
754
+ replace the command `lutaml_uml_datamodel_description` by `lutaml_ea_xmi`.
755
+
756
+ Replace:
757
+
758
+ [source,adoc]
759
+ ----
760
+ [lutaml_uml_datamodel_description, path/to/example.xmi]
761
+ ...
762
+ ----
763
+
764
+ By:
765
+
766
+ [source,adoc]
767
+ ----
768
+ [lutaml_ea_xmi, path/to/example.xmi]
769
+ ...
770
+ ----
771
+
772
+ You can define guidance in the configuration file as well. The configuration
773
+ file will looks like:
774
+
775
+ [source,yaml]
776
+ ----
777
+ packages:
778
+ - my_package
779
+ guidance: "path/to/guidance.yaml"
780
+ ----
781
+
782
+ The guidance file should be in the following format:
783
+
784
+ [source,yaml]
785
+ ----
786
+ ---
787
+ classes:
788
+ - name: "NameOfClass"
789
+ attributes:
790
+ - name: Name Of Attribute (e.g. gml:boundedBy)
791
+ used: false
792
+ guidance: |
793
+ Drop guidance message here.
794
+ ...
795
+ ----
796
+
797
+ If you want to define the guidance, you can define the `name` of the class
798
+ under `classes`. Then define which `attributes` you want to add guidance by the
799
+ `name`. Set `used` to show the attribute is used or not. Drop the message of
800
+ guidance in `guidance`.
801
+
802
+ The `name` of class can be defined in the following ways:
803
+
804
+ * `name: "NameOfClass"` specifies the name of the `class`.
805
+ (e.g. `name: "Building"`)
806
+ If there are multiple classes with the same name, it is recommended to
807
+ specify the class by absolute path.
808
+
809
+ * `name: "::NameOfPackage::NameOfClass"` specifies the name of the `class` in
810
+ `absolute` path.
811
+ (e.g. `name: "::EA_Model::Conceptual Models::CityGML2.0::bldg::Building"`)
812
+
813
+
814
+ === Usage of `lutaml_uml_datamodel_description` command
815
+
816
+ This command allows to quickly render data model packages and its dependent
817
+ objects for supplied XMI file.
818
+
819
+ Given an Enterprise Architect `example.xmi` file with 2 packages:
820
+
821
+ * 'Another'
822
+ * 'CityGML'
823
+
824
+ The `lutaml_uml_datamodel_description` command can be used:
825
+
826
+ [source,adoc]
827
+ ----
603
828
  [lutaml_uml_datamodel_description, path/to/example.xmi]
604
829
  --
605
830
  [.before]
@@ -643,15 +868,15 @@ footer text
643
868
  ....
644
869
  --
645
870
  --
646
- -----
871
+ ----
647
872
 
648
873
  Where:
649
874
 
650
875
  * `path/to/example.xmi` - required, path to the XMI file to render
651
876
 
652
- * `[.before]` - block text that adds additional text before the rendered output, can be used only once, additional occurrences of macro will overwrite text, not that `literal` block style must be used in there(eg `....`)
877
+ * `[.before]` - block text that adds additional text before the rendered output, can be used only once, additional occurrences of command will overwrite text, not that `literal` block style must be used in there(eg `....`)
653
878
 
654
- * `[.after]` - block text that adds additional text after the rendered output, can be used only once, additional occurrences of macro will overwrite text
879
+ * `[.after]` - block text that adds additional text after the rendered output, can be used only once, additional occurrences of command will overwrite text
655
880
 
656
881
  * `[.after, package="Another"]` - block text to be inserted before(after in case of `.before` name) the package
657
882
 
@@ -663,7 +888,7 @@ Where:
663
888
  +
664
889
  The logic is as follows:
665
890
  [source,adoc]
666
- -----
891
+ ----
667
892
  {% for diagram in package.diagrams %}
668
893
  [[figure-{{ diagram.xmi_id }}]]
669
894
  .{{ diagram.name }}
@@ -673,18 +898,21 @@ image::{{ image_base_path }}/{{ diagram.xmi_id }}.{{ format | default: 'png' }}[
673
898
  {{ diagram.definition | html2adoc }}
674
899
  {% endif %}
675
900
  {% endfor %}
676
- -----
901
+ ----
677
902
 
678
- 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.
903
+ 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 command text, it will be added as paragraph before each image include.
679
904
 
680
905
  * `[.diagram_include_block, package="Another"]` - same as above, but diagram will be included only for supplied package name
681
906
 
682
- * `[.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`.
907
+ * `[.include_block, base_path="spec/fixtures"]` - command 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. command 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`, command will look for the following file path: `my/path/_my_package_name.adoc`.
683
908
 
684
909
  * `[.include_block, package="Another", base_path="spec/fixtures"]` - same as above, but include block will be included only for supplied package name
685
910
 
686
911
 
687
- NOTE: .after, .before, package_text and include_block macroses all can be used with additional option - `liquid`, if this option is supplied then the code inside block will be interpolated in liquid context
912
+ NOTE: .after, .before, package_text and include_block commandses all can be used with additional option - `liquid`, if this option is supplied then the code inside block will be interpolated in liquid context
913
+
914
+
915
+ === Referencing objects generated by LutaML
688
916
 
689
917
 
690
918
  There are two other commands that are used to refer to LutaML generated document elements:
@@ -695,10 +923,11 @@ There are two other commands that are used to refer to LutaML generated document
695
923
  * `lutaml_table`. Provides a reference anchor to the definition tables of a
696
924
  particular package, class, enumeration or data type object in the XMI.
697
925
 
926
+
698
927
  The syntax is as follows:
699
928
 
700
929
  [source,adoc]
701
- -----
930
+ ----
702
931
  // For lutaml_figure
703
932
  This is lutaml_figure::[package="Wrapper root package", name="Fig B1 Full model"] figure
704
933
 
@@ -707,14 +936,14 @@ This is lutaml_table::[package="Wrapper root package"] package
707
936
  This is lutaml_table::[package="Wrapper root package", class="my name"] class
708
937
  This is lutaml_table::[package="Wrapper root package", enum="my name"] enumeration
709
938
  This is lutaml_table::[package="Wrapper root package", data_type="my name"] data type
710
- -----
939
+ ----
711
940
 
712
- 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.
941
+ This code will be transformed into `<<figure-{diagram.xmi_id}>>` and will point to diagram figure. One can only use this command when document rendered `lutaml_uml_datamodel_description` command as it needs diagram lookup table in order to reference package diagram.
713
942
 
714
943
  Will produce this output:
715
944
 
716
945
  [source,adoc]
717
- -----
946
+ ----
718
947
  my text
719
948
  == CityGML package
720
949
  === CityGML overview
@@ -785,9 +1014,9 @@ h|Constraints: 7+| (none)
785
1014
  === Additional Information
786
1015
 
787
1016
  text after CityGML package
788
- -----
1017
+ ----
789
1018
 
790
- In addition to the XMI file, this macro also supports a YAML configuration file
1019
+ In addition to the XMI file, this command also supports a YAML configuration file
791
1020
  that specifies:
792
1021
 
793
1022
  * What packages to include in the render;
@@ -853,7 +1082,7 @@ equal to 2, root package will be `one-1`.
853
1082
  ]
854
1083
  ----
855
1084
 
856
- Usage with macro:
1085
+ Usage with command:
857
1086
 
858
1087
  [source,adoc]
859
1088
  --
@@ -870,73 +1099,82 @@ and iterate through packages according to the order supplied in the file. All
870
1099
  packages that matches `skip` in the YAML config file will be skipped during
871
1100
  render.
872
1101
 
873
- === Usage of `lutaml_ea_xmi` macro
874
1102
 
875
- This command is a replacement for `lutaml_uml_datamodel_description` to perform
876
- the same functionalities of `lutaml_uml_datamodel_description`, which is to
877
- render data model packages and its dependent objects for supplied XMI file, by
878
- using Liquid Drop. The performance of `lutaml_ea_xmi` can be improved by
879
- 10~20 times. (Tested with a 10.6MB XMI file with 120000+ lines)
880
1103
 
881
- To use this macro, you only need to replace `lutaml_uml_datamodel_description`
882
- by `lutaml_ea_xmi`.
883
1104
 
884
- Replace:
1105
+ == Usage with GML
885
1106
 
886
- [source,adoc]
887
- -----
888
- [lutaml_uml_datamodel_description, path/to/example.xmi]
889
- ...
890
- -----
1107
+ === Rendering a LutaML GML Dictionary: `lutaml_gml_dictionary`
891
1108
 
892
- By:
1109
+ This command allows to render a LutaML GML Dictionary by using Liquid Drop.
1110
+
1111
+ GmlDictionaryDrop has the following attributes:
1112
+
1113
+ * name
1114
+ * file_name
1115
+ * dictionary_entry
1116
+
1117
+ Each `dictionary_entry` has the following attributes:
1118
+
1119
+ * name
1120
+ * description
893
1121
 
894
1122
  [source,adoc]
895
- -----
896
- [lutaml_ea_xmi, path/to/example.xmi]
897
- ...
898
- -----
1123
+ ----
1124
+ lutaml_gml_dictionary::/path/to/dictionary.xml[template="/path/to/template.liquid",context=dict]
1125
+ ----
899
1126
 
900
- You can define guidance in the configuration file as well. The configuration
901
- file will looks like:
1127
+ The command accepts the options listed below:
902
1128
 
903
- [source,yaml]
904
- -----
905
- packages:
906
- - my_package
907
- guidance: "path/to/guidance.yaml"
908
- -----
1129
+ * `/path/to/dictionary.xml` specifies the path of xml file of the
1130
+ GML Dictionary.
909
1131
 
910
- The guidance file should be in the following format:
1132
+ * `template="/path/to/template.liquid"` specifies the liquid template.
1133
+ For example, you can create a liquid template and link it by `template`.
911
1134
 
912
- [source,yaml]
1135
+ * `context=dict` define the context in the template.
1136
+
1137
+ [source,adoc]
913
1138
  ----
914
- ---
915
- classes:
916
- - name: "NameOfClass"
917
- attributes:
918
- - name: Name Of Attribute (e.g. gml:boundedBy)
919
- used: false
920
- guidance: |
921
- Drop guidance message here.
922
- ...
1139
+ [cols="3a,22a"]
1140
+ |===
1141
+ | Name | {{ dict.file_name }}
1142
+
1143
+ h| Code h| Description
1144
+ {% for entry in dict.dictionary_entry %}
1145
+ | {{ entry.name }} | {{ entry.description }}
1146
+ {% endfor %}
1147
+ |===
1148
+
1149
+ [.source]
1150
+ <<source_link>>
923
1151
  ----
924
1152
 
925
- If you want to define the guidance, you can define the `name` of the class
926
- under `classes`. Then define which `attributes` you want to add guidance by the
927
- `name`. Set `used` to show the attribute is used or not. Drop the message of
928
- guidance in `guidance`.
1153
+ In spite of specifying the path of the template, you can also define an inline
1154
+ template within a block by
1155
+ `[lutaml_gml_dictionary,"/path/to/dictionary.xml",context=dict]`.
929
1156
 
930
- The `name` of class can be defined in the following ways:
1157
+ [source,adoc]
1158
+ ----
1159
+ [lutaml_gml_dictionary,"/path/to/dictionary.xml",context=dict]
1160
+ --
1161
+ {% capture link %}https://www.test.com/{{ dict.file_name }}{% endcapture %}
931
1162
 
932
- * `name: "NameOfClass"` specifies the name of the `class`.
933
- (e.g. `name: "Building"`)
934
- If there are multiple classes with the same name, it is recommended to
935
- specify the class by absolute path.
1163
+ [cols="3a,22a"]
1164
+ |===
1165
+ | File Name | {{ dict.file_name }}
1166
+ h| URL | {{ link }}
1167
+ h| Help | Description
1168
+ {% for entry in dict.dictionary_entry %}
1169
+ | {{ entry.name }} | {{ entry.description }}
1170
+ {% endfor %}
1171
+ |===
1172
+
1173
+ [.source]
1174
+ <<source_link>>
1175
+ --
1176
+ ----
936
1177
 
937
- * `name: "::NameOfPackage::NameOfClass"` specifies the name of the `class` in
938
- `absolute` path.
939
- (e.g. `name: "::EA_Model::Conceptual Models::CityGML2.0::bldg::Building"`)
940
1178
 
941
1179
  == Documentation
942
1180