glossarist 2.14.6 → 2.14.8
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/exe/glossarist +7 -1
- data/lib/glossarist/cli/export_command.rb +5 -6
- data/lib/glossarist/cli/import_command.rb +1 -2
- data/lib/glossarist/cli/package_command.rb +1 -2
- data/lib/glossarist/cli/upgrade_command.rb +1 -2
- data/lib/glossarist/cli/validate_command.rb +4 -1
- data/lib/glossarist/concept.rb +19 -2
- data/lib/glossarist/dataset_register.rb +12 -6
- data/lib/glossarist/errors/cli_error.rb +12 -0
- data/lib/glossarist/errors.rb +1 -0
- data/lib/glossarist/localized_concept.rb +12 -2
- data/lib/glossarist/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13bd1c87738d03e366e25dbc60880fe99635a283802c4ff83a69cd3cb5e9f4d1
|
|
4
|
+
data.tar.gz: 3b8df358c448ec07470d016f81685162f766a52f53fce14a0433179fea3771c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bafbc7f728f1c9cf436a30ca0bd9b2b914cbd0ffefd8fb28cca845666d9758fb3ec485ecf2cc29ce4e207809238e503fe84f9c1e424893422174b40e9a849e3
|
|
7
|
+
data.tar.gz: 4c439063dd3bfdb0155603d919500f57366fd93ca2ede8313574fcd86724628db584cc4a28489406d16a1c86523b032f2c5721c6c88a735653dbb4469a8e6a12
|
data/exe/glossarist
CHANGED
|
@@ -45,8 +45,7 @@ module Glossarist
|
|
|
45
45
|
|
|
46
46
|
validate_outputs!(formats, output_dir, name) if validate?
|
|
47
47
|
rescue ArgumentError => e
|
|
48
|
-
|
|
49
|
-
exit 1
|
|
48
|
+
raise Errors::CliError, e.message
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
private
|
|
@@ -248,10 +247,10 @@ module Glossarist
|
|
|
248
247
|
files << File.join(output_dir, "#{name}.ttl") if File.exist?(File.join(output_dir, "#{name}.ttl"))
|
|
249
248
|
files.concat(Dir.glob(File.join(output_dir, "concepts", "*.ttl")))
|
|
250
249
|
report = validator.validate_files(files)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
return if report.conformant?
|
|
251
|
+
|
|
252
|
+
warn report.to_s
|
|
253
|
+
raise Errors::CliError, "emitted Turtle failed SHACL validation"
|
|
255
254
|
end
|
|
256
255
|
end
|
|
257
256
|
end
|
|
@@ -22,7 +22,10 @@ module Glossarist
|
|
|
22
22
|
|
|
23
23
|
$stderr.print "\r#{' ' * 60}\r" if text_output
|
|
24
24
|
report(result)
|
|
25
|
-
|
|
25
|
+
return if result.errors.empty? && !strict_failure?(result)
|
|
26
|
+
|
|
27
|
+
raise Errors::CliError,
|
|
28
|
+
"dataset invalid: #{result.errors.size} error(s)"
|
|
26
29
|
end
|
|
27
30
|
|
|
28
31
|
private
|
data/lib/glossarist/concept.rb
CHANGED
|
@@ -22,11 +22,27 @@ module Glossarist
|
|
|
22
22
|
|
|
23
23
|
map %i[date_accepted dateAccepted],
|
|
24
24
|
with: { from: :date_accepted_from_yaml, to: :date_accepted_to_yaml }
|
|
25
|
-
|
|
26
|
-
map
|
|
25
|
+
# The concept's UUID serializes to the YAML "id" key (uuid_to_yaml),
|
|
26
|
+
# so reading must map "id" back to #uuid — not just #id — or a
|
|
27
|
+
# round-tripped document lazily derives a different, content-based
|
|
28
|
+
# UUID (#247). ManagedConcept already maps both keys this way.
|
|
29
|
+
map %i[id uuid], to: :uuid, with: { to: :uuid_to_yaml, from: :uuid_from_yaml }
|
|
27
30
|
map :identifier, to: :id, with: { to: :id_to_yaml, from: :id_from_yaml }
|
|
28
31
|
end
|
|
29
32
|
|
|
33
|
+
def self.of_yaml(hash, options = {})
|
|
34
|
+
if hash.is_a?(Hash)
|
|
35
|
+
extensions = hash.select do |key, _value|
|
|
36
|
+
Config.extension_attributes.include?(key.to_s)
|
|
37
|
+
end
|
|
38
|
+
unless extensions.empty?
|
|
39
|
+
existing = hash["extension_attributes"] || hash["extensionAttributes"] || {}
|
|
40
|
+
hash = hash.merge("extension_attributes" => existing.merge(extensions))
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
super
|
|
44
|
+
end
|
|
45
|
+
|
|
30
46
|
def designations
|
|
31
47
|
data.terms
|
|
32
48
|
end
|
|
@@ -75,6 +91,7 @@ module Glossarist
|
|
|
75
91
|
|
|
76
92
|
def uuid_from_yaml(model, value)
|
|
77
93
|
model.uuid = value
|
|
94
|
+
model.id = value
|
|
78
95
|
end
|
|
79
96
|
|
|
80
97
|
def id_to_yaml(model, doc); end
|
|
@@ -136,16 +136,22 @@ module Glossarist
|
|
|
136
136
|
concept_id = concept.is_a?(ManagedConcept) ? concept.data&.id : nil
|
|
137
137
|
return [] unless concept_id
|
|
138
138
|
|
|
139
|
-
all_section_ids
|
|
140
|
-
|
|
139
|
+
all_section_ids
|
|
140
|
+
.select { |sid| concept_id.start_with?("#{sid}-", "#{sid}.") }
|
|
141
141
|
.max_by(&:length)
|
|
142
142
|
&.then { |sid| [sid] } || []
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
# One flattened section-id list, computed once: derivation runs per
|
|
146
|
+
# concept without explicit section domains, and re-walking the whole
|
|
147
|
+
# section tree per concept is quadratic on large registers (ISO
|
|
148
|
+
# 10303-2: 7,363 concepts x 1,240 sections).
|
|
149
|
+
def all_section_ids
|
|
150
|
+
@all_section_ids ||= begin
|
|
151
|
+
ids = []
|
|
152
|
+
walk_section_tree(sections, []) { |section, _| ids << section.id }
|
|
153
|
+
ids
|
|
154
|
+
end
|
|
149
155
|
end
|
|
150
156
|
end
|
|
151
157
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Glossarist
|
|
4
|
+
module Errors
|
|
5
|
+
# Raised by CLI command classes on invalid usage or failed runs.
|
|
6
|
+
# Library classes stay exception-only; exe/glossarist owns the
|
|
7
|
+
# process exit code. Calling exit from a command class would kill
|
|
8
|
+
# any host process exercising it in-process (glossarist-ruby#248).
|
|
9
|
+
class CliError < Base
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/glossarist/errors.rb
CHANGED
|
@@ -5,6 +5,8 @@ module Glossarist
|
|
|
5
5
|
attribute :entry_status, :string
|
|
6
6
|
|
|
7
7
|
key_value do
|
|
8
|
+
map :status, to: :entry_status,
|
|
9
|
+
with: { from: :status_from_yaml, to: :status_to_yaml }
|
|
8
10
|
map :classification, to: :classification
|
|
9
11
|
map %i[review_type reviewType], to: :review_type
|
|
10
12
|
end
|
|
@@ -20,8 +22,6 @@ module Glossarist
|
|
|
20
22
|
super
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
alias_method :status=, :entry_status=
|
|
24
|
-
|
|
25
25
|
def language_code
|
|
26
26
|
data.language_code
|
|
27
27
|
end
|
|
@@ -38,6 +38,16 @@ module Glossarist
|
|
|
38
38
|
data.entry_status = value
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
alias_method :status=, :entry_status=
|
|
42
|
+
|
|
43
|
+
# Legacy top-level `status` is read only: it fills entry_status when
|
|
44
|
+
# data.entry_status is absent, and is never written back out.
|
|
45
|
+
def status_from_yaml(model, value)
|
|
46
|
+
model.entry_status ||= value
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def status_to_yaml(_model, _doc); end
|
|
50
|
+
|
|
41
51
|
def all_sources
|
|
42
52
|
data.all_sources
|
|
43
53
|
end
|
data/lib/glossarist/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glossarist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.14.
|
|
4
|
+
version: 2.14.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
@@ -259,6 +259,7 @@ files:
|
|
|
259
259
|
- lib/glossarist/errors.rb
|
|
260
260
|
- lib/glossarist/errors/base.rb
|
|
261
261
|
- lib/glossarist/errors/cache_version_mismatch_error.rb
|
|
262
|
+
- lib/glossarist/errors/cli_error.rb
|
|
262
263
|
- lib/glossarist/errors/invalid_language_code_error.rb
|
|
263
264
|
- lib/glossarist/errors/invalid_type_error.rb
|
|
264
265
|
- lib/glossarist/errors/load_error.rb
|