glossarist 2.8.16 → 2.8.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dff1f025f20e6cfad5028acb99816984ddef4cd4a231991345a633c42ae5794
4
- data.tar.gz: 7eed6c0df552c7206225460f212500fac6e4c7f3bc47d04bf75bb11acd53af7d
3
+ metadata.gz: 329df9970677060f9f81cac4f093d384da792884955b4ee26335339a6df0d36f
4
+ data.tar.gz: 1b94ff574c689ecd72123cb7d879b69bfca401f027dfece4c4ade72ca02b9a4a
5
5
  SHA512:
6
- metadata.gz: 01bda07bdfcff32b5526b33e19bd38074f0eeeab585bdf739593c95f9edacdd85cff549ce7430b53a027b18b1cd011a99a33454f71fdb2163c57be6bb1a1affb
7
- data.tar.gz: f9e036c52fa7fa63dab55c8623bd47bc46af544d1fa3660368c8f41ef9c9155373ca92ac91116c8f8d7ff18b1ca9e093fde4f6e25ce0ca7b8194c9724b2df75d
6
+ metadata.gz: f4edbf8bf5b20ca8054e3f1fb678b60b19ead2dd0585d2c71b8bafd648b0553b8c917a918f4be97be2bbb535611504d73a5b98c9383a278938a18dee74942c88
7
+ data.tar.gz: 3d83adb27ae450854727c7345dd6d2219ea9abc3449fcb092321093fc0a42aaf709e59c85607dff8c1e36e8c2483bbcfefb48c21cb3673574509c9f108703eec
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-06-13 04:17:12 UTC using RuboCop version 1.86.1.
3
+ # on 2026-07-02 16:08:41 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -11,101 +11,13 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'glossarist.gemspec'
13
13
 
14
- # Offense count: 7
15
- # This cop supports safe autocorrection (--autocorrect).
16
- # Configuration parameters: EnforcedStyle, IndentationWidth.
17
- # SupportedStyles: with_first_argument, with_fixed_indentation
18
- Layout/ArgumentAlignment:
19
- Exclude:
20
- - 'lib/glossarist/errors.rb'
21
- - 'lib/glossarist/reference_resolver.rb'
22
- - 'lib/glossarist/schema_migration/v0_to_v1.rb'
23
- - 'lib/glossarist/schema_migration/v2_to_v3.rb'
24
- - 'spec/unit/reference_resolver_spec.rb'
25
-
26
- # Offense count: 1
27
- # This cop supports safe autocorrection (--autocorrect).
28
- # Configuration parameters: IndentationWidth.
29
- Layout/AssignmentIndentation:
30
- Exclude:
31
- - 'lib/glossarist/schema_migration/v0_to_v1.rb'
32
-
33
- # Offense count: 1
34
- # This cop supports safe autocorrection (--autocorrect).
35
- # Configuration parameters: EnforcedStyleAlignWith.
36
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
37
- Layout/BlockAlignment:
38
- Exclude:
39
- - 'lib/glossarist/sts/importer.rb'
40
-
41
- # Offense count: 1
42
- # This cop supports safe autocorrection (--autocorrect).
43
- Layout/BlockEndNewline:
44
- Exclude:
45
- - 'lib/glossarist/sts/importer.rb'
46
-
47
- # Offense count: 1
48
- # This cop supports safe autocorrection (--autocorrect).
49
- Layout/ClosingParenthesisIndentation:
50
- Exclude:
51
- - 'spec/unit/concept_source_spec.rb'
52
-
53
- # Offense count: 1
54
- # This cop supports safe autocorrection (--autocorrect).
55
- # Configuration parameters: EnforcedStyle, IndentationWidth.
56
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
57
- Layout/FirstArgumentIndentation:
58
- Exclude:
59
- - 'spec/unit/concept_source_spec.rb'
60
-
61
- # Offense count: 3
62
- # This cop supports safe autocorrection (--autocorrect).
63
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
64
- # SupportedHashRocketStyles: key, separator, table
65
- # SupportedColonStyles: key, separator, table
66
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
67
- Layout/HashAlignment:
68
- Exclude:
69
- - 'lib/glossarist/managed_concept.rb'
70
- - 'lib/glossarist/schema_migration/v0_to_v1.rb'
71
- - 'spec/unit/validation/rules/cite_ref_integrity_rule_spec.rb'
72
-
73
- # Offense count: 2
74
- # This cop supports safe autocorrection (--autocorrect).
75
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
76
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
77
- Layout/IndentationWidth:
78
- Exclude:
79
- - 'lib/glossarist/sts/importer.rb'
80
-
81
- # Offense count: 449
14
+ # Offense count: 469
82
15
  # This cop supports safe autocorrection (--autocorrect).
83
16
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
84
17
  # URISchemes: http, https
85
18
  Layout/LineLength:
86
19
  Enabled: false
87
20
 
88
- # Offense count: 1
89
- # This cop supports safe autocorrection (--autocorrect).
90
- # Configuration parameters: EnforcedStyle.
91
- # SupportedStyles: symmetrical, new_line, same_line
92
- Layout/MultilineMethodCallBraceLayout:
93
- Exclude:
94
- - 'spec/unit/concept_source_spec.rb'
95
-
96
- # Offense count: 11
97
- # This cop supports safe autocorrection (--autocorrect).
98
- # Configuration parameters: AllowInHeredoc.
99
- Layout/TrailingWhitespace:
100
- Exclude:
101
- - 'lib/glossarist/errors.rb'
102
- - 'lib/glossarist/managed_concept.rb'
103
- - 'lib/glossarist/reference_resolver.rb'
104
- - 'lib/glossarist/schema_migration/v0_to_v1.rb'
105
- - 'lib/glossarist/schema_migration/v2_to_v3.rb'
106
- - 'spec/unit/reference_resolver_spec.rb'
107
- - 'spec/unit/validation/rules/cite_ref_integrity_rule_spec.rb'
108
-
109
21
  # Offense count: 1
110
22
  # Configuration parameters: AllowedMethods.
111
23
  # AllowedMethods: enums
@@ -132,7 +44,7 @@ Lint/UselessConstantScoping:
132
44
  Exclude:
133
45
  - 'lib/glossarist/sts/term_extractor.rb'
134
46
 
135
- # Offense count: 89
47
+ # Offense count: 91
136
48
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
137
49
  Metrics/AbcSize:
138
50
  Enabled: false
@@ -143,12 +55,12 @@ Metrics/AbcSize:
143
55
  Metrics/BlockLength:
144
56
  Max: 41
145
57
 
146
- # Offense count: 58
58
+ # Offense count: 59
147
59
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
148
60
  Metrics/CyclomaticComplexity:
149
61
  Enabled: false
150
62
 
151
- # Offense count: 109
63
+ # Offense count: 108
152
64
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
153
65
  Metrics/MethodLength:
154
66
  Max: 47
@@ -163,17 +75,6 @@ Metrics/ParameterLists:
163
75
  Metrics/PerceivedComplexity:
164
76
  Enabled: false
165
77
 
166
- # Offense count: 1
167
- # This cop supports safe autocorrection (--autocorrect).
168
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
169
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
170
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
171
- # FunctionalMethods: let, let!, subject, watch
172
- # AllowedMethods: lambda, proc, it
173
- Style/BlockDelimiters:
174
- Exclude:
175
- - 'lib/glossarist/sts/importer.rb'
176
-
177
78
  # Offense count: 6
178
79
  # This cop supports safe autocorrection (--autocorrect).
179
80
  # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
@@ -187,18 +88,6 @@ Style/IdenticalConditionalBranches:
187
88
  Exclude:
188
89
  - 'scripts/migrate_dataset.rb'
189
90
 
190
- # Offense count: 1
191
- # This cop supports safe autocorrection (--autocorrect).
192
- Style/MultilineIfModifier:
193
- Exclude:
194
- - 'lib/glossarist/schema_migration/v0_to_v1.rb'
195
-
196
- # Offense count: 2
197
- # This cop supports safe autocorrection (--autocorrect).
198
- Style/RedundantRegexpCharacterClass:
199
- Exclude:
200
- - 'lib/glossarist/sts/term_extractor.rb'
201
-
202
91
  # Offense count: 3
203
92
  # Configuration parameters: Max.
204
93
  Style/SafeNavigationChainLength:
@@ -206,11 +95,3 @@ Style/SafeNavigationChainLength:
206
95
  - 'lib/glossarist/managed_concept.rb'
207
96
  - 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
208
97
  - 'lib/glossarist/validation/rules/source_urn_format_rule.rb'
209
-
210
- # Offense count: 1
211
- # This cop supports safe autocorrection (--autocorrect).
212
- # Configuration parameters: EnforcedStyleForMultiline.
213
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
214
- Style/TrailingCommaInArguments:
215
- Exclude:
216
- - 'spec/unit/concept_source_spec.rb'
@@ -84,9 +84,9 @@ module Glossarist
84
84
  end
85
85
 
86
86
  def date_accepted_to_yaml(model, doc)
87
- if model.date_accepted
88
- doc["date_accepted"] = model.date_accepted.date.iso8601
89
- end
87
+ return unless model.date_accepted
88
+
89
+ doc["date_accepted"] = model.date_accepted.to_yaml_date
90
90
  end
91
91
 
92
92
  def date_accepted_from_yaml(model, value)
@@ -96,10 +96,6 @@ module Glossarist
96
96
  model.data.dates << ConceptDate.of_yaml(
97
97
  { "date" => value, "type" => "accepted" },
98
98
  )
99
-
100
- model.date_accepted = model.data.dates.find do |d|
101
- d.type == "accepted"
102
- end
103
99
  end
104
100
 
105
101
  def uuid
@@ -86,7 +86,7 @@ module Glossarist
86
86
  def all_sources
87
87
  list = sources.to_a
88
88
  self.class.detailed_definition_fields.each do |field|
89
- public_send(field).each { |d| list.concat(d.sources.to_a) }
89
+ public_send(field).each { |d| list.concat(d.all_sources) }
90
90
  end
91
91
  Array(terms).each { |t| list.concat(Array(t.sources)) }
92
92
  list
@@ -95,7 +95,7 @@ module Glossarist
95
95
  def text_content
96
96
  texts = []
97
97
  self.class.detailed_definition_fields.each do |field|
98
- public_send(field).each { |d| texts << d.content if d.content }
98
+ public_send(field).each { |d| texts.concat(d.text_content) }
99
99
  end
100
100
  texts
101
101
  end
@@ -12,5 +12,12 @@ module Glossarist
12
12
  map :date, to: :date
13
13
  map :type, to: :type
14
14
  end
15
+
16
+ # Returns the date as a string for flat YAML fields such as
17
+ # ManagedConcept#date_accepted. Subclasses whose `date` is not a
18
+ # DateTime override this so callers do not need to type-check.
19
+ def to_yaml_date
20
+ date&.iso8601
21
+ end
15
22
  end
16
23
  end
@@ -4,10 +4,26 @@ module Glossarist
4
4
  class DetailedDefinition < Lutaml::Model::Serializable
5
5
  attribute :content, :string
6
6
  attribute :sources, ConceptSource, collection: true
7
+ attribute :examples, DetailedDefinition, collection: true,
8
+ initialize_empty: true
7
9
 
8
10
  key_value do
9
11
  map :content, to: :content
10
12
  map :sources, to: :sources
13
+ map :examples, to: :examples
14
+ end
15
+
16
+ def all_sources
17
+ list = sources.to_a
18
+ examples.each { |example| list.concat(example.all_sources) }
19
+ list
20
+ end
21
+
22
+ def text_content
23
+ texts = []
24
+ texts << content if content
25
+ examples.each { |example| texts.concat(example.text_content) }
26
+ texts
11
27
  end
12
28
  end
13
29
  end
@@ -63,9 +63,9 @@ module Glossarist
63
63
  end
64
64
 
65
65
  def date_accepted_to_yaml(model, doc)
66
- if model.date_accepted
67
- doc["date_accepted"] = model.date_accepted.date.iso8601
68
- end
66
+ return unless model.date_accepted
67
+
68
+ doc["date_accepted"] = model.date_accepted.to_yaml_date
69
69
  end
70
70
 
71
71
  def uuid_to_yaml(model, doc)
@@ -7,6 +7,7 @@ module Glossarist
7
7
  class GlossDetailedDefinition < Lutaml::Model::Serializable
8
8
  attribute :content, :string
9
9
  attribute :sources, GlossConceptSource, collection: true
10
+ attribute :examples, GlossDetailedDefinition, collection: true
10
11
 
11
12
  rdf do
12
13
  namespace Namespaces::GlossaristNamespace, Namespaces::RdfNamespace
@@ -18,6 +19,7 @@ module Glossarist
18
19
  predicate :value, namespace: Namespaces::RdfNamespace, to: :content
19
20
 
20
21
  members :sources
22
+ members :examples, link: "gloss:hasExample"
21
23
  end
22
24
  end
23
25
  end
@@ -232,6 +232,7 @@ module Glossarist
232
232
  Rdf::GlossDetailedDefinition.new(
233
233
  content: dd.content,
234
234
  sources: build_gloss_sources(dd.sources),
235
+ examples: build_gloss_definitions(dd.examples),
235
236
  )
236
237
  end
237
238
  end
@@ -4,10 +4,13 @@ module Glossarist
4
4
  module V2
5
5
  class DetailedDefinition < Glossarist::DetailedDefinition
6
6
  attribute :sources, V2::ConceptSource, collection: true
7
+ attribute :examples, V2::DetailedDefinition, collection: true,
8
+ initialize_empty: true
7
9
 
8
10
  key_value do
9
11
  map :content, to: :content
10
12
  map :sources, to: :sources
13
+ map :examples, to: :examples
11
14
  end
12
15
  end
13
16
  end
@@ -6,6 +6,7 @@ module Glossarist
6
6
  attribute :sources, V3::ConceptSource,
7
7
  collection: Collections::ConceptSourceCollection,
8
8
  initialize_empty: true
9
+ attribute :dates, V3::ConceptDate, collection: true
9
10
  attribute :definition, V3::DetailedDefinition,
10
11
  collection: Collections::DetailedDefinitionCollection,
11
12
  initialize_empty: true
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module V3
5
+ # V3 variant of ConceptDate. The base {Glossarist::ConceptDate} types
6
+ # `date` as `:date_time` (ISO 8601 datetime only), but the v3 schema
7
+ # (`concept-model/schemas/v3/concept.yaml`) declares
8
+ #
9
+ # concept_date:
10
+ # properties:
11
+ # date:
12
+ # type: string
13
+ # format: date
14
+ #
15
+ # which accepts any date string — full ISO 8601 datetime ("2023-01-01T00:00:00+00:00"),
16
+ # calendar date ("2023-01-01"), or year-only ("2023"). Datasets such as
17
+ # the IALA Dictionary (datasets/iala-*/concepts/*.yaml) use year-only
18
+ # strings for accepted/retired lifecycle markers, so the v3 model needs
19
+ # to round-trip those without losing the value.
20
+ #
21
+ # See BUG_REPORT.md for the full investigation.
22
+ class ConceptDate < Glossarist::ConceptDate
23
+ attribute :date, :string
24
+
25
+ key_value do
26
+ map :date, to: :date
27
+ map :type, to: :type
28
+ end
29
+
30
+ # The `date` is already a free-form string in V3, so the wire form
31
+ # is the value itself — no iso8601 coercion.
32
+ def to_yaml_date
33
+ date
34
+ end
35
+ end
36
+ end
37
+ end
@@ -4,10 +4,13 @@ module Glossarist
4
4
  module V3
5
5
  class DetailedDefinition < Glossarist::DetailedDefinition
6
6
  attribute :sources, V3::ConceptSource, collection: true
7
+ attribute :examples, V3::DetailedDefinition, collection: true,
8
+ initialize_empty: true
7
9
 
8
10
  key_value do
9
11
  map :content, to: :content
10
12
  map :sources, to: :sources
13
+ map :examples, to: :examples
11
14
  end
12
15
  end
13
16
  end
@@ -4,6 +4,15 @@ module Glossarist
4
4
  module V3
5
5
  class LocalizedConcept < Glossarist::LocalizedConcept
6
6
  attribute :data, V3::ConceptData, default: -> { V3::ConceptData.new }
7
+
8
+ def date_accepted_from_yaml(model, value)
9
+ return if model.date_accepted
10
+
11
+ model.data.dates ||= []
12
+ model.data.dates << V3::ConceptDate.of_yaml(
13
+ { "date" => value, "type" => "accepted" },
14
+ )
15
+ end
7
16
  end
8
17
  end
9
18
  end
@@ -5,6 +5,8 @@ module Glossarist
5
5
  class ManagedConcept < Glossarist::ManagedConcept
6
6
  attribute :data, V3::ManagedConceptData, default: -> { V3::ManagedConceptData.new }
7
7
  attribute :related, V3::RelatedConcept, collection: true
8
+ attribute :dates, V3::ConceptDate, collection: true
9
+ attribute :date_accepted, V3::ConceptDate
8
10
  attribute :sources, V3::ConceptSource, collection: true
9
11
 
10
12
  key_value do
@@ -19,6 +21,12 @@ module Glossarist
19
21
  map :schema_version, to: :schema_version
20
22
  map :sources, to: :sources
21
23
  end
24
+
25
+ def date_accepted_from_yaml(model, value)
26
+ model.date_accepted = V3::ConceptDate.of_yaml(
27
+ { "date" => value, "type" => "accepted" },
28
+ )
29
+ end
22
30
  end
23
31
  end
24
32
  end
data/lib/glossarist/v3.rb CHANGED
@@ -4,6 +4,7 @@ module Glossarist
4
4
  module V3
5
5
  autoload :Configuration, "glossarist/v3/configuration"
6
6
  autoload :Citation, "glossarist/v3/citation"
7
+ autoload :ConceptDate, "glossarist/v3/concept_date"
7
8
  autoload :ConceptSource, "glossarist/v3/concept_source"
8
9
  autoload :DetailedDefinition, "glossarist/v3/detailed_definition"
9
10
  autoload :ConceptRef, "glossarist/v3/concept_ref"
@@ -15,6 +16,7 @@ module Glossarist
15
16
  autoload :ConceptDocument, "glossarist/v3/concept_document"
16
17
 
17
18
  Configuration.register_model(Citation, id: :citation)
19
+ Configuration.register_model(ConceptDate, id: :concept_date)
18
20
  Configuration.register_model(ConceptSource, id: :concept_source)
19
21
  Configuration.register_model(DetailedDefinition, id: :detailed_definition)
20
22
  Configuration.register_model(ConceptData, id: :concept_data)
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.8.16"
7
+ VERSION = "2.8.18"
8
8
  end
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.8.16
4
+ version: 2.8.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-18 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -339,6 +339,7 @@ files:
339
339
  - lib/glossarist/v3.rb
340
340
  - lib/glossarist/v3/citation.rb
341
341
  - lib/glossarist/v3/concept_data.rb
342
+ - lib/glossarist/v3/concept_date.rb
342
343
  - lib/glossarist/v3/concept_document.rb
343
344
  - lib/glossarist/v3/concept_ref.rb
344
345
  - lib/glossarist/v3/concept_source.rb