lutaml 0.11.4 → 0.11.6
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/.github/workflows/docs.yml +28 -5
- data/.github/workflows/links.yml +14 -0
- data/README.adoc +6 -43
- data/docs/_config.yml +1 -1
- data/docs/_guides/cli-usage.adoc +43 -0
- data/docs/_guides/diagram-generation.adoc +3 -3
- data/docs/_guides/index.adoc +21 -20
- data/docs/_guides/parsing/index.adoc +9 -8
- data/docs/_guides/parsing/qea-parsing.adoc +47 -0
- data/docs/_guides/repository-management.adoc +44 -0
- data/docs/_guides/sysml-modeling.adoc +2 -2
- data/docs/_guides/uml-modeling.adoc +3 -5
- data/docs/_pages/concepts/diagram-generation.adoc +4 -4
- data/docs/_pages/concepts/lur-format.adoc +4 -4
- data/docs/_pages/concepts/qea-parsing.adoc +4 -4
- data/docs/_pages/concepts/uml-models.adoc +43 -0
- data/docs/_pages/core/architecture.adoc +4 -4
- data/docs/_pages/core/installation.adoc +7 -7
- data/docs/_pages/core/overview.adoc +10 -10
- data/docs/_pages/index.adoc +11 -10
- data/docs/_pages/uml-syntax.adoc +41 -25
- data/docs/_references/api/parsers.adoc +61 -0
- data/docs/_references/api/presenters.adoc +43 -0
- data/docs/_references/api/repository.adoc +67 -0
- data/docs/_references/cli/commands.adoc +72 -0
- data/docs/_references/configuration/diagram-styles.adoc +3 -3
- data/docs/_references/configuration/index.adoc +5 -4
- data/docs/_references/configuration/package-metadata.adoc +4 -4
- data/docs/_references/formats/index.adoc +5 -4
- data/docs/_references/formats/lur-format.adoc +39 -0
- data/docs/_references/formats/qea-structure.adoc +4 -4
- data/docs/_references/index.adoc +26 -25
- data/docs/_tutorials/documentation-site.adoc +47 -0
- data/docs/_tutorials/first-lur-package.adoc +45 -0
- data/docs/_tutorials/generating-diagrams.adoc +42 -0
- data/docs/_tutorials/getting-started.adoc +45 -0
- data/docs/_tutorials/index.adoc +28 -37
- data/docs/_tutorials/querying-models.adoc +44 -0
- data/docs/examples/build_package.rb +12 -0
- data/docs/examples/build_site.rb +12 -0
- data/docs/examples/city_model.rb +21 -0
- data/docs/examples/present_class.rb +10 -0
- data/docs/examples/query_model.rb +12 -0
- data/docs/examples/render_diagram.rb +11 -0
- data/docs/index.adoc +12 -12
- data/docs/lychee.toml +24 -57
- data/lib/lutaml/version.rb +1 -1
- data/lutaml.gemspec +1 -1
- data/scripts/check-site-urls.rb +54 -0
- data/scripts/check-vendor-link.py +64 -0
- metadata +26 -4
data/docs/_references/index.adoc
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
= Reference
|
|
2
|
+
:page-permalink: /references/
|
|
2
3
|
:nav_order: 4
|
|
3
4
|
:has_children: true
|
|
4
5
|
|
|
@@ -8,26 +9,26 @@ This section provides detailed technical specifications, API documentation, and
|
|
|
8
9
|
|
|
9
10
|
== Command-Line Interface
|
|
10
11
|
|
|
11
|
-
=== link:cli/commands[Complete Command Reference]
|
|
12
|
+
=== link:{site-baseurl}/references/cli/commands/[Complete Command Reference]
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Current executable compatibility and Ruby replacements for the historical UML commands.
|
|
14
15
|
|
|
15
|
-
===
|
|
16
|
+
=== Historical Commands and Ruby Replacements
|
|
16
17
|
|
|
17
|
-
* link:cli/build[`lutaml uml build`] - Build LUR packages
|
|
18
|
-
* link:cli/search[`lutaml uml search`] - Search models
|
|
19
|
-
* link:cli/export[`lutaml uml export`] - Export data
|
|
20
|
-
* link:cli/ls[`lutaml uml ls`] - List elements
|
|
21
|
-
* link:cli/tree[`lutaml uml tree`] - Show hierarchy
|
|
22
|
-
* link:cli/stats[`lutaml uml stats`] - Statistics
|
|
23
|
-
* link:cli/docs[`lutaml uml docs`] - Generate docs
|
|
24
|
-
* link:cli/serve[`lutaml uml serve`] - Start server
|
|
18
|
+
* link:{site-baseurl}/references/cli/commands/#build[`lutaml uml build`] - Build LUR packages
|
|
19
|
+
* link:{site-baseurl}/references/cli/commands/#search[`lutaml uml search`] - Search models
|
|
20
|
+
* link:{site-baseurl}/references/cli/commands/#export[`lutaml uml export`] - Export data
|
|
21
|
+
* link:{site-baseurl}/references/cli/commands/#ls[`lutaml uml ls`] - List elements
|
|
22
|
+
* link:{site-baseurl}/references/cli/commands/#tree[`lutaml uml tree`] - Show hierarchy
|
|
23
|
+
* link:{site-baseurl}/references/cli/commands/#stats[`lutaml uml stats`] - Statistics
|
|
24
|
+
* link:{site-baseurl}/references/cli/commands/#docs[`lutaml uml docs`] - Generate docs
|
|
25
|
+
* link:{site-baseurl}/references/cli/commands/#serve[`lutaml uml serve`] - Start server
|
|
25
26
|
|
|
26
27
|
== API Documentation
|
|
27
28
|
|
|
28
29
|
=== Core APIs
|
|
29
30
|
|
|
30
|
-
==== link:api/repository[Repository API]
|
|
31
|
+
==== link:{site-baseurl}/references/api/repository/[Repository API]
|
|
31
32
|
|
|
32
33
|
Complete API reference for `Lutaml::UmlRepository::Repository` class.
|
|
33
34
|
|
|
@@ -38,9 +39,9 @@ Complete API reference for `Lutaml::UmlRepository::Repository` class.
|
|
|
38
39
|
* Index management
|
|
39
40
|
* Statistics calculation
|
|
40
41
|
|
|
41
|
-
==== link:api/parsers[Parser APIs]
|
|
42
|
+
==== link:{site-baseurl}/references/api/parsers/[Parser APIs]
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
Entry points and result types for LML, EXPRESS, LUR, and external importers.
|
|
44
45
|
|
|
45
46
|
**Topics:**
|
|
46
47
|
|
|
@@ -49,7 +50,7 @@ Reference for all parser interfaces and implementations.
|
|
|
49
50
|
* Parser options
|
|
50
51
|
* Error handling
|
|
51
52
|
|
|
52
|
-
==== link:api/presenters[Presenter APIs]
|
|
53
|
+
==== link:{site-baseurl}/references/api/presenters/[Presenter APIs]
|
|
53
54
|
|
|
54
55
|
Documentation for element presentation and formatting.
|
|
55
56
|
|
|
@@ -68,14 +69,14 @@ Complete reference for the query DSL syntax and methods.
|
|
|
68
69
|
|
|
69
70
|
* `Lutaml::Uml::Document`
|
|
70
71
|
* `Lutaml::Uml::Package`
|
|
71
|
-
* `Lutaml::Uml::
|
|
72
|
-
* `Lutaml::Uml::
|
|
72
|
+
* `Lutaml::Uml::UmlClass`
|
|
73
|
+
* `Lutaml::Uml::TopElementAttribute`
|
|
73
74
|
* `Lutaml::Uml::Association`
|
|
74
75
|
* `Lutaml::Uml::Diagram`
|
|
75
76
|
|
|
76
77
|
== File Formats
|
|
77
78
|
|
|
78
|
-
=== link:formats/qea-structure[QEA File Format]
|
|
79
|
+
=== link:{site-baseurl}/references/formats/qea-structure/[QEA File Format]
|
|
79
80
|
|
|
80
81
|
Complete specification of Enterprise Architect's QEA (SQLite) database format.
|
|
81
82
|
|
|
@@ -86,7 +87,7 @@ Complete specification of Enterprise Architect's QEA (SQLite) database format.
|
|
|
86
87
|
* Data types
|
|
87
88
|
* Supported EA versions
|
|
88
89
|
|
|
89
|
-
=== link:formats/lur-format[LUR Package Format]
|
|
90
|
+
=== link:{site-baseurl}/references/formats/lur-format/[LUR Package Format]
|
|
90
91
|
|
|
91
92
|
Specification of LutaML's compressed repository format.
|
|
92
93
|
|
|
@@ -97,7 +98,7 @@ Specification of LutaML's compressed repository format.
|
|
|
97
98
|
* Versioning
|
|
98
99
|
* Metadata
|
|
99
100
|
|
|
100
|
-
=== link:formats/lutaml-syntax[LutaML Syntax]
|
|
101
|
+
=== link:{site-baseurl}/references/formats/lutaml-syntax/[LutaML Syntax]
|
|
101
102
|
|
|
102
103
|
Complete syntax reference for LutaML's native DSL.
|
|
103
104
|
|
|
@@ -118,7 +119,7 @@ ISO 10303-11 EXPRESS schema support via Expressir.
|
|
|
118
119
|
|
|
119
120
|
== Configuration
|
|
120
121
|
|
|
121
|
-
=== link:configuration/diagram-styles[Diagram Styling Configuration]
|
|
122
|
+
=== link:{site-baseurl}/references/configuration/diagram-styles/[Diagram Styling Configuration]
|
|
122
123
|
|
|
123
124
|
Complete YAML schema for diagram style configuration.
|
|
124
125
|
|
|
@@ -129,7 +130,7 @@ Complete YAML schema for diagram style configuration.
|
|
|
129
130
|
* Connector types
|
|
130
131
|
* Priority rules
|
|
131
132
|
|
|
132
|
-
=== link:configuration/package-metadata[Package Metadata Configuration]
|
|
133
|
+
=== link:{site-baseurl}/references/configuration/package-metadata/[Package Metadata Configuration]
|
|
133
134
|
|
|
134
135
|
YAML schema for package metadata including XML namespaces.
|
|
135
136
|
|
|
@@ -192,6 +193,6 @@ Operating system and platform compatibility.
|
|
|
192
193
|
|
|
193
194
|
== Related Sections
|
|
194
195
|
|
|
195
|
-
* link
|
|
196
|
-
* link
|
|
197
|
-
* link
|
|
196
|
+
* link:{site-baseurl}/core/[Core Topics] - Fundamental concepts
|
|
197
|
+
* link:{site-baseurl}/tutorials/[Tutorials] - Step-by-step learning
|
|
198
|
+
* link:{site-baseurl}/guides/[Guides] - Task-oriented documentation
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /tutorials/documentation-site/
|
|
3
|
+
title: Creating a Documentation Site
|
|
4
|
+
parent: Tutorials
|
|
5
|
+
nav_order: 4
|
|
6
|
+
---
|
|
7
|
+
= Creating a Documentation Site
|
|
8
|
+
|
|
9
|
+
Generate a model browser from the small repository in
|
|
10
|
+
link:{site-baseurl}/tutorials/getting-started/[Getting Started].
|
|
11
|
+
This uses the Ruby static-site API in `lutaml-uml`, rather than the historical
|
|
12
|
+
`lutaml uml build-spa` command.
|
|
13
|
+
|
|
14
|
+
== Generate the browser
|
|
15
|
+
|
|
16
|
+
Save this as `build_site.rb` beside `city_model.rb`:
|
|
17
|
+
|
|
18
|
+
[source,ruby]
|
|
19
|
+
----
|
|
20
|
+
include::../examples/build_site.rb[]
|
|
21
|
+
----
|
|
22
|
+
|
|
23
|
+
Run `bundle exec ruby build_site.rb browser.html` with a new output filename.
|
|
24
|
+
The script verifies that the generator wrote a nonempty HTML file.
|
|
25
|
+
It explicitly loads `lutaml/uml/version`, which the current generator uses
|
|
26
|
+
when constructing its metadata.
|
|
27
|
+
|
|
28
|
+
== Serve and inspect
|
|
29
|
+
|
|
30
|
+
Serve the output directory with an HTTP server. For example, if Python 3 is
|
|
31
|
+
available, run `python3 -m http.server 8000` there, then open
|
|
32
|
+
`http://localhost:8000/browser.html`. Check that the City package and Building
|
|
33
|
+
class appear, and search for Building.
|
|
34
|
+
|
|
35
|
+
Generating a file does not publish a website. Upload the generated output to
|
|
36
|
+
your chosen static host when you are ready to publish it.
|
|
37
|
+
|
|
38
|
+
== Use an existing model
|
|
39
|
+
|
|
40
|
+
Load a LUR package with `Repository.from_package` and pass the resulting
|
|
41
|
+
repository to `StaticSite.generate`. Set `mode: :multi_file` and an output
|
|
42
|
+
directory to produce separate assets instead of a single HTML file.
|
|
43
|
+
Use `config_path:` to select a static-site configuration file; diagram styling
|
|
44
|
+
and package metadata are separate configuration concerns.
|
|
45
|
+
|
|
46
|
+
The example has no stored EA diagrams. Generating a model browser does not
|
|
47
|
+
prove that QEA import or EA SVG rendering is available in the installed bundle.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /tutorials/first-lur-package/
|
|
3
|
+
title: Building Your First LUR Package
|
|
4
|
+
parent: Tutorials
|
|
5
|
+
nav_order: 2
|
|
6
|
+
---
|
|
7
|
+
= Building Your First LUR Package
|
|
8
|
+
|
|
9
|
+
Save the model from link:{site-baseurl}/tutorials/getting-started/[Getting Started]
|
|
10
|
+
as a `.lur` file and verify that its class survives a reload.
|
|
11
|
+
|
|
12
|
+
== Export and reload
|
|
13
|
+
|
|
14
|
+
Keep `city_model.rb` in the same directory as this script, named `build_package.rb`:
|
|
15
|
+
|
|
16
|
+
[source,ruby]
|
|
17
|
+
----
|
|
18
|
+
include::../examples/build_package.rb[]
|
|
19
|
+
----
|
|
20
|
+
|
|
21
|
+
Run `bundle exec ruby build_package.rb city.lur` with a new output filename.
|
|
22
|
+
It writes `city.lur`, reloads it, and prints `Building`.
|
|
23
|
+
The explicit version require supplies the constant used by the exporter in
|
|
24
|
+
`lutaml-uml` 1.0.3; the umbrella's version is a separate constant.
|
|
25
|
+
|
|
26
|
+
== Inspect the result
|
|
27
|
+
|
|
28
|
+
A LUR package is a ZIP archive. Inspect its entry names with a ZIP viewer:
|
|
29
|
+
`metadata.yaml`, `repository.yaml`, `indexes/all.yaml`, `index_tree.yaml`,
|
|
30
|
+
and `statistics.yaml` describe the model and its lookup data.
|
|
31
|
+
See link:{site-baseurl}/references/formats/lur-format/[LUR Package Format]
|
|
32
|
+
for the loading contract.
|
|
33
|
+
|
|
34
|
+
`Repository.from_file("city.lur")` is another way to load the package.
|
|
35
|
+
It does not parse QEA or XMI files. Parse those formats with the appropriate
|
|
36
|
+
provider first, then pass its UML document to `Repository.from_document`.
|
|
37
|
+
|
|
38
|
+
== Maintain the package
|
|
39
|
+
|
|
40
|
+
Keep the original model file and the bundle lockfile alongside generated
|
|
41
|
+
artifacts. Rebuild a package when its source changes. Do not use the existence
|
|
42
|
+
of an old `.lur` file as proof that it represents the latest source model.
|
|
43
|
+
|
|
44
|
+
Next, link:{site-baseurl}/tutorials/querying-models/[search and query the model]
|
|
45
|
+
or link:{site-baseurl}/tutorials/documentation-site/[generate a documentation site].
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /tutorials/generating-diagrams/
|
|
3
|
+
title: Generating an LML Diagram
|
|
4
|
+
parent: Tutorials
|
|
5
|
+
nav_order: 3
|
|
6
|
+
---
|
|
7
|
+
= Generating an LML Diagram
|
|
8
|
+
|
|
9
|
+
Render a small textual LML model as SVG. This tutorial uses Graphviz layout;
|
|
10
|
+
it does not reconstruct an Enterprise Architect diagram's saved coordinates.
|
|
11
|
+
|
|
12
|
+
== Prerequisites
|
|
13
|
+
|
|
14
|
+
Install the `lutaml` gem in your bundle. The Graphviz `dot` executable must
|
|
15
|
+
already be available on `PATH`; check with `dot -V`.
|
|
16
|
+
The Ruby formatter invokes that executable to perform layout and rendering.
|
|
17
|
+
|
|
18
|
+
== Render the model
|
|
19
|
+
|
|
20
|
+
Save this as `render_diagram.rb`:
|
|
21
|
+
|
|
22
|
+
[source,ruby]
|
|
23
|
+
----
|
|
24
|
+
include::../examples/render_diagram.rb[]
|
|
25
|
+
----
|
|
26
|
+
|
|
27
|
+
Run `bundle exec ruby render_diagram.rb city.svg` with a new output filename.
|
|
28
|
+
The script rejects output without an SVG root element. Open `city.svg` in a
|
|
29
|
+
browser and check that the Building class appears.
|
|
30
|
+
|
|
31
|
+
== Change the output
|
|
32
|
+
|
|
33
|
+
Set `formatter.type = :png` and write to `city.png` for a raster image, or
|
|
34
|
+
`:pdf` and `city.pdf` for PDF. The requested Graphviz format must be supported
|
|
35
|
+
by your local Graphviz installation. Replace the SVG-specific output check
|
|
36
|
+
when selecting another format. Changing the filename alone does not
|
|
37
|
+
change the formatter's output type.
|
|
38
|
+
|
|
39
|
+
For model browser generation, see
|
|
40
|
+
link:{site-baseurl}/tutorials/documentation-site/[Creating a Documentation Site].
|
|
41
|
+
For the distinction between LML parsing and UML repository models, see
|
|
42
|
+
link:{site-baseurl}/references/api/parsers/[Parser APIs].
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /tutorials/getting-started/
|
|
3
|
+
title: Getting Started with LutaML
|
|
4
|
+
parent: Tutorials
|
|
5
|
+
nav_order: 1
|
|
6
|
+
---
|
|
7
|
+
= Getting Started with LutaML
|
|
8
|
+
|
|
9
|
+
Create a small UML model and look up a class without an Enterprise Architect file.
|
|
10
|
+
You need Ruby 3.2 or newer and the `lutaml` gem in your bundle.
|
|
11
|
+
|
|
12
|
+
== Install
|
|
13
|
+
|
|
14
|
+
Add `gem "lutaml"` to your Gemfile and run `bundle install`.
|
|
15
|
+
The umbrella gem loads the LML language and UML repository components.
|
|
16
|
+
|
|
17
|
+
== Create the model
|
|
18
|
+
|
|
19
|
+
Save this example as `city_model.rb`:
|
|
20
|
+
|
|
21
|
+
[source,ruby]
|
|
22
|
+
----
|
|
23
|
+
include::../examples/city_model.rb[]
|
|
24
|
+
----
|
|
25
|
+
|
|
26
|
+
Run `bundle exec ruby city_model.rb`. It prints `Building`.
|
|
27
|
+
The explicit IDs identify elements within the model; the repository assigns the
|
|
28
|
+
qualified path `ModelRoot::City::Building` from their package hierarchy.
|
|
29
|
+
|
|
30
|
+
== Explore the repository
|
|
31
|
+
|
|
32
|
+
In another script, load `city_model.rb` and call `CityModel.repository`.
|
|
33
|
+
Use `classes_in_package("ModelRoot::City")` to list its classes, or
|
|
34
|
+
`statistics` to obtain model counts. An empty model still has the synthetic
|
|
35
|
+
`ModelRoot` package, so the example's package count is two.
|
|
36
|
+
|
|
37
|
+
UML documents and LML documents are different types. For textual LML input use
|
|
38
|
+
`Lutaml::Lml.parse_document`, rather than passing an LML document directly to
|
|
39
|
+
the UML repository. See link:{site-baseurl}/references/api/parsers/[Parser APIs].
|
|
40
|
+
|
|
41
|
+
== Next steps
|
|
42
|
+
|
|
43
|
+
* link:{site-baseurl}/tutorials/first-lur-package/[Save and reload a LUR package].
|
|
44
|
+
* link:{site-baseurl}/tutorials/querying-models/[Query the model].
|
|
45
|
+
* link:{site-baseurl}/concepts/uml-models/[Understand the UML model structure].
|
data/docs/_tutorials/index.adoc
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
permalink: /tutorials/
|
|
2
3
|
title: Tutorials
|
|
3
4
|
nav_order: 2
|
|
4
5
|
has_children: true
|
|
@@ -9,88 +10,78 @@ has_children: true
|
|
|
9
10
|
|
|
10
11
|
This section provides step-by-step learning paths to help you accomplish specific tasks with LutaML. Each tutorial walks you through a complete workflow from start to finish.
|
|
11
12
|
|
|
12
|
-
==
|
|
13
|
+
== Tutorials
|
|
13
14
|
|
|
14
|
-
=== link
|
|
15
|
+
=== link:{site-baseurl}/tutorials/getting-started/[Getting Started with LutaML]
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Create a small typed UML model and verify an indexed class lookup.
|
|
17
18
|
|
|
18
19
|
**What you'll learn:**
|
|
19
20
|
|
|
20
21
|
* Installing LutaML
|
|
21
|
-
*
|
|
22
|
-
* Understanding
|
|
22
|
+
* Creating a UML document
|
|
23
|
+
* Understanding parser and repository boundaries
|
|
23
24
|
* Basic model exploration
|
|
24
25
|
|
|
25
|
-
**Time:** 15 minutes
|
|
26
|
-
|
|
27
26
|
---
|
|
28
27
|
|
|
29
|
-
=== link
|
|
28
|
+
=== link:{site-baseurl}/tutorials/first-lur-package/[Building Your First LUR Package]
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
Export a typed UML repository to a LUR package and verify a reload.
|
|
32
31
|
|
|
33
32
|
**What you'll learn:**
|
|
34
33
|
|
|
35
|
-
*
|
|
34
|
+
* Exporting a UML repository
|
|
36
35
|
* Understanding LUR package structure
|
|
37
36
|
* Loading and querying LUR packages
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
**Time:** 20 minutes
|
|
37
|
+
* Preserving source and dependency versions
|
|
41
38
|
|
|
42
39
|
---
|
|
43
40
|
|
|
44
|
-
=== link
|
|
41
|
+
=== link:{site-baseurl}/tutorials/generating-diagrams/[Generating Diagrams]
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
Render a textual LML model with Graphviz and verify the resulting SVG.
|
|
47
44
|
|
|
48
45
|
**What you'll learn:**
|
|
49
46
|
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
47
|
+
* Parsing textual LML
|
|
48
|
+
* Selecting the output format
|
|
49
|
+
* Checking the Graphviz prerequisite
|
|
53
50
|
* Exporting diagrams
|
|
54
51
|
|
|
55
|
-
**Time:** 25 minutes
|
|
56
|
-
|
|
57
52
|
---
|
|
58
53
|
|
|
59
|
-
=== link
|
|
54
|
+
=== link:{site-baseurl}/tutorials/documentation-site/[Creating a Documentation Site]
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
Generate an HTML model browser, inspect it locally, and understand output modes.
|
|
62
57
|
|
|
63
58
|
**What you'll learn:**
|
|
64
59
|
|
|
65
|
-
* Using the
|
|
60
|
+
* Using the Ruby static-site API
|
|
66
61
|
* Understanding output modes
|
|
67
62
|
* Customizing the site
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
**Time:** 20 minutes
|
|
63
|
+
* Serving and publishing generated output
|
|
71
64
|
|
|
72
65
|
---
|
|
73
66
|
|
|
74
|
-
=== link
|
|
67
|
+
=== link:{site-baseurl}/tutorials/querying-models/[Searching and Querying Models]
|
|
75
68
|
|
|
76
|
-
|
|
69
|
+
Compare exact lookups, structured queries, and grouped text-search results.
|
|
77
70
|
|
|
78
71
|
**What you'll learn:**
|
|
79
72
|
|
|
80
73
|
* Full-text search
|
|
81
74
|
* Using the query DSL
|
|
82
|
-
* Filtering by
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
**Time:** 30 minutes
|
|
75
|
+
* Filtering objects by name
|
|
76
|
+
* Applying queries to a saved package
|
|
86
77
|
|
|
87
78
|
== Prerequisites
|
|
88
79
|
|
|
89
80
|
Most tutorials assume you have:
|
|
90
81
|
|
|
91
|
-
* Ruby 2
|
|
82
|
+
* Ruby 3.2+ installed
|
|
92
83
|
* Basic command-line knowledge
|
|
93
|
-
* LutaML installed (see link
|
|
84
|
+
* LutaML installed (see link:{site-baseurl}/core/installation/[Installation Guide])
|
|
94
85
|
|
|
95
86
|
== Tutorial Format
|
|
96
87
|
|
|
@@ -104,6 +95,6 @@ Each tutorial follows this structure:
|
|
|
104
95
|
|
|
105
96
|
== Related Sections
|
|
106
97
|
|
|
107
|
-
* link
|
|
108
|
-
* link
|
|
109
|
-
* link
|
|
98
|
+
* link:{site-baseurl}/core/[Core Topics] - Fundamental concepts
|
|
99
|
+
* link:{site-baseurl}/guides/[Guides] - Task-oriented how-to documentation
|
|
100
|
+
* link:{site-baseurl}/references/[Reference] - Detailed specifications
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /tutorials/querying-models/
|
|
3
|
+
title: Searching and Querying Models
|
|
4
|
+
parent: Tutorials
|
|
5
|
+
nav_order: 5
|
|
6
|
+
---
|
|
7
|
+
= Searching and Querying Models
|
|
8
|
+
|
|
9
|
+
Use the model from link:{site-baseurl}/tutorials/getting-started/[Getting Started]
|
|
10
|
+
to compare an exact lookup, a structured query, and a text search.
|
|
11
|
+
|
|
12
|
+
== Run the query
|
|
13
|
+
|
|
14
|
+
Save this as `query_model.rb` beside `city_model.rb`:
|
|
15
|
+
|
|
16
|
+
[source,ruby]
|
|
17
|
+
----
|
|
18
|
+
include::../examples/query_model.rb[]
|
|
19
|
+
----
|
|
20
|
+
|
|
21
|
+
Run `bundle exec ruby query_model.rb`. It prints `Building`, followed by `1`.
|
|
22
|
+
The assertion checks that the query returned the expected class.
|
|
23
|
+
|
|
24
|
+
== Choose a lookup method
|
|
25
|
+
|
|
26
|
+
* `find_class("ModelRoot::City::Building")` resolves a qualified name.
|
|
27
|
+
It returns `nil` when no class matches, unless `raise_on_error: true` is set.
|
|
28
|
+
* `classes_in_package("ModelRoot::City", recursive: true)` includes child packages.
|
|
29
|
+
Use this method for package filtering with `lutaml-uml` 1.0.3; the query DSL's
|
|
30
|
+
`in_package` condition currently raises a `NameError` for `PackagePath`.
|
|
31
|
+
* `query { |q| q.classes.where(name: /Building/) }.all` filters objects and
|
|
32
|
+
returns model instances. Chain `order_by(:name)` or `limit(10)` before `.all`.
|
|
33
|
+
* `search("Building", types: [:class])` returns a hash with result groups and
|
|
34
|
+
`:total`; it does not return the same array as a structured query.
|
|
35
|
+
|
|
36
|
+
Package paths start at `ModelRoot`, even when the document has a different name.
|
|
37
|
+
Use `package_tree` to inspect the hierarchy instead of guessing paths from filenames.
|
|
38
|
+
|
|
39
|
+
== Query a saved model
|
|
40
|
+
|
|
41
|
+
Replace `CityModel.repository` with
|
|
42
|
+
`Lutaml::UmlRepository::Repository.from_package("city.lur")` after completing
|
|
43
|
+
the link:{site-baseurl}/tutorials/first-lur-package/[LUR package tutorial].
|
|
44
|
+
The query methods work on the loaded repository in the same way.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "city_model"
|
|
4
|
+
# lutaml-uml 1.0.3's exporter uses this component's version constant.
|
|
5
|
+
require "lutaml/uml/version"
|
|
6
|
+
|
|
7
|
+
path = ARGV.fetch(0, "city.lur")
|
|
8
|
+
CityModel.repository.export_to_package(path)
|
|
9
|
+
repository = Lutaml::UmlRepository::Repository.from_package(path)
|
|
10
|
+
raise "Class was not preserved" unless repository.find_class("ModelRoot::City::Building")
|
|
11
|
+
|
|
12
|
+
puts repository.find_class("ModelRoot::City::Building").name
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "city_model"
|
|
4
|
+
require "lutaml/uml/version"
|
|
5
|
+
|
|
6
|
+
path = ARGV.fetch(0, "browser.html")
|
|
7
|
+
Lutaml::UmlRepository::StaticSite.generate(
|
|
8
|
+
CityModel.repository, mode: :single_file, output: path
|
|
9
|
+
)
|
|
10
|
+
raise "Site was not generated" unless File.size?(path)
|
|
11
|
+
|
|
12
|
+
puts path
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml"
|
|
4
|
+
|
|
5
|
+
module CityModel
|
|
6
|
+
def self.repository
|
|
7
|
+
building = Lutaml::Uml::UmlClass.new(
|
|
8
|
+
name: "Building", xmi_id: "building-1", stereotype: ["featureType"]
|
|
9
|
+
)
|
|
10
|
+
city = Lutaml::Uml::Package.new(
|
|
11
|
+
name: "City", xmi_id: "city-1", classes: [building]
|
|
12
|
+
)
|
|
13
|
+
document = Lutaml::Uml::Document.new(name: "City model", packages: [city])
|
|
14
|
+
Lutaml::UmlRepository::Repository.from_document(document)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if $PROGRAM_NAME == __FILE__
|
|
19
|
+
repository = CityModel.repository
|
|
20
|
+
puts repository.find_class("ModelRoot::City::Building").name
|
|
21
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "city_model"
|
|
4
|
+
require "lutaml/uml_repository/presenters/class_presenter"
|
|
5
|
+
|
|
6
|
+
repository = CityModel.repository
|
|
7
|
+
element = repository.find_class("ModelRoot::City::Building")
|
|
8
|
+
presenter = Lutaml::UmlRepository::Presenters::PresenterFactory.create(element, repository)
|
|
9
|
+
puts presenter.to_text
|
|
10
|
+
raise "Presenter lost the name" unless presenter.to_hash[:name] == "Building"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "city_model"
|
|
4
|
+
|
|
5
|
+
repository = CityModel.repository
|
|
6
|
+
classes = repository.query do |query|
|
|
7
|
+
query.classes.where(name: "Building")
|
|
8
|
+
end.all
|
|
9
|
+
raise "Unexpected query result" unless classes.map(&:name) == ["Building"]
|
|
10
|
+
|
|
11
|
+
puts classes.map(&:name)
|
|
12
|
+
puts repository.search("Building", types: [:class])[:total]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml"
|
|
4
|
+
|
|
5
|
+
document = Lutaml::Lml.parse("diagram City { class Building {} }")
|
|
6
|
+
formatter = Lutaml::Formatter::Graphviz.new
|
|
7
|
+
formatter.type = :svg
|
|
8
|
+
svg = formatter.format(document)
|
|
9
|
+
raise "Graphviz did not return SVG" unless svg.include?("<svg")
|
|
10
|
+
|
|
11
|
+
File.write(ARGV.fetch(0, "city.svg"), svg)
|
data/docs/index.adoc
CHANGED
|
@@ -25,25 +25,25 @@ LutaML provides a unified interface for:
|
|
|
25
25
|
|
|
26
26
|
New to LutaML? Start here:
|
|
27
27
|
|
|
28
|
-
* link
|
|
29
|
-
* link
|
|
30
|
-
* link
|
|
28
|
+
* link:{site-baseurl}/core/installation/[Installation Guide] - Get LutaML up and running
|
|
29
|
+
* link:{site-baseurl}/tutorials/getting-started/[Quick Start Tutorial] - Your first steps with LutaML
|
|
30
|
+
* link:{site-baseurl}/core/overview/[What is LutaML?] - Learn about the architecture and capabilities
|
|
31
31
|
|
|
32
32
|
=== Documentation Sections
|
|
33
33
|
|
|
34
|
-
==== link
|
|
34
|
+
==== link:{site-baseurl}/core/[Core Topics]
|
|
35
35
|
|
|
36
36
|
Fundamental concepts and essential information about LutaML's architecture, components, and capabilities.
|
|
37
37
|
|
|
38
|
-
==== link
|
|
38
|
+
==== link:{site-baseurl}/tutorials/[Tutorials]
|
|
39
39
|
|
|
40
40
|
Step-by-step learning paths to help you accomplish specific tasks with LutaML.
|
|
41
41
|
|
|
42
|
-
==== link
|
|
42
|
+
==== link:{site-baseurl}/guides/[Guides]
|
|
43
43
|
|
|
44
44
|
Task-oriented how-to documentation for common workflows and operations.
|
|
45
45
|
|
|
46
|
-
==== link
|
|
46
|
+
==== link:{site-baseurl}/references/[Reference]
|
|
47
47
|
|
|
48
48
|
Detailed technical specifications, API documentation, and configuration schemas.
|
|
49
49
|
|
|
@@ -51,14 +51,14 @@ Detailed technical specifications, API documentation, and configuration schemas.
|
|
|
51
51
|
|
|
52
52
|
* https://github.com/lutaml/lutaml[GitHub Repository]
|
|
53
53
|
* https://rubygems.org/gems/lutaml[RubyGems Package]
|
|
54
|
-
* link
|
|
55
|
-
* link
|
|
56
|
-
* link
|
|
54
|
+
* link:{site-baseurl}/core/installation/[Installation]
|
|
55
|
+
* link:{site-baseurl}/references/cli/commands/[CLI Reference]
|
|
56
|
+
* link:{site-baseurl}/references/api/repository/[API Reference]
|
|
57
57
|
|
|
58
58
|
=== Community
|
|
59
59
|
|
|
60
60
|
LutaML is open source and maintained by https://www.ribose.com[Ribose].
|
|
61
61
|
|
|
62
62
|
* Report issues: https://github.com/lutaml/lutaml/issues
|
|
63
|
-
* Contribute: https://github.com/lutaml/lutaml/
|
|
64
|
-
* License: https://
|
|
63
|
+
* Contribute: https://github.com/lutaml/lutaml/pulls
|
|
64
|
+
* License: https://opensource.org/licenses/MIT[MIT]
|