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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +98 -0
  3. data/.github/workflows/links.yml +100 -0
  4. data/.github/workflows/rake.yml +4 -0
  5. data/.github/workflows/release.yml +5 -0
  6. data/.github/workflows/validate_schemas.yml +1 -1
  7. data/.gitignore +3 -0
  8. data/.rubocop.yml +1 -1
  9. data/.rubocop_todo.yml +244 -39
  10. data/Gemfile +2 -1
  11. data/README.adoc +621 -54
  12. data/docs/Gemfile +12 -0
  13. data/docs/_config.yml +141 -0
  14. data/docs/_guides/changes/changes-format.adoc +778 -0
  15. data/docs/_guides/changes/importing-eengine.adoc +898 -0
  16. data/docs/_guides/changes/index.adoc +396 -0
  17. data/docs/_guides/changes/programmatic-usage.adoc +1038 -0
  18. data/docs/_guides/changes/validating-changes.adoc +681 -0
  19. data/docs/_guides/cli/benchmark-performance.adoc +834 -0
  20. data/docs/_guides/cli/coverage-analysis.adoc +921 -0
  21. data/docs/_guides/cli/format-schemas.adoc +547 -0
  22. data/docs/_guides/cli/index.adoc +8 -0
  23. data/docs/_guides/cli/managing-changes.adoc +927 -0
  24. data/docs/_guides/cli/validate-ascii.adoc +645 -0
  25. data/docs/_guides/cli/validate-schemas.adoc +534 -0
  26. data/docs/_guides/index.adoc +165 -0
  27. data/docs/_guides/ler/creating-packages.adoc +664 -0
  28. data/docs/_guides/ler/index.adoc +305 -0
  29. data/docs/_guides/ler/loading-packages.adoc +707 -0
  30. data/docs/_guides/ler/package-formats.adoc +748 -0
  31. data/docs/_guides/ler/querying-packages.adoc +826 -0
  32. data/docs/_guides/ler/validating-packages.adoc +750 -0
  33. data/docs/_guides/liquid/basic-templates.adoc +813 -0
  34. data/docs/_guides/liquid/documentation-generation.adoc +1042 -0
  35. data/docs/_guides/liquid/drops-reference.adoc +829 -0
  36. data/docs/_guides/liquid/filters-and-tags.adoc +912 -0
  37. data/docs/_guides/liquid/index.adoc +468 -0
  38. data/docs/_guides/manifests/creating-manifests.adoc +483 -0
  39. data/docs/_guides/manifests/index.adoc +307 -0
  40. data/docs/_guides/manifests/resolving-manifests.adoc +557 -0
  41. data/docs/_guides/manifests/validating-manifests.adoc +713 -0
  42. data/docs/_guides/ruby-api/formatting-schemas.adoc +605 -0
  43. data/docs/_guides/ruby-api/index.adoc +257 -0
  44. data/docs/_guides/ruby-api/parsing-files.adoc +421 -0
  45. data/docs/_guides/ruby-api/search-engine.adoc +609 -0
  46. data/docs/_guides/ruby-api/working-with-repository.adoc +577 -0
  47. data/docs/_pages/data-model.adoc +665 -0
  48. data/docs/_pages/express-language.adoc +506 -0
  49. data/docs/_pages/getting-started.adoc +414 -0
  50. data/docs/_pages/index.adoc +116 -0
  51. data/docs/_pages/introduction.adoc +256 -0
  52. data/docs/_pages/ler-packages.adoc +837 -0
  53. data/docs/_pages/parsers.adoc +683 -0
  54. data/docs/_pages/schema-manifests.adoc +431 -0
  55. data/docs/_references/index.adoc +228 -0
  56. data/docs/_tutorials/creating-ler-package.adoc +735 -0
  57. data/docs/_tutorials/documentation-coverage.adoc +795 -0
  58. data/docs/_tutorials/index.adoc +221 -0
  59. data/docs/_tutorials/liquid-templates.adoc +806 -0
  60. data/docs/_tutorials/parsing-your-first-schema.adoc +522 -0
  61. data/docs/_tutorials/querying-schemas.adoc +751 -0
  62. data/docs/_tutorials/working-with-multiple-schemas.adoc +676 -0
  63. data/docs/index.adoc +242 -0
  64. data/docs/lychee.toml +84 -0
  65. data/examples/demo_ler_usage.sh +86 -0
  66. data/examples/ler/README.md +111 -0
  67. data/examples/ler/simple_example.ler +0 -0
  68. data/examples/ler/simple_schema.exp +33 -0
  69. data/examples/ler_build.rb +75 -0
  70. data/examples/ler_cli.rb +79 -0
  71. data/examples/ler_demo_complete.rb +276 -0
  72. data/examples/ler_query.rb +91 -0
  73. data/examples/ler_query_examples.rb +305 -0
  74. data/examples/ler_stats.rb +81 -0
  75. data/examples/phase3_demo.rb +159 -0
  76. data/examples/query_demo_simple.rb +131 -0
  77. data/expressir.gemspec +2 -0
  78. data/lib/expressir/cli.rb +12 -4
  79. data/lib/expressir/commands/manifest.rb +427 -0
  80. data/lib/expressir/commands/package.rb +1274 -0
  81. data/lib/expressir/commands/validate.rb +70 -37
  82. data/lib/expressir/commands/validate_ascii.rb +607 -0
  83. data/lib/expressir/commands/validate_load.rb +88 -0
  84. data/lib/expressir/express/formatter.rb +5 -1
  85. data/lib/expressir/express/formatters/remark_item_formatter.rb +25 -0
  86. data/lib/expressir/express/parser.rb +33 -0
  87. data/lib/expressir/manifest/resolver.rb +213 -0
  88. data/lib/expressir/manifest/validator.rb +195 -0
  89. data/lib/expressir/model/declarations/entity.rb +6 -0
  90. data/lib/expressir/model/dependency_resolver.rb +270 -0
  91. data/lib/expressir/model/indexes/entity_index.rb +103 -0
  92. data/lib/expressir/model/indexes/reference_index.rb +148 -0
  93. data/lib/expressir/model/indexes/type_index.rb +149 -0
  94. data/lib/expressir/model/interface_validator.rb +384 -0
  95. data/lib/expressir/model/repository.rb +400 -5
  96. data/lib/expressir/model/repository_validator.rb +295 -0
  97. data/lib/expressir/model/search_engine.rb +525 -0
  98. data/lib/expressir/model.rb +4 -94
  99. data/lib/expressir/package/builder.rb +200 -0
  100. data/lib/expressir/package/metadata.rb +81 -0
  101. data/lib/expressir/package/reader.rb +165 -0
  102. data/lib/expressir/schema_manifest.rb +11 -1
  103. data/lib/expressir/version.rb +1 -1
  104. data/lib/expressir.rb +15 -2
  105. metadata +114 -4
  106. data/docs/benchmarking.adoc +0 -107
  107. data/docs/liquid_drops.adoc +0 -1547
@@ -0,0 +1,506 @@
1
+ ---
2
+ title: EXPRESS Language
3
+ nav_order: 4
4
+ ---
5
+
6
+ == EXPRESS Data Modeling Language
7
+
8
+ === Purpose
9
+
10
+ This page explains the EXPRESS data modeling language that Expressir parses and processes. Understanding EXPRESS is essential for working effectively with Expressir, as it provides the foundation for interpreting schemas, entities, and data models.
11
+
12
+ === References
13
+
14
+ * link:introduction.html[Introduction] - Expressir overview
15
+ * link:data-model.html[Data Model] - How Expressir represents EXPRESS in Ruby
16
+ * link:parsers.html[Parsers] - How EXPRESS is parsed
17
+ * https://www.iso.org/standard/38047.html[ISO 10303-11:2004] - EXPRESS language standard
18
+
19
+ === Concepts
20
+
21
+ EXPRESS:: A formal data specification language defined by ISO 10303-11, designed for unambiguous product data definition
22
+ Schema:: A named collection of EXPRESS declarations that forms a complete data model
23
+ Entity:: A data structure definition similar to a class, defining attributes and constraints
24
+ Type:: A data type definition that can be primitive, constructed (SELECT, ENUMERATION), or aggregate (ARRAY, LIST, SET, BAG)
25
+ Attribute:: A property of an entity with a name and type
26
+ Constraint:: Rules (WHERE clauses, UNIQUE rules) that restrict valid data values
27
+ Interface:: Mechanism for using or referencing definitions from other schemas (USE FROM, REFERENCE FROM)
28
+
29
+ === What is EXPRESS?
30
+
31
+ EXPRESS is a data modeling language standardized as ISO 10303-11, "Industrial automation systems and integration — Product data representation and exchange — Part 11: Description methods: The EXPRESS language reference manual."
32
+
33
+ It was developed as part of the STEP (STandard for the Exchange of Product model data) initiative to provide:
34
+
35
+ **Formal specification language**::
36
+ Precise, unambiguous definitions of product data structures
37
+
38
+ **Machine-readable format**::
39
+ Schemas can be processed by software tools for validation and implementation
40
+
41
+ **Rich type system**::
42
+ Supports complex data modeling including inheritance, constraints, and algorithms
43
+
44
+ **Language independence**::
45
+ Can be implemented in any programming language
46
+
47
+ EXPRESS is widely used in:
48
+
49
+ * ISO 10303 (STEP) application protocols for product data exchange
50
+ * ISO 13584 (PLIB) parts library standards
51
+ * ISO 15926 (Process plants) data integration standards
52
+ * IFC (Industry Foundation Classes) for building information modeling
53
+
54
+ === Key Concepts
55
+
56
+ ==== Schemas
57
+
58
+ A schema is the top-level organizational unit in EXPRESS:
59
+
60
+ [source,express]
61
+ ----
62
+ SCHEMA geometry_schema;
63
+ -- Entities, types, and functions go here
64
+ END_SCHEMA;
65
+ ----
66
+
67
+ Schemas can interface with other schemas:
68
+
69
+ [source,express]
70
+ ----
71
+ SCHEMA application_schema;
72
+ USE FROM geometry_schema; -- Import all public declarations
73
+ REFERENCE FROM support_schema (date); -- Import specific items
74
+ END_SCHEMA;
75
+ ----
76
+
77
+ ==== Entities
78
+
79
+ Entities define data structures similar to classes in object-oriented programming:
80
+
81
+ [source,express]
82
+ ----
83
+ ENTITY person;
84
+ name : STRING;
85
+ birth_date : date;
86
+ age : INTEGER;
87
+ END_ENTITY;
88
+ ----
89
+
90
+ Entities support inheritance:
91
+
92
+ [source,express]
93
+ ----
94
+ ENTITY employee
95
+ SUBTYPE OF (person);
96
+ employee_id : STRING;
97
+ department : STRING;
98
+ END_ENTITY;
99
+ ----
100
+
101
+ ==== Types
102
+
103
+ EXPRESS supports several type categories:
104
+
105
+ **Simple types** (primitives):
106
+
107
+ [source,express]
108
+ ----
109
+ TYPE positive_length = REAL;
110
+ WHERE
111
+ WR1: SELF > 0.0;
112
+ END_TYPE;
113
+ ----
114
+
115
+ **Enumeration types**:
116
+
117
+ [source,express]
118
+ ----
119
+ TYPE color = ENUMERATION OF
120
+ (red, green, blue, yellow);
121
+ END_TYPE;
122
+ ----
123
+
124
+ **Select types** (unions):
125
+
126
+ [source,express]
127
+ ----
128
+ TYPE length_or_measure = SELECT
129
+ (length_measure,
130
+ positive_length);
131
+ END_TYPE;
132
+ ----
133
+
134
+ **Aggregate types**:
135
+
136
+ [source,express]
137
+ ----
138
+ TYPE point_list = LIST [3:3] OF REAL; -- Exactly 3 reals
139
+ TYPE name_set = SET [1:?] OF STRING; -- One or more unique strings
140
+ TYPE coordinates = ARRAY [1:3] OF REAL; -- Indexed array
141
+ TYPE items = BAG [0:?] OF product; -- Unordered, duplicates allowed
142
+ ----
143
+
144
+ ==== Attributes
145
+
146
+ Entities have three types of attributes:
147
+
148
+ **Explicit attributes** (directly stored):
149
+
150
+ [source,express]
151
+ ----
152
+ ENTITY circle;
153
+ radius : positive_length;
154
+ center : point;
155
+ END_ENTITY;
156
+ ----
157
+
158
+ **Derived attributes** (computed):
159
+
160
+ [source,express]
161
+ ----
162
+ ENTITY circle;
163
+ radius : positive_length;
164
+ DERIVE
165
+ area : REAL := 3.14159 * radius * radius;
166
+ diameter : REAL := 2.0 * radius;
167
+ END_ENTITY;
168
+ ----
169
+
170
+ **Inverse attributes** (relationships):
171
+
172
+ [source,express]
173
+ ----
174
+ ENTITY person;
175
+ name : STRING;
176
+ END_ENTITY;
177
+
178
+ ENTITY organization;
179
+ org_name : STRING;
180
+ INVERSE
181
+ employees : SET [0:?] OF person FOR works_for;
182
+ END_ENTITY;
183
+
184
+ ENTITY person;
185
+ name : STRING;
186
+ works_for : OPTIONAL organization;
187
+ END_ENTITY;
188
+ ----
189
+
190
+ ==== Constraints
191
+
192
+ EXPRESS provides several constraint mechanisms:
193
+
194
+ **WHERE rules** (entity-level constraints):
195
+
196
+ [source,express]
197
+ ----
198
+ ENTITY rectangle;
199
+ width : positive_length;
200
+ height : positive_length;
201
+ WHERE
202
+ WR1: width > 0.0;
203
+ WR2: height > 0.0;
204
+ WR3: width >= height; -- Must be landscape
205
+ END_ENTITY;
206
+ ----
207
+
208
+ **UNIQUE rules** (uniqueness constraints):
209
+
210
+ [source,express]
211
+ ----
212
+ ENTITY person;
213
+ name : STRING;
214
+ employee_id : STRING;
215
+ UNIQUE
216
+ UR1: employee_id; -- Employee ID must be unique across all persons
217
+ END_ENTITY;
218
+ ----
219
+
220
+ **Global rules** (cross-entity constraints):
221
+
222
+ [source,express]
223
+ ----
224
+ RULE unique_organization_names FOR (organization);
225
+ WHERE
226
+ WR1: SIZEOF(QUERY(o1 <* organization |
227
+ SIZEOF(QUERY(o2 <* organization |
228
+ o1 :<>: o2 AND o1.org_name = o2.org_name
229
+ )) > 0
230
+ )) = 0;
231
+ END_RULE;
232
+ ----
233
+
234
+ ==== Functions and Procedures
235
+
236
+ EXPRESS supports algorithmic definitions:
237
+
238
+ **Functions** (return a value):
239
+
240
+ [source,express]
241
+ ----
242
+ FUNCTION max_value(x, y : REAL) : REAL;
243
+ IF x > y THEN
244
+ RETURN(x);
245
+ ELSE
246
+ RETURN(y);
247
+ END_IF;
248
+ END_FUNCTION;
249
+ ----
250
+
251
+ **Procedures** (perform actions):
252
+
253
+ [source,express]
254
+ ----
255
+ PROCEDURE log_message(msg : STRING);
256
+ LOCAL
257
+ timestamp : STRING;
258
+ END_LOCAL;
259
+
260
+ timestamp := get_timestamp();
261
+ write_log(timestamp + ': ' + msg);
262
+ END_PROCEDURE;
263
+ ----
264
+
265
+ === EXPRESS Syntax Basics
266
+
267
+ ==== Declaration Order
268
+
269
+ EXPRESS declarations follow this order within a schema:
270
+
271
+ 1. Interfaces (USE FROM, REFERENCE FROM)
272
+ 2. Constants
273
+ 3. Types
274
+ 4. Entities
275
+ 5. Subtype constraints
276
+ 6. Functions
277
+ 7. Procedures
278
+ 8. Rules
279
+
280
+ ==== Comments
281
+
282
+ EXPRESS supports two comment styles:
283
+
284
+ [source,express]
285
+ ----
286
+ -- Single line comment
287
+
288
+ (* Multi-line
289
+ comment *)
290
+
291
+ (* Can also be used
292
+ -- with single-line comments inside *)
293
+ ----
294
+
295
+ ==== Naming Conventions
296
+
297
+ * Schema names: lowercase with underscores (`geometry_schema`)
298
+ * Entity names: lowercase with underscores (`geometric_representation_item`)
299
+ * Attribute names: lowercase with underscores (`item_count`)
300
+ * Type names: lowercase with underscores (`length_measure`)
301
+ * Function names: lowercase with underscores (`get_name`)
302
+ * Constants: uppercase with underscores (`PI`)
303
+
304
+ ==== Case Sensitivity
305
+
306
+ EXPRESS is case-insensitive, but by convention:
307
+
308
+ * Keywords: UPPERCASE (`ENTITY`, `END_ENTITY`)
309
+ * Identifiers: lowercase_with_underscores
310
+
311
+ === EXPRESS vs Other Languages
312
+
313
+ ==== EXPRESS vs JSON Schema
314
+
315
+ **EXPRESS advantages**:
316
+
317
+ * Formal semantics with mathematical precision
318
+ * Entity inheritance and polymorphism
319
+ * Complex constraints (WHERE rules)
320
+ * Algorithmic content (functions, procedures)
321
+ * Inverse relationships
322
+
323
+ **JSON Schema advantages**:
324
+
325
+ * Simpler syntax
326
+ * Direct JavaScript integration
327
+ * Wider web ecosystem support
328
+ * Easier for simple data validation
329
+
330
+ ==== EXPRESS vs UML
331
+
332
+ **EXPRESS advantages**:
333
+
334
+ * Text-based, version control friendly
335
+ * Formal, executable semantics
336
+ * Integrated constraint language
337
+ * Designed for data exchange specifications
338
+
339
+ **UML advantages**:
340
+
341
+ * Visual representation
342
+ * Multiple diagram types (class, sequence, state)
343
+ * Broader software modeling scope
344
+ * More intuitive for object-oriented developers
345
+
346
+ ==== EXPRESS vs XML Schema (XSD)
347
+
348
+ **EXPRESS advantages**:
349
+
350
+ * Richer type system (SELECT, inheritance)
351
+ * Entity relationship modeling
352
+ * Constraint language (WHERE rules)
353
+ * Functions and procedures
354
+ * Format-independent
355
+
356
+ **XSD advantages**:
357
+
358
+ * Native XML integration
359
+ * Wide tool support
360
+ * Namespace management
361
+ * Direct XML validation
362
+
363
+ ==== EXPRESS vs Relational Schema (SQL DDL)
364
+
365
+ **EXPRESS advantages**:
366
+
367
+ * Object-oriented (inheritance, polymorphism)
368
+ * Derived attributes
369
+ * Complex aggregate types
370
+ * Formal constraints
371
+ * Platform-independent
372
+
373
+ **SQL DDL advantages**:
374
+
375
+ * Direct database implementation
376
+ * Query language (SQL) integration
377
+ * Mature ecosystem
378
+ * Performance optimizations
379
+
380
+ === Common EXPRESS Patterns
381
+
382
+ ==== Optional Attributes
383
+
384
+ Use `OPTIONAL` for attributes that may be absent:
385
+
386
+ [source,express]
387
+ ----
388
+ ENTITY person;
389
+ name : STRING;
390
+ middle_name : OPTIONAL STRING;
391
+ birth_date : date;
392
+ END_ENTITY;
393
+ ----
394
+
395
+ ==== Extensible SELECT
396
+
397
+ Allow types to be extended by other schemas:
398
+
399
+ [source,express]
400
+ ----
401
+ TYPE measure_value = EXTENSIBLE SELECT
402
+ (length_measure,
403
+ area_measure,
404
+ volume_measure);
405
+ END_TYPE;
406
+ ----
407
+
408
+ ==== Supertype Constraints
409
+
410
+ Control instantiation of subtypes:
411
+
412
+ [source,express]
413
+ ----
414
+ ENTITY shape
415
+ ABSTRACT SUPERTYPE OF (ONEOF(circle, rectangle));
416
+ -- Must be either circle or rectangle, not shape itself
417
+ END_ENTITY;
418
+
419
+ ENTITY circle
420
+ SUBTYPE OF (shape);
421
+ radius : REAL;
422
+ END_ENTITY;
423
+
424
+ ENTITY rectangle
425
+ SUBTYPE OF (shape);
426
+ width : REAL;
427
+ height : REAL;
428
+ END_ENTITY;
429
+ ----
430
+
431
+ ==== Self-Reference
432
+
433
+ Entities can reference themselves:
434
+
435
+ [source,express]
436
+ ----
437
+ ENTITY tree_node;
438
+ value : STRING;
439
+ parent : OPTIONAL tree_node;
440
+ children : SET [0:?] OF tree_node;
441
+ END_ENTITY;
442
+ ----
443
+
444
+ ==== Multiple Inheritance
445
+
446
+ EXPRESS supports multiple inheritance:
447
+
448
+ [source,express]
449
+ ----
450
+ ENTITY employee
451
+ SUBTYPE OF (person);
452
+ employee_id : STRING;
453
+ END_ENTITY;
454
+
455
+ ENTITY manager
456
+ SUBTYPE OF (employee, leader);
457
+ department : organization;
458
+ END_ENTITY;
459
+ ----
460
+
461
+ === Working with EXPRESS in Expressir
462
+
463
+ When you parse EXPRESS with Expressir:
464
+
465
+ **The parser reads**::
466
+ Text files in EXPRESS syntax (.exp files)
467
+
468
+ **And produces**::
469
+ A Ruby object model representing the schema structure
470
+
471
+ **You can then**::
472
+ * Navigate entities and attributes
473
+ * Analyze relationships
474
+ * Generate documentation
475
+ * Transform to other formats
476
+ * Validate schema structure
477
+
478
+ See link:data-model.html[Data Model] for details on Expressir's Ruby representation.
479
+
480
+ === Learning More
481
+
482
+ To work effectively with EXPRESS schemas in Expressir:
483
+
484
+ **Next steps**::
485
+ * Try link:../tutorials/parsing-your-first-schema.html[parsing a schema]
486
+ * Explore link:data-model.html[Expressir's data model]
487
+ * Study link:parsers.html[how parsing works]
488
+
489
+ **EXPRESS resources**::
490
+ * Read the ISO 10303-11 standard
491
+ * Study existing STEP schemas
492
+ * Review EXPRESS-G diagrams for visual understanding
493
+
494
+ **Practical experience**::
495
+ * Parse ISO 10303 schemas with Expressir
496
+ * Analyze entity relationships
497
+ * Write validation rules
498
+ * Generate documentation
499
+
500
+ === Bibliography
501
+
502
+ * https://www.iso.org/standard/38047.html[ISO 10303-11:2004] - EXPRESS language reference manual (official standard)
503
+ * https://www.expresslang.org/[EXPRESS Language Foundation (ELF)] - Community resources and specifications
504
+ * https://en.wikipedia.org/wiki/EXPRESS_(data_modeling_language)[EXPRESS on Wikipedia] - Overview and history
505
+ * https://www.steptools.com/stds/step/IS_final_p11e3.html[EXPRESS Language Reference] - Comprehensive language guide
506
+ * https://www.nist.gov/publications/introduction-express-language[NIST Introduction to EXPRESS] - Tutorial and examples