glossarist 2.8.5 → 2.8.6

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: bb636339e439da216185715fcfe387842aabd1b38147dd49b5e4fdb5909b6d2d
4
- data.tar.gz: 2704b81c1f4d179d8909bc1d245b9caee83d2e54fa56a6148699892f021e9d6f
3
+ metadata.gz: ac9ce2a15558722dfa456e5fd7a02c288fafecfe67da68e75608318580469bef
4
+ data.tar.gz: bdc3ca2aacf91db0a77e341cb8ff114a83b7e897b79b96ba6bcef42dab678689
5
5
  SHA512:
6
- metadata.gz: 5e39df7a02295426fb6463f93189cf6e3d457e60457b9bb5cde1881eeb549fe1afd4730e3ac280030be8de60734dbc2e0532b14030890e107b9df35dabbd1ede
7
- data.tar.gz: 5e4ef4cf71118c020f29b105bb81bb19d753dcb9484f367d0a2caab0b51927e7bcf69e325549bb4e7f44f9f1ec571ffb4223710ca8cc7987dd10eb4750148514
6
+ metadata.gz: e1e026ac1b3daf5f3ed111a69198fea632f698767495d21612743f0161cd41e75466de670322178357e475aa60d1b56b994391ff02efa40953b640265b5f4bac
7
+ data.tar.gz: f01e0d1928cd86531326b86c4e150814a080b2bf2536cd3804bce4e7c5e9c484dd88cc561ac20526faf73b5b964b25d3b45c72fbb5160b042a1f98bc85b08e29
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-04 14:04:56 UTC using RuboCop version 1.86.1.
3
+ # on 2026-06-08 08:10:16 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,68 +11,22 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'glossarist.gemspec'
13
13
 
14
- # Offense count: 6
14
+ # Offense count: 1
15
15
  # This cop supports safe autocorrection (--autocorrect).
16
16
  # Configuration parameters: EnforcedStyle, IndentationWidth.
17
17
  # SupportedStyles: with_first_argument, with_fixed_indentation
18
18
  Layout/ArgumentAlignment:
19
19
  Exclude:
20
- - 'spec/unit/section_spec.rb'
21
-
22
- # Offense count: 3
23
- # This cop supports safe autocorrection (--autocorrect).
24
- # Configuration parameters: EnforcedStyleAlignWith.
25
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
26
- Layout/BlockAlignment:
27
- Exclude:
28
- - 'spec/unit/section_spec.rb'
29
-
30
- # Offense count: 3
31
- # This cop supports safe autocorrection (--autocorrect).
32
- Layout/BlockEndNewline:
33
- Exclude:
34
- - 'spec/unit/section_spec.rb'
20
+ - 'lib/glossarist/designation.rb'
35
21
 
36
22
  # Offense count: 1
37
23
  # This cop supports safe autocorrection (--autocorrect).
38
- Layout/EmptyLineAfterGuardClause:
24
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
25
+ Layout/ExtraSpacing:
39
26
  Exclude:
40
- - 'lib/glossarist/section.rb'
27
+ - 'lib/glossarist/designation.rb'
41
28
 
42
- # Offense count: 1
43
- # This cop supports safe autocorrection (--autocorrect).
44
- Layout/EmptyLines:
45
- Exclude:
46
- - 'Gemfile'
47
-
48
- # Offense count: 2
49
- # This cop supports safe autocorrection (--autocorrect).
50
- # Configuration parameters: EnforcedStyle, IndentationWidth.
51
- # SupportedStyles: special_inside_parentheses, consistent, align_braces
52
- Layout/FirstHashElementIndentation:
53
- Exclude:
54
- - 'spec/unit/section_spec.rb'
55
-
56
- # Offense count: 8
57
- # This cop supports safe autocorrection (--autocorrect).
58
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
59
- # SupportedHashRocketStyles: key, separator, table
60
- # SupportedColonStyles: key, separator, table
61
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
62
- Layout/HashAlignment:
63
- Exclude:
64
- - 'spec/unit/dataset_register_spec.rb'
65
- - 'spec/unit/section_spec.rb'
66
-
67
- # Offense count: 6
68
- # This cop supports safe autocorrection (--autocorrect).
69
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
70
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
71
- Layout/IndentationWidth:
72
- Exclude:
73
- - 'spec/unit/section_spec.rb'
74
-
75
- # Offense count: 424
29
+ # Offense count: 420
76
30
  # This cop supports safe autocorrection (--autocorrect).
77
31
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
78
32
  # URISchemes: http, https
@@ -81,19 +35,10 @@ Layout/LineLength:
81
35
 
82
36
  # Offense count: 1
83
37
  # This cop supports safe autocorrection (--autocorrect).
84
- # Configuration parameters: EnforcedStyle.
85
- # SupportedStyles: symmetrical, new_line, same_line
86
- Layout/MultilineHashBraceLayout:
87
- Exclude:
88
- - 'spec/unit/section_spec.rb'
89
-
90
- # Offense count: 7
91
- # This cop supports safe autocorrection (--autocorrect).
92
38
  # Configuration parameters: AllowInHeredoc.
93
39
  Layout/TrailingWhitespace:
94
40
  Exclude:
95
- - 'spec/unit/dataset_register_spec.rb'
96
- - 'spec/unit/section_spec.rb'
41
+ - 'lib/glossarist/designation.rb'
97
42
 
98
43
  # Offense count: 1
99
44
  # Configuration parameters: AllowedMethods.
@@ -116,12 +61,12 @@ Lint/UnusedMethodArgument:
116
61
  Exclude:
117
62
  - 'lib/glossarist/dataset_validator.rb'
118
63
 
119
- # Offense count: 85
64
+ # Offense count: 84
120
65
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
121
66
  Metrics/AbcSize:
122
67
  Enabled: false
123
68
 
124
- # Offense count: 7
69
+ # Offense count: 8
125
70
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
126
71
  # AllowedMethods: refine
127
72
  Metrics/BlockLength:
@@ -142,7 +87,7 @@ Metrics/MethodLength:
142
87
  Metrics/ParameterLists:
143
88
  Max: 6
144
89
 
145
- # Offense count: 38
90
+ # Offense count: 39
146
91
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
147
92
  Metrics/PerceivedComplexity:
148
93
  Enabled: false
@@ -154,17 +99,6 @@ Naming/MethodParameterName:
154
99
  Exclude:
155
100
  - 'lib/glossarist/schema_migration.rb'
156
101
 
157
- # Offense count: 5
158
- # This cop supports safe autocorrection (--autocorrect).
159
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
160
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
161
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
162
- # FunctionalMethods: let, let!, subject, watch
163
- # AllowedMethods: lambda, proc, it
164
- Style/BlockDelimiters:
165
- Exclude:
166
- - 'spec/unit/section_spec.rb'
167
-
168
102
  # Offense count: 6
169
103
  # This cop supports safe autocorrection (--autocorrect).
170
104
  # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
@@ -178,6 +112,12 @@ Style/IdenticalConditionalBranches:
178
112
  Exclude:
179
113
  - 'scripts/migrate_dataset.rb'
180
114
 
115
+ # Offense count: 1
116
+ # This cop supports unsafe autocorrection (--autocorrect-all).
117
+ Style/ReduceToHash:
118
+ Exclude:
119
+ - 'lib/glossarist/transforms/concept_to_gloss_transform.rb'
120
+
181
121
  # Offense count: 3
182
122
  # Configuration parameters: Max.
183
123
  Style/SafeNavigationChainLength:
@@ -67,6 +67,10 @@ module Glossarist
67
67
  doc["terms"] = model.terms&.map(&:to_yaml_hash)
68
68
  end
69
69
 
70
+ def self.detailed_definition_fields
71
+ %i[definition notes examples]
72
+ end
73
+
70
74
  def date_accepted
71
75
  return nil unless dates
72
76
 
@@ -81,17 +85,17 @@ module Glossarist
81
85
 
82
86
  def all_sources
83
87
  list = sources.to_a
84
- definition.each { |d| list.concat(d.sources.to_a) }
85
- notes.each { |n| list.concat(n.sources.to_a) }
86
- examples.each { |e| list.concat(e.sources.to_a) }
88
+ self.class.detailed_definition_fields.each do |field|
89
+ send(field).each { |d| list.concat(d.sources.to_a) }
90
+ end
87
91
  list
88
92
  end
89
93
 
90
94
  def text_content
91
95
  texts = []
92
- definition.each { |d| texts << d.content if d.content }
93
- notes.each { |n| texts << n.content if n.content }
94
- examples.each { |e| texts << e.content if e.content }
96
+ self.class.detailed_definition_fields.each do |field|
97
+ send(field).each { |d| texts << d.content if d.content }
98
+ end
95
99
  texts
96
100
  end
97
101
  end
@@ -4,10 +4,12 @@ module Glossarist
4
4
  class ConceptRef < Lutaml::Model::Serializable
5
5
  attribute :source, :string
6
6
  attribute :id, :string
7
+ attribute :text, :string
7
8
 
8
9
  key_value do
9
10
  map :source, to: :source
10
11
  map :id, to: :id
12
+ map :text, to: :text
11
13
  end
12
14
  end
13
15
  end
@@ -14,7 +14,7 @@ module Glossarist
14
14
  attribute :pronunciation, Pronunciation, collection: true
15
15
  attribute :sources, ConceptSource, collection: true
16
16
  attribute :term_type, :string
17
- attribute :related, RelatedConcept, collection: true
17
+ attribute :related, DesignationRelationship, collection: true
18
18
 
19
19
  key_value do
20
20
  map :type, to: :type
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Designation
5
+ class DesignationRelationship < Lutaml::Model::Serializable
6
+ attribute :content, :string
7
+ attribute :type, :string,
8
+ values: Glossarist::GlossaryDefinition::DESIGNATION_RELATIONSHIP_TYPES
9
+ attribute :target, :string
10
+
11
+ key_value do
12
+ map :content, to: :content
13
+ map :type, to: :type
14
+ map :target, to: :target
15
+ end
16
+ end
17
+ end
18
+ end
@@ -2,7 +2,9 @@
2
2
 
3
3
  module Glossarist
4
4
  module Designation
5
- autoload :Base, "glossarist/designation/base"
5
+ autoload :Base, "glossarist/designation/base"
6
+ autoload :DesignationRelationship,
7
+ "glossarist/designation/designation_relationship"
6
8
  autoload :Expression, "glossarist/designation/expression"
7
9
  autoload :Abbreviation, "glossarist/designation/abbreviation"
8
10
  autoload :GrammarInfo, "glossarist/designation/grammar_info"
@@ -26,10 +26,19 @@ module Glossarist
26
26
  dsl.members :pronunciations, link: "gloss:hasPronunciation"
27
27
  dsl.members :sources
28
28
 
29
- RelationshipPredicates::DESIGNATION_REL_PREDICATES.each do |type, (ns, name)|
30
- dsl.predicate name, namespace: ns, to: :"#{type}_targets",
29
+ # Concept-level lexical relationships mapped to designation RDF predicates (URI refs)
30
+ {
31
+ homograph: RelationshipPredicates::DESIGNATION_REL_PREDICATES[:homograph],
32
+ false_friend: RelationshipPredicates::DESIGNATION_REL_PREDICATES[:false_friend],
33
+ }.each do |_type, (ns, name)|
34
+ dsl.predicate name, namespace: ns, to: :"#{_type}_targets",
31
35
  uri_reference: true
32
36
  end
37
+
38
+ # Designation-level relationships (literal target text)
39
+ RelationshipPredicates::DESIGNATION_ONLY_PREDICATES.each do |_type, (ns, name)|
40
+ dsl.predicate name, namespace: ns, to: :"#{_type}_targets"
41
+ end
33
42
  }.freeze
34
43
 
35
44
  DESIGNATION_NAMESPACES = [
@@ -17,6 +17,7 @@ module Glossarist
17
17
  attribute :definitions, GlossDetailedDefinition, collection: true
18
18
  attribute :notes, GlossDetailedDefinition, collection: true
19
19
  attribute :examples, GlossDetailedDefinition, collection: true
20
+ attribute :annotations, GlossDetailedDefinition, collection: true
20
21
  attribute :sources, GlossConceptSource, collection: true
21
22
  attribute :non_verb_reps, GlossNonVerbalRep, collection: true
22
23
 
@@ -55,6 +56,8 @@ module Glossarist
55
56
  link: "gloss:hasNote"
56
57
  members :examples,
57
58
  link: "gloss:hasExample"
59
+ members :annotations,
60
+ link: "gloss:hasAnnotation"
58
61
  members :sources,
59
62
  link: "gloss:hasSource"
60
63
  members :non_verb_reps,
@@ -53,6 +53,10 @@ module Glossarist
53
53
 
54
54
  ALL_REL_PREDICATES = CONCEPT_REL_PREDICATES.merge(DESIGNATION_REL_PREDICATES).freeze
55
55
 
56
+ DESIGNATION_ONLY_PREDICATES = DESIGNATION_REL_PREDICATES.slice(
57
+ :abbreviated_form_for, :short_form_for
58
+ ).freeze
59
+
56
60
  def self.related_targets_by_type(related_concepts, predicate_map)
57
61
  targets = group_targets(related_concepts, predicate_map)
58
62
  predicate_map.each_key.to_h do |type|
@@ -60,6 +64,19 @@ module Glossarist
60
64
  end
61
65
  end
62
66
 
67
+ def self.designation_targets_by_type(relationships, predicate_map)
68
+ valid = Array(relationships).select do |r|
69
+ r.target && predicate_map.key?(r.type.to_sym)
70
+ end
71
+ targets = valid
72
+ .group_by { |r| r.type.to_sym }
73
+ .transform_values { |rs| rs.map(&:target) }
74
+ .transform_keys { |type| :"#{type}_targets" }
75
+ predicate_map.each_key.to_h do |type|
76
+ [:"#{type}_targets", targets[:"#{type}_targets"] || []]
77
+ end
78
+ end
79
+
63
80
  def self.group_targets(related_concepts, predicate_map)
64
81
  valid = valid_related(related_concepts, predicate_map)
65
82
  valid
@@ -120,9 +120,14 @@ module Glossarist
120
120
  build_gloss_designation(desig, concept_id, lang, idx)
121
121
  end
122
122
 
123
- definitions = build_gloss_definitions(data&.definition)
124
- notes = build_gloss_definitions(data&.notes)
125
- examples = build_gloss_definitions(data&.examples)
123
+ dd_attrs = if data
124
+ data.class.detailed_definition_fields.to_h do |field|
125
+ [field, build_gloss_definitions(data.send(field))]
126
+ end
127
+ else
128
+ { definition: [], notes: [], examples: [] }
129
+ end
130
+
126
131
  sources = build_gloss_sources(data&.sources)
127
132
  non_verb_reps = build_gloss_non_verbal_reps(l10n.non_verb_rep,
128
133
  concept_id, lang)
@@ -137,9 +142,7 @@ module Glossarist
137
142
  script: data&.script,
138
143
  system: data&.system,
139
144
  designations: designations,
140
- definitions: definitions,
141
- notes: notes,
142
- examples: examples,
145
+ **dd_attrs,
143
146
  sources: sources,
144
147
  non_verb_reps: non_verb_reps,
145
148
  )
@@ -150,9 +153,9 @@ module Glossarist
150
153
  instance = designation_instance_for(desig, common_attrs, concept_id,
151
154
  lang, index)
152
155
 
153
- rel_targets = Rdf::RelationshipPredicates.related_targets_by_type(
156
+ rel_targets = Rdf::RelationshipPredicates.designation_targets_by_type(
154
157
  desig.related,
155
- Rdf::RelationshipPredicates::DESIGNATION_REL_PREDICATES,
158
+ Rdf::RelationshipPredicates::DESIGNATION_ONLY_PREDICATES,
156
159
  )
157
160
  rel_targets.each do |attr_name, targets|
158
161
  instance.public_send(:"#{attr_name}=", targets) unless targets.empty?
@@ -15,8 +15,15 @@ module Glossarist
15
15
  attribute :notes, V3::DetailedDefinition,
16
16
  collection: Collections::DetailedDefinitionCollection,
17
17
  initialize_empty: true
18
+ attribute :annotations, V3::DetailedDefinition,
19
+ collection: Collections::DetailedDefinitionCollection,
20
+ initialize_empty: true
18
21
  attribute :related, V3::RelatedConcept, collection: true
19
22
 
23
+ def self.detailed_definition_fields
24
+ super + %i[annotations]
25
+ end
26
+
20
27
  key_value do
21
28
  map :dates, to: :dates
22
29
  map :definition, to: :definition
@@ -25,6 +32,7 @@ module Glossarist
25
32
  map %i[lineage_source_similarity lineageSourceSimilarity],
26
33
  to: :lineage_source_similarity
27
34
  map :notes, to: :notes
35
+ map :annotations, to: :annotations
28
36
  map :release, to: :release
29
37
  map :sources, to: :sources
30
38
  map :terms, to: :terms,
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.8.5"
7
+ VERSION = "2.8.6"
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.5
4
+ version: 2.8.6
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-04 00:00:00.000000000 Z
11
+ date: 2026-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -221,6 +221,7 @@ files:
221
221
  - lib/glossarist/designation.rb
222
222
  - lib/glossarist/designation/abbreviation.rb
223
223
  - lib/glossarist/designation/base.rb
224
+ - lib/glossarist/designation/designation_relationship.rb
224
225
  - lib/glossarist/designation/expression.rb
225
226
  - lib/glossarist/designation/grammar_info.rb
226
227
  - lib/glossarist/designation/graphical_symbol.rb