suma 0.5.8 → 0.5.9
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/release-provenance.yml +5 -2
- data/README.adoc +136 -11
- data/lib/suma/urn_resolver.rb +51 -1
- data/lib/suma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54c10b8d56459f9d53cd1b5988cbcc2193675f4dffa43e115845400497faa8f9
|
|
4
|
+
data.tar.gz: b46df0c3ef57f69e2e0e5e3b7dfdf3c464189a66f372ef2a5f7a5d3a8d47b34b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 51f6a6ed42abb76af7342d06e0b73c3132ddf7e65ffdb5d29c96892860fd3be534557581f6bd14b6dd15e022a8e2ac250cdb23f6ed4d68242457515b8951b415
|
|
7
|
+
data.tar.gz: c562c0691baa4b3fb708b94dd5853014a18e4bad0cd8527cbf7922a7273ebd982a5239ea13914c0d60f279e2ceae9b534a43a58ff42b339c7dd5114f7e5be576
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
name: release-provenance
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
release
|
|
5
|
-
|
|
4
|
+
# Tag pushes reliably fan out (the release workflow pushes v* tags with a
|
|
5
|
+
# PAT); release-published events created by CI tokens may not.
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
6
9
|
workflow_dispatch:
|
|
7
10
|
|
|
8
11
|
permissions:
|
data/README.adoc
CHANGED
|
@@ -14,12 +14,18 @@ to build the following artifacts:
|
|
|
14
14
|
|
|
15
15
|
== Features
|
|
16
16
|
|
|
17
|
-
* EXPRESS schema management for STEP
|
|
17
|
+
* EXPRESS schema management for STEP and other schema collections
|
|
18
18
|
* Document collection building and compilation
|
|
19
|
+
* Referential closure validation over the whole corpus
|
|
19
20
|
* EXPRESS links validation and extraction
|
|
20
21
|
* Schema listing file generation
|
|
22
|
+
* OWL/Turtle projection with structural validation
|
|
23
|
+
* Typed change manifests, changelogs, and dependency impact analysis
|
|
24
|
+
* Glossarist terminology and hierarchical registers with edition metadata
|
|
25
|
+
* Dereferenceable URN artifacts (canonical JSON + static HTML)
|
|
26
|
+
* Incremental, parallel, and cached corpus builds
|
|
27
|
+
* Reproducible outputs with verifiable, optionally signed provenance
|
|
21
28
|
* Integration with the Metanorma ecosystem
|
|
22
|
-
* Progress tracking for schema loading operations
|
|
23
29
|
|
|
24
30
|
== Installation
|
|
25
31
|
|
|
@@ -37,13 +43,16 @@ $ gem install suma
|
|
|
37
43
|
# Defaults to `suma help`
|
|
38
44
|
$ suma
|
|
39
45
|
Commands:
|
|
40
|
-
suma build METANORMA_SITE_MANIFEST # Build collection
|
|
41
|
-
suma
|
|
42
|
-
suma
|
|
43
|
-
suma
|
|
44
|
-
suma
|
|
45
|
-
suma
|
|
46
|
+
suma build METANORMA_SITE_MANIFEST # Build collection from site manifest
|
|
47
|
+
suma check_svg_quality [PATH] # Check SVG quality
|
|
48
|
+
suma compare TRIAL_SCHEMA REFERENCE_SCHEMA # Compare schemas; typed changes, impact
|
|
49
|
+
suma convert-jsdai XML_FILE IMAGE_FILE OUTPUT_DIR # Convert JSDAI XML and image files to SVG and EXP
|
|
50
|
+
suma export *FILES -o OUTPUT # Export EXPRESS schemas or project them to OWL
|
|
51
|
+
suma extract-terms SCHEMA_MANIFEST_FILE GLOSSARIST_OUTPUT_PATH # Extract entity concepts to Glossarist v3
|
|
52
|
+
suma generate-register SCHEMA_MANIFEST_FILE OUTPUT_PATH # Generate hierarchical register.yaml
|
|
53
|
+
suma generate-schemas METANORMA_MANIFEST_FILE SCHEMA_MANIFEST_FILE # Generate a schema manifest from a site manifest
|
|
46
54
|
suma reformat EXPRESS_FILE_PATH # Reformat EXPRESS files
|
|
55
|
+
suma resolve [URN] --manifest=MANIFEST -o OUTPUT # Emit canonical JSON + HTML for URNs
|
|
47
56
|
suma validate SUBCOMMAND ...ARGS # Validate express documents
|
|
48
57
|
----
|
|
49
58
|
|
|
@@ -65,6 +74,13 @@ Options:
|
|
|
65
74
|
|
|
66
75
|
`--[no-]compile`:: Compile or skip compilation of collection (default: true)
|
|
67
76
|
`--schemas-all-path=PATH`, `-s PATH`:: Generate file that contains all schemas in the collection
|
|
77
|
+
`--[no-]staged`:: Memory-bounded build: compile each member in its own process, then reinflate
|
|
78
|
+
`--[no-]incremental`:: Re-render only changed schemas and their transitive dependents
|
|
79
|
+
`--state-file=PATH`:: Incremental build state file (default: `plain_schemas/.suma-build-state.json`)
|
|
80
|
+
`--jobs=N`:: Concurrent schema export workers (document compilation stays sequential; default: 1)
|
|
81
|
+
`--provenance=PATH`:: Write a provenance manifest (sha256 of inputs/outputs + toolchain versions)
|
|
82
|
+
`--sign=METHOD`:: Sign the provenance manifest: `minisign` or `sigstore`
|
|
83
|
+
`--sign-key=PATH`:: Signing key; minisign requires it, sigstore signs keylessly when omitted
|
|
68
84
|
|
|
69
85
|
The generated `schemas-*.yaml` file name is derived from the input file name
|
|
70
86
|
with the word `metanorma` replaced with `schemas`.
|
|
@@ -141,6 +157,7 @@ $ suma validate SUBCOMMAND [options]
|
|
|
141
157
|
Subcommands:
|
|
142
158
|
|
|
143
159
|
`links`:: Validate EXPRESS links
|
|
160
|
+
`closure`:: Validate referential closure over the whole corpus
|
|
144
161
|
|
|
145
162
|
==== Links subcommand
|
|
146
163
|
|
|
@@ -176,6 +193,23 @@ This command:
|
|
|
176
193
|
* Writes validation results to the `OUTPUT_FILE`
|
|
177
194
|
* Provides progress bars to track schema loading and link validation
|
|
178
195
|
|
|
196
|
+
==== Closure subcommand
|
|
197
|
+
|
|
198
|
+
The `closure` subcommand extracts every EXPRESS-internal reference (attribute
|
|
199
|
+
domains, SELECT and aggregate branches, where-rule expressions, subtype
|
|
200
|
+
constraints, supertype/subtype lists, rule applies-to, and USE/REFERENCE
|
|
201
|
+
interfaces) and resolves it against the corpus graph. It exits non-zero when
|
|
202
|
+
any reference does not resolve, which makes it usable as a CI gate
|
|
203
|
+
(`rake closure` runs it on the fixture corpus).
|
|
204
|
+
|
|
205
|
+
[source,sh]
|
|
206
|
+
----
|
|
207
|
+
$ suma validate closure SCHEMAS_MANIFEST [DOCUMENTS_PATH] [--format terminal|json|yaml]
|
|
208
|
+
----
|
|
209
|
+
|
|
210
|
+
When `DOCUMENTS_PATH` is given, documentation-layer link failures are merged
|
|
211
|
+
into the same report.
|
|
212
|
+
|
|
179
213
|
|
|
180
214
|
=== Generate schemas command
|
|
181
215
|
|
|
@@ -225,7 +259,7 @@ used for other EXPRESS schema collections that require term extraction for
|
|
|
225
259
|
glossary or dictionary applications.
|
|
226
260
|
|
|
227
261
|
The `suma extract-terms` command extracts terms from EXPRESS schemas and
|
|
228
|
-
generates a Glossarist
|
|
262
|
+
generates a Glossarist v3 dataset in the output directory. This command processes
|
|
229
263
|
various types of STEP schemas and creates standardized terminology datasets
|
|
230
264
|
suitable for glossary and dictionary applications.
|
|
231
265
|
|
|
@@ -239,12 +273,14 @@ Parameters:
|
|
|
239
273
|
`SCHEMA_MANIFEST_FILE`:: Path to the schema manifest file that lists all schemas
|
|
240
274
|
to process (e.g., "schemas-smrl-all.yml")
|
|
241
275
|
|
|
242
|
-
`GLOSSARIST_OUTPUT_PATH`:: Path to the output directory where the Glossarist
|
|
276
|
+
`GLOSSARIST_OUTPUT_PATH`:: Path to the output directory where the Glossarist v3
|
|
243
277
|
dataset will be generated
|
|
244
278
|
|
|
245
279
|
Options:
|
|
246
280
|
|
|
247
281
|
`--language_code`, `-l`:: Language code for the Glossarist dataset (default: "eng")
|
|
282
|
+
`--edition=N`:: Owning edition recorded on each concept
|
|
283
|
+
`--language-codes=a,b`:: Additional linked localization languages (the primary language is always included)
|
|
248
284
|
|
|
249
285
|
==== Supported schema types
|
|
250
286
|
|
|
@@ -275,7 +311,7 @@ information:
|
|
|
275
311
|
|
|
276
312
|
==== Output format
|
|
277
313
|
|
|
278
|
-
The command generates a Glossarist
|
|
314
|
+
The command generates a Glossarist v3 compliant dataset with:
|
|
279
315
|
|
|
280
316
|
* `concept/` directory containing concept definition files in YAML
|
|
281
317
|
* `localized_concept/` directory containing localized concept files in YAML
|
|
@@ -326,6 +362,13 @@ Options:
|
|
|
326
362
|
The wildcard is stripped for the base URN and kept in `urnAliases`.
|
|
327
363
|
*Required*.
|
|
328
364
|
|
|
365
|
+
`--year=N`:: Edition year recorded on the register
|
|
366
|
+
|
|
367
|
+
`--supersedes=URN`:: URN/ref of the superseded edition
|
|
368
|
+
|
|
369
|
+
`--edition=N`:: Edition number, tagged as `edition:N`; every register also
|
|
370
|
+
carries a `dataset:<id>` tag so sibling editions can be grouped.
|
|
371
|
+
|
|
329
372
|
The URN is fully configurable — every component can be changed to match the
|
|
330
373
|
dataset being exported. The general structure is:
|
|
331
374
|
|
|
@@ -521,6 +564,11 @@ Options:
|
|
|
521
564
|
`--[no-]annotations`:: Include annotations (remarks/comments) in exported schemas (default: false)
|
|
522
565
|
|
|
523
566
|
`--[no-]zip`:: Create ZIP archive of exported schemas (default: false)
|
|
567
|
+
`--profile=PROFILE`:: Schema profile: `iso10303` (default) or `generic`
|
|
568
|
+
`--publication=SCHEMA_ID`:: Export an AP publication bundle: the lead schema plus its transitive USE-FROM/REFERENCE closure
|
|
569
|
+
`--format=FORMAT`:: Output format: `express` (default) or `owl`
|
|
570
|
+
`--[no-]corpus`:: OWL only: emit one corpus ontology importing every schema ontology
|
|
571
|
+
`--urn=URN`:: OWL only: base URN for IRIs, before the `:tech` component
|
|
524
572
|
|
|
525
573
|
==== Behavior
|
|
526
574
|
|
|
@@ -639,6 +687,65 @@ express-files/
|
|
|
639
687
|
----
|
|
640
688
|
|
|
641
689
|
|
|
690
|
+
=== Schema profiles and AP publications
|
|
691
|
+
|
|
692
|
+
Suma works with any schema collection. `Suma::SchemaProfile` declares how
|
|
693
|
+
schema identifiers and paths map to types, how identifiers become display
|
|
694
|
+
names, and the ordered register categories. Registered profiles:
|
|
695
|
+
|
|
696
|
+
`iso10303`:: Default; STEP conventions including `/applications/` classifying as an application protocol
|
|
697
|
+
`generic`:: No STEP conventions (one category for every schema)
|
|
698
|
+
|
|
699
|
+
An AP publication is a lead schema bundled with the module and resource
|
|
700
|
+
schemas it USEs. `--publication SCHEMA_ID` computes the transitive
|
|
701
|
+
USE-FROM/REFERENCE closure and writes the bundle flat under
|
|
702
|
+
`OUTPUT/<lead_id>/`. In the register, application protocols are grouped under
|
|
703
|
+
a per-publication parent section.
|
|
704
|
+
|
|
705
|
+
=== OWL projection
|
|
706
|
+
|
|
707
|
+
`suma export --format owl` projects a parsed corpus into OWL/Turtle:
|
|
708
|
+
|
|
709
|
+
* entities become `owl:Class`; `SUBTYPE OF` becomes `rdfs:subClassOf`
|
|
710
|
+
* SELECT types become `owl:unionOf`; enumerations become `owl:oneOf` named individuals
|
|
711
|
+
* simple type aliases become `rdfs:Datatype`
|
|
712
|
+
* explicit, derived, and inverse attributes become object/datatype properties attached through named `owl:Restriction` nodes, with cardinality from optionality and aggregate bounds
|
|
713
|
+
* WHERE, DERIVE, and INVERSE clauses are preserved as annotated constraints
|
|
714
|
+
|
|
715
|
+
IRIs derive from the corpus URN scheme (`<base>:tech:<schema>.<element>`).
|
|
716
|
+
Per-schema ontologies declare `owl:imports` for their USE-FROM/REFERENCE
|
|
717
|
+
targets, and `--corpus` adds a corpus ontology importing every schema. The
|
|
718
|
+
projection is validated before writing (materialization, property
|
|
719
|
+
declarations, orphan classes, dangling superclasses, superclass cycles), and
|
|
720
|
+
contains no blank nodes, so it is deterministic and golden-comparable.
|
|
721
|
+
|
|
722
|
+
[source,sh]
|
|
723
|
+
----
|
|
724
|
+
$ suma export --format owl --urn urn:iso:std:iso:10303:-2:ed-2:en \
|
|
725
|
+
-o OUTPUT schemas.yaml
|
|
726
|
+
$ suma export --format owl --corpus --urn urn:iso:std:iso:10303:-2:ed-2:en \
|
|
727
|
+
-o OUTPUT schemas.yaml
|
|
728
|
+
----
|
|
729
|
+
|
|
730
|
+
=== Resolve URNs command
|
|
731
|
+
|
|
732
|
+
The `resolve` command turns URNs into static, dereferenceable artifacts: a
|
|
733
|
+
canonical JSON document (sorted keys) and an HTML page per URN, written under
|
|
734
|
+
a path derived from the URN itself. It resolves:
|
|
735
|
+
|
|
736
|
+
* `tech:` schema, declared-element, and attribute (OWL property) URNs from a schema manifest
|
|
737
|
+
* `term:` concept URNs from Glossarist concept documents
|
|
738
|
+
* the dataset URN from `register.yaml`
|
|
739
|
+
|
|
740
|
+
[source,sh]
|
|
741
|
+
----
|
|
742
|
+
$ suma resolve URN --manifest SCHEMAS_YAML [--concepts DIR] [--register register.yaml] -o OUT
|
|
743
|
+
$ suma resolve --all --manifest SCHEMAS_YAML [--concepts DIR] [--register register.yaml] -o OUT
|
|
744
|
+
----
|
|
745
|
+
|
|
746
|
+
`--all` also writes `index.html`, linking every artifact. No server is
|
|
747
|
+
required.
|
|
748
|
+
|
|
642
749
|
=== Compare schemas command
|
|
643
750
|
|
|
644
751
|
==== General
|
|
@@ -667,6 +774,10 @@ Options:
|
|
|
667
774
|
`--trial-stepmod=PATH`:: Override auto-detected trial repository root
|
|
668
775
|
`--reference-stepmod=PATH`:: Override auto-detected reference repository root
|
|
669
776
|
`--verbose`:: Enable verbose output
|
|
777
|
+
`--typed-output=PATH`:: Write a typed change manifest (lutaml-model records with classification)
|
|
778
|
+
`--[no-]changelog`:: Render a markdown changelog alongside the change manifest
|
|
779
|
+
`--[no-]impact`:: Report affected schemas and AP publications using the corpus graph
|
|
780
|
+
`--manifest=SCHEMAS_YAML`:: Schema manifest used for impact analysis
|
|
670
781
|
|
|
671
782
|
==== Typical workflow
|
|
672
783
|
|
|
@@ -1163,3 +1274,17 @@ Code-style rules enforced throughout `lib/suma/`:
|
|
|
1163
1274
|
== Copyright and license
|
|
1164
1275
|
|
|
1165
1276
|
Copyright Ribose. BSD 2-clause license.
|
|
1277
|
+
|
|
1278
|
+
== Development and benchmarks
|
|
1279
|
+
|
|
1280
|
+
The default gate is `rake` (specs, RuboCop, referential closure).
|
|
1281
|
+
|
|
1282
|
+
[source,sh]
|
|
1283
|
+
----
|
|
1284
|
+
$ rake benchmark
|
|
1285
|
+
----
|
|
1286
|
+
|
|
1287
|
+
`rake benchmark` builds a synthetic 1,000-schema corpus and asserts wall-time
|
|
1288
|
+
and peak-RSS budgets; the same benchmark runs nightly in CI. Schema export can
|
|
1289
|
+
run in parallel with `build --jobs N`, while Metanorma document compilation
|
|
1290
|
+
stays sequential and composes with staged process isolation.
|
data/lib/suma/urn_resolver.rb
CHANGED
|
@@ -53,9 +53,12 @@ module Suma
|
|
|
53
53
|
)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
# Write JSON and HTML for every artifact.
|
|
56
|
+
# Write JSON and HTML for every artifact, plus an index of the set.
|
|
57
57
|
def write(output_directory)
|
|
58
58
|
artifacts.each_key { |key| write_urn(key, output_directory) }
|
|
59
|
+
FileUtils.mkdir_p(output_directory)
|
|
60
|
+
File.write(File.join(output_directory, "index.html"),
|
|
61
|
+
index_document, encoding: "utf-8")
|
|
59
62
|
Utils.log "Wrote #{artifacts.length} URN artifacts to #{output_directory}"
|
|
60
63
|
end
|
|
61
64
|
|
|
@@ -97,11 +100,38 @@ module Suma
|
|
|
97
100
|
payload = element_payload(schema, element)
|
|
98
101
|
artifacts[compose(:tech, "#{schema.id}.#{element.id}")] = payload if
|
|
99
102
|
payload
|
|
103
|
+
add_attribute_artifacts(artifacts, schema, element)
|
|
100
104
|
end
|
|
101
105
|
end
|
|
102
106
|
artifacts
|
|
103
107
|
end
|
|
104
108
|
|
|
109
|
+
# Attribute property IRIs appear in the OWL projection as
|
|
110
|
+
# <schema>.<entity>.<attribute>; make them dereferenceable too.
|
|
111
|
+
def add_attribute_artifacts(artifacts, schema, element)
|
|
112
|
+
return unless element.is_a?(Expressir::Model::Declarations::Entity)
|
|
113
|
+
|
|
114
|
+
element.attributes.each do |attribute|
|
|
115
|
+
key = compose(:tech,
|
|
116
|
+
"#{schema.id}.#{element.id}.#{attribute.id}")
|
|
117
|
+
artifacts[key] = attribute_artifact(schema, element, attribute)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def attribute_artifact(schema, entity, attribute)
|
|
122
|
+
{
|
|
123
|
+
"urn" => compose(:tech, "#{schema.id}.#{entity.id}.#{attribute.id}"),
|
|
124
|
+
"kind" => "attribute",
|
|
125
|
+
"schema" => schema.id,
|
|
126
|
+
"entity" => entity.id,
|
|
127
|
+
"id" => attribute.id,
|
|
128
|
+
"attribute_kind" => attribute.kind,
|
|
129
|
+
"optional" => attribute.optional == true,
|
|
130
|
+
"type" => attribute.type&.source,
|
|
131
|
+
"source" => relative_source(schema),
|
|
132
|
+
}
|
|
133
|
+
end
|
|
134
|
+
|
|
105
135
|
def schemas
|
|
106
136
|
@schemas ||= begin
|
|
107
137
|
manifest = Expressir::SchemaManifest.from_file(@manifest_file)
|
|
@@ -310,6 +340,26 @@ module Suma
|
|
|
310
340
|
HTML
|
|
311
341
|
end
|
|
312
342
|
|
|
343
|
+
# A deterministic index of every resolved URN, linked to its document.
|
|
344
|
+
def index_document
|
|
345
|
+
items = artifacts.keys.sort.map do |urn|
|
|
346
|
+
href = artifact_path(urn, "html")
|
|
347
|
+
%( <li><a href="#{escape_html(href)}">#{escape_html(urn)}</a></li>)
|
|
348
|
+
end.join("\n")
|
|
349
|
+
<<~HTML
|
|
350
|
+
<!doctype html>
|
|
351
|
+
<html lang="en">
|
|
352
|
+
<head><meta charset="utf-8"><title>Resolved URNs</title></head>
|
|
353
|
+
<body>
|
|
354
|
+
<h1>Resolved URNs</h1>
|
|
355
|
+
<ul>
|
|
356
|
+
#{items}
|
|
357
|
+
</ul>
|
|
358
|
+
</body>
|
|
359
|
+
</html>
|
|
360
|
+
HTML
|
|
361
|
+
end
|
|
362
|
+
|
|
313
363
|
def escape_html(value)
|
|
314
364
|
value.gsub("&", "&").gsub("<", "<").gsub(">", ">")
|
|
315
365
|
.gsub('"', """)
|
data/lib/suma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: suma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: expressir
|