expressir 2.1.30 → 2.1.31
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 +98 -0
- data/.github/workflows/links.yml +100 -0
- data/.github/workflows/rake.yml +4 -0
- data/.github/workflows/release.yml +5 -0
- data/.github/workflows/validate_schemas.yml +1 -1
- data/.gitignore +3 -0
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +244 -39
- data/Gemfile +2 -1
- data/README.adoc +621 -54
- data/docs/Gemfile +12 -0
- data/docs/_config.yml +141 -0
- data/docs/_guides/changes/changes-format.adoc +778 -0
- data/docs/_guides/changes/importing-eengine.adoc +898 -0
- data/docs/_guides/changes/index.adoc +396 -0
- data/docs/_guides/changes/programmatic-usage.adoc +1038 -0
- data/docs/_guides/changes/validating-changes.adoc +681 -0
- data/docs/_guides/cli/benchmark-performance.adoc +834 -0
- data/docs/_guides/cli/coverage-analysis.adoc +921 -0
- data/docs/_guides/cli/format-schemas.adoc +547 -0
- data/docs/_guides/cli/index.adoc +8 -0
- data/docs/_guides/cli/managing-changes.adoc +927 -0
- data/docs/_guides/cli/validate-ascii.adoc +645 -0
- data/docs/_guides/cli/validate-schemas.adoc +534 -0
- data/docs/_guides/index.adoc +165 -0
- data/docs/_guides/ler/creating-packages.adoc +664 -0
- data/docs/_guides/ler/index.adoc +305 -0
- data/docs/_guides/ler/loading-packages.adoc +707 -0
- data/docs/_guides/ler/package-formats.adoc +748 -0
- data/docs/_guides/ler/querying-packages.adoc +826 -0
- data/docs/_guides/ler/validating-packages.adoc +750 -0
- data/docs/_guides/liquid/basic-templates.adoc +813 -0
- data/docs/_guides/liquid/documentation-generation.adoc +1042 -0
- data/docs/_guides/liquid/drops-reference.adoc +829 -0
- data/docs/_guides/liquid/filters-and-tags.adoc +912 -0
- data/docs/_guides/liquid/index.adoc +468 -0
- data/docs/_guides/manifests/creating-manifests.adoc +483 -0
- data/docs/_guides/manifests/index.adoc +307 -0
- data/docs/_guides/manifests/resolving-manifests.adoc +557 -0
- data/docs/_guides/manifests/validating-manifests.adoc +713 -0
- data/docs/_guides/ruby-api/formatting-schemas.adoc +605 -0
- data/docs/_guides/ruby-api/index.adoc +257 -0
- data/docs/_guides/ruby-api/parsing-files.adoc +421 -0
- data/docs/_guides/ruby-api/search-engine.adoc +609 -0
- data/docs/_guides/ruby-api/working-with-repository.adoc +577 -0
- data/docs/_pages/data-model.adoc +665 -0
- data/docs/_pages/express-language.adoc +506 -0
- data/docs/_pages/getting-started.adoc +414 -0
- data/docs/_pages/index.adoc +116 -0
- data/docs/_pages/introduction.adoc +256 -0
- data/docs/_pages/ler-packages.adoc +837 -0
- data/docs/_pages/parsers.adoc +683 -0
- data/docs/_pages/schema-manifests.adoc +431 -0
- data/docs/_references/index.adoc +228 -0
- data/docs/_tutorials/creating-ler-package.adoc +735 -0
- data/docs/_tutorials/documentation-coverage.adoc +795 -0
- data/docs/_tutorials/index.adoc +221 -0
- data/docs/_tutorials/liquid-templates.adoc +806 -0
- data/docs/_tutorials/parsing-your-first-schema.adoc +522 -0
- data/docs/_tutorials/querying-schemas.adoc +751 -0
- data/docs/_tutorials/working-with-multiple-schemas.adoc +676 -0
- data/docs/index.adoc +242 -0
- data/docs/lychee.toml +84 -0
- data/examples/demo_ler_usage.sh +86 -0
- data/examples/ler/README.md +111 -0
- data/examples/ler/simple_example.ler +0 -0
- data/examples/ler/simple_schema.exp +33 -0
- data/examples/ler_build.rb +75 -0
- data/examples/ler_cli.rb +79 -0
- data/examples/ler_demo_complete.rb +276 -0
- data/examples/ler_query.rb +91 -0
- data/examples/ler_query_examples.rb +305 -0
- data/examples/ler_stats.rb +81 -0
- data/examples/phase3_demo.rb +159 -0
- data/examples/query_demo_simple.rb +131 -0
- data/expressir.gemspec +2 -0
- data/lib/expressir/cli.rb +12 -4
- data/lib/expressir/commands/manifest.rb +427 -0
- data/lib/expressir/commands/package.rb +1274 -0
- data/lib/expressir/commands/validate.rb +70 -37
- data/lib/expressir/commands/validate_ascii.rb +607 -0
- data/lib/expressir/commands/validate_load.rb +88 -0
- data/lib/expressir/express/formatter.rb +5 -1
- data/lib/expressir/express/formatters/remark_item_formatter.rb +25 -0
- data/lib/expressir/express/parser.rb +33 -0
- data/lib/expressir/manifest/resolver.rb +213 -0
- data/lib/expressir/manifest/validator.rb +195 -0
- data/lib/expressir/model/declarations/entity.rb +6 -0
- data/lib/expressir/model/dependency_resolver.rb +270 -0
- data/lib/expressir/model/indexes/entity_index.rb +103 -0
- data/lib/expressir/model/indexes/reference_index.rb +148 -0
- data/lib/expressir/model/indexes/type_index.rb +149 -0
- data/lib/expressir/model/interface_validator.rb +384 -0
- data/lib/expressir/model/repository.rb +400 -5
- data/lib/expressir/model/repository_validator.rb +295 -0
- data/lib/expressir/model/search_engine.rb +525 -0
- data/lib/expressir/model.rb +4 -94
- data/lib/expressir/package/builder.rb +200 -0
- data/lib/expressir/package/metadata.rb +81 -0
- data/lib/expressir/package/reader.rb +165 -0
- data/lib/expressir/schema_manifest.rb +11 -1
- data/lib/expressir/version.rb +1 -1
- data/lib/expressir.rb +15 -2
- metadata +114 -4
- data/docs/benchmarking.adoc +0 -107
- data/docs/liquid_drops.adoc +0 -1547
data/docs/index.adoc
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
title: Home
|
|
4
|
+
nav_order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
= Expressir
|
|
8
|
+
:toc: macro
|
|
9
|
+
:toclevels: 2
|
|
10
|
+
|
|
11
|
+
[.lead]
|
|
12
|
+
*EXPRESS parser and toolkit for Ruby.* Parse, analyze, and transform EXPRESS data models with a comprehensive Ruby API.
|
|
13
|
+
|
|
14
|
+
image:https://img.shields.io/gem/v/expressir.svg[RubyGems Version,link="https://rubygems.org/gems/expressir"]
|
|
15
|
+
image:https://github.com/lutaml/expressir/workflows/rake/badge.svg[Build Status,link="https://github.com/lutaml/expressir/actions?workflow=rake"]
|
|
16
|
+
|
|
17
|
+
'''
|
|
18
|
+
|
|
19
|
+
toc::[]
|
|
20
|
+
|
|
21
|
+
== What is Expressir?
|
|
22
|
+
|
|
23
|
+
Expressir ("EXPRESS in Ruby") is a comprehensive Ruby parser and toolkit for working with EXPRESS data models, the data modeling language defined in ISO 10303-11. It enables you to:
|
|
24
|
+
|
|
25
|
+
* *Parse* EXPRESS schemas from multiple formats
|
|
26
|
+
* *Analyze* complex data models and their relationships
|
|
27
|
+
* *Transform* schemas using a rich Ruby API
|
|
28
|
+
* *Generate* documentation using Liquid templates
|
|
29
|
+
* *Package* schemas into efficient LER (LutaML EXPRESS Repository) bundles
|
|
30
|
+
* *Track* schema changes across versions
|
|
31
|
+
|
|
32
|
+
=== Key Features
|
|
33
|
+
|
|
34
|
+
[cols="1,3",options="header"]
|
|
35
|
+
|===
|
|
36
|
+
|Feature
|
|
37
|
+
|Description
|
|
38
|
+
|
|
39
|
+
|*Multiple Format Support*
|
|
40
|
+
|Parse EXPRESS (ISO 10303-11), STEPmod XML, and EXPRESS XML formats
|
|
41
|
+
|
|
42
|
+
|*Rich Data Model*
|
|
43
|
+
|Complete Ruby representation of EXPRESS schemas with full type information
|
|
44
|
+
|
|
45
|
+
|*LER Packages*
|
|
46
|
+
|Pre-indexed, fast-loading schema bundles with 20x+ performance improvement
|
|
47
|
+
|
|
48
|
+
|*Schema Analysis*
|
|
49
|
+
|Built-in tools for documentation coverage, validation, and dependency analysis
|
|
50
|
+
|
|
51
|
+
|*Liquid Integration*
|
|
52
|
+
|Generate documentation and reports using flexible Liquid templates
|
|
53
|
+
|
|
54
|
+
|*CLI Tools*
|
|
55
|
+
|Command-line interface for formatting, validation, benchmarking, and more
|
|
56
|
+
|
|
57
|
+
|*Changes Tracking*
|
|
58
|
+
|Track and manage schema modifications across versions
|
|
59
|
+
|
|
60
|
+
|*Ruby-First Design*
|
|
61
|
+
|Idiomatic Ruby API with comprehensive test coverage
|
|
62
|
+
|===
|
|
63
|
+
|
|
64
|
+
== Quick Start
|
|
65
|
+
|
|
66
|
+
=== Installation
|
|
67
|
+
|
|
68
|
+
Add Expressir to your Gemfile:
|
|
69
|
+
|
|
70
|
+
[source,ruby]
|
|
71
|
+
----
|
|
72
|
+
gem 'expressir'
|
|
73
|
+
----
|
|
74
|
+
|
|
75
|
+
Or install directly:
|
|
76
|
+
|
|
77
|
+
[source,bash]
|
|
78
|
+
----
|
|
79
|
+
gem install expressir
|
|
80
|
+
----
|
|
81
|
+
|
|
82
|
+
=== Parse Your First Schema
|
|
83
|
+
|
|
84
|
+
[source,ruby]
|
|
85
|
+
----
|
|
86
|
+
require 'expressir'
|
|
87
|
+
|
|
88
|
+
# Parse an EXPRESS file
|
|
89
|
+
repository = Expressir::Express::Parser.from_file('schema.exp')
|
|
90
|
+
|
|
91
|
+
# Access schemas
|
|
92
|
+
repository.schemas.each do |schema|
|
|
93
|
+
puts "Schema: #{schema.id}"
|
|
94
|
+
puts "Entities: #{schema.entities.size}"
|
|
95
|
+
puts "Types: #{schema.types.size}"
|
|
96
|
+
end
|
|
97
|
+
----
|
|
98
|
+
|
|
99
|
+
=== Use the CLI
|
|
100
|
+
|
|
101
|
+
[source,bash]
|
|
102
|
+
----
|
|
103
|
+
# Format a schema
|
|
104
|
+
expressir format schema.exp
|
|
105
|
+
|
|
106
|
+
# Validate schemas
|
|
107
|
+
expressir validate schema.exp
|
|
108
|
+
|
|
109
|
+
# Check documentation coverage
|
|
110
|
+
expressir coverage schema.exp
|
|
111
|
+
|
|
112
|
+
# Create an LER package
|
|
113
|
+
expressir package build schema.exp output.ler
|
|
114
|
+
----
|
|
115
|
+
|
|
116
|
+
== Documentation Structure
|
|
117
|
+
|
|
118
|
+
This documentation is organized into four main sections:
|
|
119
|
+
|
|
120
|
+
=== Core Topics
|
|
121
|
+
|
|
122
|
+
Fundamental concepts and essential information:
|
|
123
|
+
|
|
124
|
+
* link:introduction.html[Introduction] - What is Expressir and when to use it
|
|
125
|
+
* link:getting-started.html[Getting Started] - Installation and first steps
|
|
126
|
+
* link:express-language.html[EXPRESS Language] - Understanding EXPRESS data modeling
|
|
127
|
+
* link:data-model.html[Data Model] - Expressir's Ruby data model
|
|
128
|
+
* link:parsers.html[Parsers] - Parsing EXPRESS files
|
|
129
|
+
* link:schema-manifests.html[Schema Manifests] - Managing collections of EXPRESS schemas
|
|
130
|
+
* link:ler-packages.html[LER Packages] - High-performance schema packages
|
|
131
|
+
|
|
132
|
+
=== link:tutorials/[Tutorials]
|
|
133
|
+
|
|
134
|
+
Step-by-step guides for common workflows:
|
|
135
|
+
|
|
136
|
+
* link:tutorials/parsing-your-first-schema.html[Parsing Your First Schema]
|
|
137
|
+
* link:tutorials/working-with-multiple-schemas.html[Working with Multiple Schemas]
|
|
138
|
+
* link:tutorials/creating-ler-package.html[Creating LER Packages]
|
|
139
|
+
* link:tutorials/querying-schemas.html[Querying Schemas]
|
|
140
|
+
* link:tutorials/liquid-templates.html[Liquid Templates]
|
|
141
|
+
* link:tutorials/documentation-coverage.html[Documentation Coverage]
|
|
142
|
+
|
|
143
|
+
=== link:guides/[Guides]
|
|
144
|
+
|
|
145
|
+
Task-oriented how-to documentation:
|
|
146
|
+
|
|
147
|
+
* link:guides/cli/[CLI Commands] - Command-line interface usage
|
|
148
|
+
* link:guides/ruby-api/[Ruby API] - Programmatic usage
|
|
149
|
+
* link:guides/ler/[LER] - Working with LER packages
|
|
150
|
+
* link:guides/manifests/[Manifests] - Managing schema collections
|
|
151
|
+
* link:guides/changes/[Changes] - Tracking schema changes
|
|
152
|
+
* link:guides/liquid/[Liquid] - Template integration
|
|
153
|
+
|
|
154
|
+
=== link:references/[References]
|
|
155
|
+
|
|
156
|
+
Detailed technical specifications:
|
|
157
|
+
|
|
158
|
+
* link:references/cli-commands.html[CLI Commands Reference]
|
|
159
|
+
* link:references/ruby-api.html[Ruby API Reference]
|
|
160
|
+
* link:references/data-model/[Data Model Reference]
|
|
161
|
+
* link:references/liquid-drops/[Liquid Drops Reference]
|
|
162
|
+
* link:references/ler-format.html[LER Format Specification]
|
|
163
|
+
* link:references/changes-format.html[Changes Format Specification]
|
|
164
|
+
|
|
165
|
+
== Common Use Cases
|
|
166
|
+
|
|
167
|
+
=== For Data Modelers
|
|
168
|
+
|
|
169
|
+
* Parse and validate EXPRESS schemas
|
|
170
|
+
* Check documentation coverage
|
|
171
|
+
* Format and clean schemas
|
|
172
|
+
* Track changes between versions
|
|
173
|
+
|
|
174
|
+
=== For Developers
|
|
175
|
+
|
|
176
|
+
* Integrate EXPRESS parsing into Ruby applications
|
|
177
|
+
* Build schema analysis tools
|
|
178
|
+
* Generate documentation from schemas
|
|
179
|
+
* Create custom schema transformations
|
|
180
|
+
|
|
181
|
+
=== For Organizations
|
|
182
|
+
|
|
183
|
+
* Package large schema collections for distribution
|
|
184
|
+
* Maintain schema version history
|
|
185
|
+
* Automate schema validation in CI/CD
|
|
186
|
+
* Generate standardized documentation
|
|
187
|
+
|
|
188
|
+
== Performance
|
|
189
|
+
|
|
190
|
+
Expressir is designed for performance:
|
|
191
|
+
|
|
192
|
+
[cols="2,1,1",options="header"]
|
|
193
|
+
|===
|
|
194
|
+
|Operation
|
|
195
|
+
|Traditional
|
|
196
|
+
|With LER
|
|
197
|
+
|
|
198
|
+
|Parse 40+ schemas
|
|
199
|
+
|10-15 seconds
|
|
200
|
+
|<500ms (20x+ faster)
|
|
201
|
+
|
|
202
|
+
|Entity lookup
|
|
203
|
+
|O(n) scan
|
|
204
|
+
|O(1) indexed (<1ms)
|
|
205
|
+
|
|
206
|
+
|Type resolution
|
|
207
|
+
|Multiple passes
|
|
208
|
+
|Pre-resolved
|
|
209
|
+
|===
|
|
210
|
+
|
|
211
|
+
== Architecture
|
|
212
|
+
|
|
213
|
+
Expressir consists of three main components:
|
|
214
|
+
|
|
215
|
+
[source]
|
|
216
|
+
----
|
|
217
|
+
┌─────────────────────────────────────┐
|
|
218
|
+
│ Ruby API / CLI │ ← Your Application
|
|
219
|
+
├─────────────────────────────────────┤
|
|
220
|
+
│ Expressir Model │ ← Rich Data Model
|
|
221
|
+
│ (Entities, Types, Schemas, etc.) │
|
|
222
|
+
├─────────────────────────────────────┤
|
|
223
|
+
│ EXPRESS Parser │ ← Multiple Formats
|
|
224
|
+
│ (EXPRESS, STEPmod, EXPRESS XML) │
|
|
225
|
+
└─────────────────────────────────────┘
|
|
226
|
+
----
|
|
227
|
+
|
|
228
|
+
== Support
|
|
229
|
+
|
|
230
|
+
* *Issues*: https://github.com/lutaml/expressir/issues[GitHub Issues]
|
|
231
|
+
* *Discussions*: https://github.com/lutaml/expressir/discussions[GitHub Discussions]
|
|
232
|
+
* *Contributing*: link:https://github.com/lutaml/expressir/blob/main/CONTRIBUTING.md[Contributing Guide]
|
|
233
|
+
|
|
234
|
+
== License
|
|
235
|
+
|
|
236
|
+
Expressir is distributed under the BSD-2-Clause license. See the link:https://github.com/lutaml/expressir/blob/main/LICENSE[LICENSE] file for details.
|
|
237
|
+
|
|
238
|
+
== Credits
|
|
239
|
+
|
|
240
|
+
Copyright © 2025 Ribose Inc.
|
|
241
|
+
|
|
242
|
+
Expressir is developed and maintained by https://www.ribose.com[Ribose Inc.] as part of the https://www.lutaml.org[LutaML] project family.
|
data/docs/lychee.toml
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Lychee link checker configuration for Expressir documentation
|
|
2
|
+
# https://github.com/lycheeverse/lychee
|
|
3
|
+
|
|
4
|
+
# Maximum number of concurrent network requests
|
|
5
|
+
max_concurrency = 8
|
|
6
|
+
|
|
7
|
+
# Maximum number of redirects to follow
|
|
8
|
+
max_redirects = 5
|
|
9
|
+
|
|
10
|
+
# Request timeout in seconds
|
|
11
|
+
timeout = 30
|
|
12
|
+
|
|
13
|
+
# Maximum number of retries per request
|
|
14
|
+
max_retries = 2
|
|
15
|
+
|
|
16
|
+
# Wait time between retries in seconds
|
|
17
|
+
retry_wait_time = 2
|
|
18
|
+
|
|
19
|
+
# User agent string
|
|
20
|
+
user_agent = "Mozilla/5.0 (compatible; Lychee/1.0; +https://github.com/lutaml/expressir)"
|
|
21
|
+
|
|
22
|
+
# Only check links with these schemes
|
|
23
|
+
scheme = ["https", "http"]
|
|
24
|
+
|
|
25
|
+
# Accepted HTTP status codes
|
|
26
|
+
accept = [
|
|
27
|
+
"100..=103",
|
|
28
|
+
"200..=299",
|
|
29
|
+
"429",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
# Exclude these URLs from checking
|
|
33
|
+
exclude = [
|
|
34
|
+
# Local development URLs
|
|
35
|
+
"http://localhost*",
|
|
36
|
+
"http://127\\.0\\.0\\.1*",
|
|
37
|
+
"http://0\\.0\\.0\\.0*",
|
|
38
|
+
|
|
39
|
+
# Placeholder URLs
|
|
40
|
+
"http://example\\.com*",
|
|
41
|
+
"https://example\\.com*",
|
|
42
|
+
"http://example\\.org*",
|
|
43
|
+
"https://example\\.org*",
|
|
44
|
+
|
|
45
|
+
# Private/internal networks
|
|
46
|
+
"http://192\\.168\\..*",
|
|
47
|
+
"http://10\\..*",
|
|
48
|
+
"http://172\\.(1[6-9]|2[0-9]|3[01])\\..*",
|
|
49
|
+
|
|
50
|
+
# Avoid checking certain external sites that may rate-limit
|
|
51
|
+
"https://www\\.linkedin\\.com/.*",
|
|
52
|
+
"https://twitter\\.com/.*",
|
|
53
|
+
"https://x\\.com/.*",
|
|
54
|
+
|
|
55
|
+
# External sites with broken or moved URLs
|
|
56
|
+
"https://www\\.nist\\.gov/.*",
|
|
57
|
+
"https://www\\.steptools\\.com/.*",
|
|
58
|
+
|
|
59
|
+
# GitHub URLs that require authentication
|
|
60
|
+
"https://github\\.com/.*/(issues|pull)/[0-9]+/files.*",
|
|
61
|
+
|
|
62
|
+
# GitHub Discussions (may not be enabled for all repos)
|
|
63
|
+
"https://github\\.com/.*/discussions.*",
|
|
64
|
+
|
|
65
|
+
# GitHub blob URLs (may vary by repository structure)
|
|
66
|
+
"https://github\\.com/.*/blob/main/.*",
|
|
67
|
+
|
|
68
|
+
# Fragments only (internal page anchors without base URL)
|
|
69
|
+
"^#.*",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
# Exclude specific paths from being checked
|
|
73
|
+
exclude_path = [
|
|
74
|
+
"vendor",
|
|
75
|
+
"node_modules",
|
|
76
|
+
".bundle",
|
|
77
|
+
".cache",
|
|
78
|
+
"_site",
|
|
79
|
+
"fixtures",
|
|
80
|
+
"test",
|
|
81
|
+
"spec",
|
|
82
|
+
".jekyll-cache",
|
|
83
|
+
"old-docs",
|
|
84
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Complete LER Demonstration Script
|
|
3
|
+
# Shows package creation, searching, and querying using CLI commands
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "======================================================================"
|
|
8
|
+
echo " LER Package Creation and Query Demonstration "
|
|
9
|
+
echo "======================================================================"
|
|
10
|
+
echo
|
|
11
|
+
|
|
12
|
+
# Step 1: Create LER package
|
|
13
|
+
echo "Step 1: Creating LER Package"
|
|
14
|
+
echo "----------------------------------------------------------------------"
|
|
15
|
+
echo "Building from: examples/ler/simple_schema.exp"
|
|
16
|
+
echo
|
|
17
|
+
|
|
18
|
+
bundle exec expressir package build \
|
|
19
|
+
examples/ler/simple_schema.exp \
|
|
20
|
+
examples/ler/simple_example.ler \
|
|
21
|
+
--name "Simple Product Management Schema" \
|
|
22
|
+
--version "1.0.0" \
|
|
23
|
+
--description "Demonstrates LER features with product entities" \
|
|
24
|
+
--express-mode include_all \
|
|
25
|
+
--resolution-mode resolved \
|
|
26
|
+
--serialization-format yaml
|
|
27
|
+
|
|
28
|
+
echo "✓ Package created: examples/ler/simple_example.ler"
|
|
29
|
+
echo
|
|
30
|
+
|
|
31
|
+
# Step 2: Show package info
|
|
32
|
+
echo "Step 2: Package Information"
|
|
33
|
+
echo "----------------------------------------------------------------------"
|
|
34
|
+
bundle exec expressir package info examples/ler/simple_example.ler
|
|
35
|
+
echo
|
|
36
|
+
|
|
37
|
+
# Step 3: List entities
|
|
38
|
+
echo "Step 3: List All Entities"
|
|
39
|
+
echo "----------------------------------------------------------------------"
|
|
40
|
+
bundle exec expressir package list examples/ler/simple_example.ler --type entity
|
|
41
|
+
echo
|
|
42
|
+
|
|
43
|
+
# Step 4: List types
|
|
44
|
+
echo "Step 4: List All Types"
|
|
45
|
+
echo "----------------------------------------------------------------------"
|
|
46
|
+
bundle exec expressir package list examples/ler/simple_example.ler --type type
|
|
47
|
+
echo
|
|
48
|
+
|
|
49
|
+
# Step 5: Search with patterns
|
|
50
|
+
echo "Step 5: Search with Wildcard Pattern 'product*'"
|
|
51
|
+
echo "----------------------------------------------------------------------"
|
|
52
|
+
bundle exec expressir package search examples/ler/simple_example.ler "product*"
|
|
53
|
+
echo
|
|
54
|
+
|
|
55
|
+
# Step 6: Search specific type
|
|
56
|
+
echo "Step 6: Search for Entities Only"
|
|
57
|
+
echo "----------------------------------------------------------------------"
|
|
58
|
+
bundle exec expressir package search examples/ler/simple_example.ler "product" --type entity
|
|
59
|
+
echo
|
|
60
|
+
|
|
61
|
+
# Step 7: Validation
|
|
62
|
+
echo "Step 7: Package Validation"
|
|
63
|
+
echo "----------------------------------------------------------------------"
|
|
64
|
+
bundle exec expressir package validate examples/ler/simple_example.ler \
|
|
65
|
+
--strict \
|
|
66
|
+
--check-interfaces \
|
|
67
|
+
--check-completeness
|
|
68
|
+
echo
|
|
69
|
+
|
|
70
|
+
# Step 8: Tree view
|
|
71
|
+
echo "Step 8: Package Tree View"
|
|
72
|
+
echo "----------------------------------------------------------------------"
|
|
73
|
+
bundle exec expressir package tree examples/ler/simple_example.ler --depth 3
|
|
74
|
+
echo
|
|
75
|
+
|
|
76
|
+
echo "======================================================================"
|
|
77
|
+
echo " Demo Complete!"
|
|
78
|
+
echo "======================================================================"
|
|
79
|
+
echo
|
|
80
|
+
echo "Package saved at: examples/ler/simple_example.ler"
|
|
81
|
+
echo
|
|
82
|
+
echo "Try these additional commands:"
|
|
83
|
+
echo " expressir package info examples/ler/simple_example.ler --format json"
|
|
84
|
+
echo " expressir package search examples/ler/simple_example.ler 'product_*' --regex"
|
|
85
|
+
echo " expressir package tree examples/ler/simple_example.ler --counts"
|
|
86
|
+
echo
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# LER (LutaML EXPRESS Repository) Examples
|
|
2
|
+
|
|
3
|
+
This directory contains example EXPRESS schemas and demonstration scripts for the LER package system.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
### Schema Files
|
|
8
|
+
- **simple_schema.exp** - A simple example schema with products, types, and enumerations
|
|
9
|
+
|
|
10
|
+
### Example Scripts
|
|
11
|
+
- **../ler_build.rb** - Build LER package from schema
|
|
12
|
+
- **../ler_query.rb** - Query entities and types from package
|
|
13
|
+
- **../ler_stats.rb** - Get comprehensive statistics
|
|
14
|
+
- **../ler_cli.rb** - Demonstrate CLI commands
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### 1. Build the Package
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
ruby examples/ler_build.rb
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This creates `examples/ler/simple_example.ler` containing:
|
|
25
|
+
- The parsed schema
|
|
26
|
+
- Pre-built indexes for fast queries
|
|
27
|
+
- Metadata and configuration
|
|
28
|
+
|
|
29
|
+
### 2. Query the Package
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
ruby examples/ler_query.rb
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Demonstrates:
|
|
36
|
+
- Loading packages (<100ms)
|
|
37
|
+
- Finding specific entities
|
|
38
|
+
- Listing entities
|
|
39
|
+
- Finding types
|
|
40
|
+
- Filtering types by category
|
|
41
|
+
|
|
42
|
+
### 3. View Statistics
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ruby examples/ler_stats.rb
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Shows:
|
|
49
|
+
- Entity and type counts
|
|
50
|
+
- Distribution by schema
|
|
51
|
+
- Type categorization
|
|
52
|
+
- Interface relationships
|
|
53
|
+
- Validation results
|
|
54
|
+
|
|
55
|
+
### 4. Use CLI Commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
ruby examples/ler_cli.rb
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Demonstrates all CLI commands:
|
|
62
|
+
- `expressir package info`
|
|
63
|
+
- `expressir entity find/list`
|
|
64
|
+
- `expressir type find/list`
|
|
65
|
+
- `expressir stats show`
|
|
66
|
+
|
|
67
|
+
## Direct CLI Usage
|
|
68
|
+
|
|
69
|
+
Once you've built the package, you can use these commands directly:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Package information
|
|
73
|
+
bundle exec expressir package info examples/ler/simple_example.ler
|
|
74
|
+
|
|
75
|
+
# Find entity
|
|
76
|
+
bundle exec expressir entity find "simple_example.product" \
|
|
77
|
+
--from examples/ler/simple_example.ler
|
|
78
|
+
|
|
79
|
+
# List all entities
|
|
80
|
+
bundle exec expressir entity list --from examples/ler/simple_example.ler
|
|
81
|
+
|
|
82
|
+
# List types by category
|
|
83
|
+
bundle exec expressir type list --from examples/ler/simple_example.ler \
|
|
84
|
+
--category enumeration
|
|
85
|
+
|
|
86
|
+
# Show statistics
|
|
87
|
+
bundle exec expressir stats show examples/ler/simple_example.ler
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Creating Your Own Packages
|
|
91
|
+
|
|
92
|
+
To create a package from your schemas:
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
require 'expressir'
|
|
96
|
+
|
|
97
|
+
# Option 1: From a single schema file (automatic dependency resolution)
|
|
98
|
+
repo = Expressir::Model::Repository.from_files(['your_schema.exp'])
|
|
99
|
+
repo.export_to_package('output.ler', name: 'My Package', version: '1.0')
|
|
100
|
+
|
|
101
|
+
# Option 2: Using CLI
|
|
102
|
+
# bundle exec expressir package build your_schema.exp output.ler \
|
|
103
|
+
# --name "My Package" --version "1.0"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Performance
|
|
107
|
+
|
|
108
|
+
LER packages provide significant performance benefits:
|
|
109
|
+
- **Loading**: <100ms (vs seconds of parsing)
|
|
110
|
+
- **Queries**: <1ms (pre-built indexes)
|
|
111
|
+
- **Distribution**: Single .ler file (vs multiple .exp files)
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(*
|
|
2
|
+
Simple example schema for LER demonstration
|
|
3
|
+
*)
|
|
4
|
+
|
|
5
|
+
SCHEMA simple_example;
|
|
6
|
+
|
|
7
|
+
TYPE product_status = ENUMERATION OF
|
|
8
|
+
(draft,
|
|
9
|
+
approved,
|
|
10
|
+
released,
|
|
11
|
+
obsolete);
|
|
12
|
+
END_TYPE;
|
|
13
|
+
|
|
14
|
+
TYPE identifier = STRING;
|
|
15
|
+
END_TYPE;
|
|
16
|
+
|
|
17
|
+
ENTITY product;
|
|
18
|
+
id : identifier;
|
|
19
|
+
name : STRING;
|
|
20
|
+
status : product_status;
|
|
21
|
+
created_date : STRING; -- Simplified for example
|
|
22
|
+
END_ENTITY;
|
|
23
|
+
|
|
24
|
+
ENTITY product_version;
|
|
25
|
+
id : identifier;
|
|
26
|
+
version_number : STRING;
|
|
27
|
+
of_product : product;
|
|
28
|
+
END_ENTITY;
|
|
29
|
+
|
|
30
|
+
TYPE product_select = SELECT (product, product_version);
|
|
31
|
+
END_TYPE;
|
|
32
|
+
|
|
33
|
+
END_SCHEMA; -- simple_example
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Example: Build LER package from EXPRESS schema
|
|
5
|
+
# This script demonstrates creating a self-contained LER package
|
|
6
|
+
|
|
7
|
+
require_relative "../lib/expressir"
|
|
8
|
+
|
|
9
|
+
puts "LER Package Builder Example"
|
|
10
|
+
puts "=" * 60
|
|
11
|
+
puts
|
|
12
|
+
|
|
13
|
+
# Input schema
|
|
14
|
+
SCHEMA_FILE = File.expand_path("ler/simple_schema.exp", __dir__)
|
|
15
|
+
OUTPUT_PACKAGE = File.expand_path("ler/simple_example.ler", __dir__)
|
|
16
|
+
|
|
17
|
+
unless File.exist?(SCHEMA_FILE)
|
|
18
|
+
puts "Error: Schema file not found: #{SCHEMA_FILE}"
|
|
19
|
+
exit 1
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
puts "Building LER package from: #{File.basename(SCHEMA_FILE)}"
|
|
23
|
+
puts "Output: #{File.basename(OUTPUT_PACKAGE)}"
|
|
24
|
+
puts
|
|
25
|
+
|
|
26
|
+
# Step 1: Parse schema
|
|
27
|
+
puts "Step 1: Parsing schema..."
|
|
28
|
+
parsed = Expressir::Express::Parser.from_file(SCHEMA_FILE)
|
|
29
|
+
puts " ✓ Found #{parsed.schemas.size} schema(s)"
|
|
30
|
+
|
|
31
|
+
# Step 2: Build repository
|
|
32
|
+
puts "\nStep 2: Building repository..."
|
|
33
|
+
repo = Expressir::Model::Repository.new
|
|
34
|
+
|
|
35
|
+
# Initialize schemas if needed (for compatibility)
|
|
36
|
+
repo.instance_variable_set(:@schemas, []) if repo.schemas.nil?
|
|
37
|
+
|
|
38
|
+
parsed.schemas.each { |schema| repo.schemas << schema }
|
|
39
|
+
repo.resolve_all_references
|
|
40
|
+
puts " ✓ Repository built with #{repo.schemas.size} schema(s)"
|
|
41
|
+
|
|
42
|
+
# Step 3: Show statistics
|
|
43
|
+
puts "\nStep 3: Repository statistics..."
|
|
44
|
+
stats = repo.statistics
|
|
45
|
+
puts " Entities: #{stats[:total_entities]}"
|
|
46
|
+
puts " Types: #{stats[:total_types]}"
|
|
47
|
+
puts " Types by category:"
|
|
48
|
+
stats[:types_by_category].each do |category, count|
|
|
49
|
+
puts " #{category}: #{count}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Step 4: Export to package
|
|
53
|
+
puts "\nStep 4: Creating LER package..."
|
|
54
|
+
repo.export_to_package(
|
|
55
|
+
OUTPUT_PACKAGE,
|
|
56
|
+
name: "Simple Example Package",
|
|
57
|
+
version: "1.0.0",
|
|
58
|
+
description: "Example schema demonstrating LER packaging",
|
|
59
|
+
express_mode: "include_all",
|
|
60
|
+
resolution_mode: "resolved",
|
|
61
|
+
serialization_format: "yaml",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
file_size = File.size(OUTPUT_PACKAGE)
|
|
65
|
+
puts " ✓ Package created: #{File.basename(OUTPUT_PACKAGE)}"
|
|
66
|
+
puts " Size: #{file_size} bytes (#{(file_size / 1024.0).round(2)} KB)"
|
|
67
|
+
|
|
68
|
+
puts "\n#{'=' * 60}"
|
|
69
|
+
puts "Success! Package ready at: #{OUTPUT_PACKAGE}"
|
|
70
|
+
puts "\nTry these commands:"
|
|
71
|
+
puts " ruby examples/ler_query.rb"
|
|
72
|
+
puts " ruby examples/ler_stats.rb"
|
|
73
|
+
puts " bundle exec expressir package info #{OUTPUT_PACKAGE}"
|
|
74
|
+
puts " bundle exec expressir entity list --from #{OUTPUT_PACKAGE}"
|
|
75
|
+
puts
|