glossarist 2.8.2 → 2.8.5
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/.rubocop_todo.yml +78 -64
- data/glossarist.gemspec +1 -1
- data/lib/glossarist/bibliography_data.rb +41 -0
- data/lib/glossarist/bibliography_entry.rb +13 -0
- data/lib/glossarist/citation.rb +8 -2
- data/lib/glossarist/cli/export_command.rb +10 -5
- data/lib/glossarist/cli/validate_command.rb +21 -5
- data/lib/glossarist/collection.rb +2 -2
- data/lib/glossarist/collections/bibliography_collection.rb +2 -1
- data/lib/glossarist/collections/collection.rb +2 -2
- data/lib/glossarist/collections/localization_collection.rb +4 -4
- data/lib/glossarist/concept_collector.rb +6 -6
- data/lib/glossarist/concept_document.rb +2 -1
- data/lib/glossarist/concept_manager.rb +6 -7
- data/lib/glossarist/concept_reference.rb +4 -0
- data/lib/glossarist/concept_set.rb +4 -4
- data/lib/glossarist/concept_store.rb +38 -50
- data/lib/glossarist/dataset_register.rb +72 -0
- data/lib/glossarist/dataset_validator.rb +2 -1
- data/lib/glossarist/gcr_metadata.rb +8 -5
- data/lib/glossarist/gcr_package_definition.rb +35 -0
- data/lib/glossarist/gcr_statistics.rb +2 -2
- data/lib/glossarist/glossary_definition.rb +1 -1
- data/lib/glossarist/glossary_store.rb +198 -0
- data/lib/glossarist/managed_concept_collection.rb +2 -2
- data/lib/glossarist/rdf/gloss_citation.rb +8 -4
- data/lib/glossarist/rdf/gloss_concept.rb +6 -3
- data/lib/glossarist/rdf/gloss_concept_date.rb +4 -2
- data/lib/glossarist/rdf/gloss_concept_reference.rb +6 -3
- data/lib/glossarist/rdf/gloss_concept_source.rb +6 -3
- data/lib/glossarist/rdf/gloss_designation.rb +56 -25
- data/lib/glossarist/rdf/gloss_grammar_info.rb +19 -9
- data/lib/glossarist/rdf/gloss_locality.rb +6 -3
- data/lib/glossarist/rdf/gloss_localized_concept.rb +14 -7
- data/lib/glossarist/rdf/gloss_non_verbal_rep.rb +9 -4
- data/lib/glossarist/rdf/gloss_pronunciation.rb +13 -6
- data/lib/glossarist/rdf/gloss_reference.rb +8 -4
- data/lib/glossarist/rdf/namespaces.rb +3 -2
- data/lib/glossarist/rdf/relationship_predicates.rb +14 -7
- data/lib/glossarist/rdf.rb +2 -1
- data/lib/glossarist/register_data.rb +72 -18
- data/lib/glossarist/schema_migration.rb +8 -5
- data/lib/glossarist/section.rb +39 -0
- data/lib/glossarist/transforms/concept_to_gloss_transform.rb +24 -11
- data/lib/glossarist/v2/concept_data.rb +2 -1
- data/lib/glossarist/v2/concept_document.rb +1 -1
- data/lib/glossarist/v3/concept_data.rb +2 -1
- data/lib/glossarist/v3/concept_document.rb +1 -1
- data/lib/glossarist/validation/asset_index.rb +2 -2
- data/lib/glossarist/validation/bibliography_index.rb +2 -1
- data/lib/glossarist/validation/rules/asciidoc_xref_rule.rb +2 -1
- data/lib/glossarist/validation/rules/authoritative_source_rule.rb +1 -1
- data/lib/glossarist/validation/rules/bibliography_yaml_rule.rb +1 -1
- data/lib/glossarist/validation/rules/citation_completeness_rule.rb +1 -1
- data/lib/glossarist/validation/rules/concept_count_rule.rb +2 -3
- data/lib/glossarist/validation/rules/concept_id_rule.rb +0 -1
- data/lib/glossarist/validation/rules/concept_id_uniqueness_rule.rb +0 -1
- data/lib/glossarist/validation/rules/concept_mention_rule.rb +1 -2
- data/lib/glossarist/validation/rules/concept_status_rule.rb +1 -2
- data/lib/glossarist/validation/rules/concept_uri_rule.rb +1 -1
- data/lib/glossarist/validation/rules/date_type_rule.rb +5 -3
- data/lib/glossarist/validation/rules/date_validity_rule.rb +1 -1
- data/lib/glossarist/validation/rules/definition_content_rule.rb +1 -2
- data/lib/glossarist/validation/rules/domain_target_rule.rb +1 -1
- data/lib/glossarist/validation/rules/duplicate_term_rule.rb +1 -2
- data/lib/glossarist/validation/rules/entry_status_rule.rb +1 -2
- data/lib/glossarist/validation/rules/filename_id_rule.rb +2 -3
- data/lib/glossarist/validation/rules/image_reference_rule.rb +3 -2
- data/lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb +1 -2
- data/lib/glossarist/validation/rules/language_coverage_rule.rb +1 -2
- data/lib/glossarist/validation/rules/language_list_rule.rb +2 -3
- data/lib/glossarist/validation/rules/locality_completeness_rule.rb +3 -1
- data/lib/glossarist/validation/rules/localization_consistency_rule.rb +1 -1
- data/lib/glossarist/validation/rules/localization_presence_rule.rb +0 -1
- data/lib/glossarist/validation/rules/model_validity_rule.rb +1 -1
- data/lib/glossarist/validation/rules/orphaned_bibliography_rule.rb +2 -1
- data/lib/glossarist/validation/rules/orphaned_images_rule.rb +6 -4
- data/lib/glossarist/validation/rules/orphaned_l10n_files_rule.rb +1 -2
- data/lib/glossarist/validation/rules/preferred_term_rule.rb +1 -2
- data/lib/glossarist/validation/rules/related_concept_cycle_rule.rb +2 -2
- data/lib/glossarist/validation/rules/related_concept_rule.rb +1 -2
- data/lib/glossarist/validation/rules/related_concept_symmetry_rule.rb +1 -1
- data/lib/glossarist/validation/rules/related_concept_target_rule.rb +1 -1
- data/lib/glossarist/validation/rules/source_type_rule.rb +2 -2
- data/lib/glossarist/validation/rules/source_urn_format_rule.rb +2 -2
- data/lib/glossarist/validation/rules/terms_presence_rule.rb +1 -1
- data/lib/glossarist/validation/rules/uuid_format_rule.rb +1 -1
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +7 -0
- data/scripts/migrate_dataset.rb +14 -8
- data/scripts/migrate_isotc204_to_v3.rb +3 -1
- data/scripts/migrate_isotc211_to_v3.rb +5 -3
- data/scripts/migrate_osgeo_to_v3.rb +4 -2
- data/scripts/upgrade_dataset_to_v3.rb +0 -0
- metadata +15 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb636339e439da216185715fcfe387842aabd1b38147dd49b5e4fdb5909b6d2d
|
|
4
|
+
data.tar.gz: 2704b81c1f4d179d8909bc1d245b9caee83d2e54fa56a6148699892f021e9d6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e39df7a02295426fb6463f93189cf6e3d457e60457b9bb5cde1881eeb549fe1afd4730e3ac280030be8de60734dbc2e0532b14030890e107b9df35dabbd1ede
|
|
7
|
+
data.tar.gz: 5e4ef4cf71118c020f29b105bb81bb19d753dcb9484f367d0a2caab0b51927e7bcf69e325549bb4e7f44f9f1ec571ffb4223710ca8cc7987dd10eb4750148514
|
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-
|
|
3
|
+
# on 2026-06-04 14:04:56 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,30 +11,49 @@ Gemspec/RequiredRubyVersion:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'glossarist.gemspec'
|
|
13
13
|
|
|
14
|
-
# Offense count:
|
|
14
|
+
# Offense count: 6
|
|
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
|
-
- '
|
|
21
|
-
- 'spec/unit/designations_spec.rb'
|
|
20
|
+
- 'spec/unit/section_spec.rb'
|
|
22
21
|
|
|
23
|
-
# Offense count:
|
|
22
|
+
# Offense count: 3
|
|
24
23
|
# This cop supports safe autocorrection (--autocorrect).
|
|
25
24
|
# Configuration parameters: EnforcedStyleAlignWith.
|
|
26
25
|
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
27
26
|
Layout/BlockAlignment:
|
|
28
27
|
Exclude:
|
|
29
|
-
- 'spec/unit/
|
|
28
|
+
- 'spec/unit/section_spec.rb'
|
|
30
29
|
|
|
31
|
-
# Offense count:
|
|
30
|
+
# Offense count: 3
|
|
32
31
|
# This cop supports safe autocorrection (--autocorrect).
|
|
33
32
|
Layout/BlockEndNewline:
|
|
34
33
|
Exclude:
|
|
35
|
-
- 'spec/unit/
|
|
34
|
+
- 'spec/unit/section_spec.rb'
|
|
36
35
|
|
|
37
|
-
# Offense count:
|
|
36
|
+
# Offense count: 1
|
|
37
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
38
|
+
Layout/EmptyLineAfterGuardClause:
|
|
39
|
+
Exclude:
|
|
40
|
+
- 'lib/glossarist/section.rb'
|
|
41
|
+
|
|
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
|
|
38
57
|
# This cop supports safe autocorrection (--autocorrect).
|
|
39
58
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
40
59
|
# SupportedHashRocketStyles: key, separator, table
|
|
@@ -42,32 +61,39 @@ Layout/BlockEndNewline:
|
|
|
42
61
|
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
43
62
|
Layout/HashAlignment:
|
|
44
63
|
Exclude:
|
|
45
|
-
- 'spec/unit/
|
|
46
|
-
- 'spec/unit/
|
|
64
|
+
- 'spec/unit/dataset_register_spec.rb'
|
|
65
|
+
- 'spec/unit/section_spec.rb'
|
|
47
66
|
|
|
48
|
-
# Offense count:
|
|
67
|
+
# Offense count: 6
|
|
49
68
|
# This cop supports safe autocorrection (--autocorrect).
|
|
50
69
|
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
51
70
|
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
52
71
|
Layout/IndentationWidth:
|
|
53
72
|
Exclude:
|
|
54
|
-
- 'spec/unit/
|
|
73
|
+
- 'spec/unit/section_spec.rb'
|
|
55
74
|
|
|
56
|
-
# Offense count:
|
|
75
|
+
# Offense count: 424
|
|
57
76
|
# This cop supports safe autocorrection (--autocorrect).
|
|
58
77
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
59
78
|
# URISchemes: http, https
|
|
60
79
|
Layout/LineLength:
|
|
61
80
|
Enabled: false
|
|
62
81
|
|
|
82
|
+
# Offense count: 1
|
|
83
|
+
# 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
|
+
|
|
63
90
|
# Offense count: 7
|
|
64
91
|
# This cop supports safe autocorrection (--autocorrect).
|
|
65
92
|
# Configuration parameters: AllowInHeredoc.
|
|
66
93
|
Layout/TrailingWhitespace:
|
|
67
94
|
Exclude:
|
|
68
|
-
- '
|
|
69
|
-
- 'spec/unit/
|
|
70
|
-
- 'spec/unit/designations_spec.rb'
|
|
95
|
+
- 'spec/unit/dataset_register_spec.rb'
|
|
96
|
+
- 'spec/unit/section_spec.rb'
|
|
71
97
|
|
|
72
98
|
# Offense count: 1
|
|
73
99
|
# Configuration parameters: AllowedMethods.
|
|
@@ -76,6 +102,12 @@ Lint/ConstantDefinitionInBlock:
|
|
|
76
102
|
Exclude:
|
|
77
103
|
- 'spec/unit/utilities/common_functions_spec.rb'
|
|
78
104
|
|
|
105
|
+
# Offense count: 1
|
|
106
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
107
|
+
Lint/DuplicateBranch:
|
|
108
|
+
Exclude:
|
|
109
|
+
- 'scripts/migrate_dataset.rb'
|
|
110
|
+
|
|
79
111
|
# Offense count: 1
|
|
80
112
|
# This cop supports safe autocorrection (--autocorrect).
|
|
81
113
|
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
|
@@ -84,55 +116,36 @@ Lint/UnusedMethodArgument:
|
|
|
84
116
|
Exclude:
|
|
85
117
|
- 'lib/glossarist/dataset_validator.rb'
|
|
86
118
|
|
|
87
|
-
# Offense count:
|
|
119
|
+
# Offense count: 85
|
|
88
120
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
89
121
|
Metrics/AbcSize:
|
|
90
122
|
Enabled: false
|
|
91
123
|
|
|
92
|
-
# Offense count:
|
|
124
|
+
# Offense count: 7
|
|
125
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
126
|
+
# AllowedMethods: refine
|
|
127
|
+
Metrics/BlockLength:
|
|
128
|
+
Max: 41
|
|
129
|
+
|
|
130
|
+
# Offense count: 52
|
|
93
131
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
94
132
|
Metrics/CyclomaticComplexity:
|
|
95
|
-
|
|
96
|
-
- 'lib/glossarist/cli/export_command.rb'
|
|
97
|
-
- 'lib/glossarist/concept_validator.rb'
|
|
98
|
-
- 'lib/glossarist/designation/expression.rb'
|
|
99
|
-
- 'lib/glossarist/gcr_metadata.rb'
|
|
100
|
-
- 'lib/glossarist/gcr_statistics.rb'
|
|
101
|
-
- 'lib/glossarist/gcr_validator.rb'
|
|
102
|
-
- 'lib/glossarist/managed_concept.rb'
|
|
103
|
-
- 'lib/glossarist/reference_extractor.rb'
|
|
104
|
-
- 'lib/glossarist/reference_resolver.rb'
|
|
105
|
-
- 'lib/glossarist/resolution_adapter/local.rb'
|
|
106
|
-
- 'lib/glossarist/schema_migration.rb'
|
|
107
|
-
- 'lib/glossarist/transforms/concept_to_skos_transform.rb'
|
|
108
|
-
- 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
|
|
109
|
-
- 'lib/glossarist/validation/bibliography_index.rb'
|
|
133
|
+
Enabled: false
|
|
110
134
|
|
|
111
|
-
# Offense count:
|
|
135
|
+
# Offense count: 107
|
|
112
136
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
113
137
|
Metrics/MethodLength:
|
|
114
|
-
Max:
|
|
138
|
+
Max: 47
|
|
115
139
|
|
|
116
|
-
# Offense count:
|
|
140
|
+
# Offense count: 5
|
|
117
141
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
118
142
|
Metrics/ParameterLists:
|
|
119
143
|
Max: 6
|
|
120
144
|
|
|
121
|
-
# Offense count:
|
|
145
|
+
# Offense count: 38
|
|
122
146
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
123
147
|
Metrics/PerceivedComplexity:
|
|
124
|
-
|
|
125
|
-
- 'lib/glossarist/concept_validator.rb'
|
|
126
|
-
- 'lib/glossarist/designation/expression.rb'
|
|
127
|
-
- 'lib/glossarist/gcr_metadata.rb'
|
|
128
|
-
- 'lib/glossarist/gcr_validator.rb'
|
|
129
|
-
- 'lib/glossarist/reference_extractor.rb'
|
|
130
|
-
- 'lib/glossarist/reference_resolver.rb'
|
|
131
|
-
- 'lib/glossarist/resolution_adapter/local.rb'
|
|
132
|
-
- 'lib/glossarist/schema_migration.rb'
|
|
133
|
-
- 'lib/glossarist/transforms/concept_to_skos_transform.rb'
|
|
134
|
-
- 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
|
|
135
|
-
- 'lib/glossarist/validation/bibliography_index.rb'
|
|
148
|
+
Enabled: false
|
|
136
149
|
|
|
137
150
|
# Offense count: 6
|
|
138
151
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
@@ -141,13 +154,16 @@ Naming/MethodParameterName:
|
|
|
141
154
|
Exclude:
|
|
142
155
|
- 'lib/glossarist/schema_migration.rb'
|
|
143
156
|
|
|
144
|
-
# Offense count:
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
148
|
-
|
|
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:
|
|
149
165
|
Exclude:
|
|
150
|
-
- 'spec/unit/
|
|
166
|
+
- 'spec/unit/section_spec.rb'
|
|
151
167
|
|
|
152
168
|
# Offense count: 6
|
|
153
169
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -156,18 +172,16 @@ Naming/VariableNumber:
|
|
|
156
172
|
Style/FormatStringToken:
|
|
157
173
|
EnforcedStyle: unannotated
|
|
158
174
|
|
|
159
|
-
# Offense count:
|
|
160
|
-
#
|
|
161
|
-
Style/
|
|
175
|
+
# Offense count: 2
|
|
176
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
177
|
+
Style/IdenticalConditionalBranches:
|
|
162
178
|
Exclude:
|
|
163
|
-
- '
|
|
164
|
-
- 'test/**/*'
|
|
165
|
-
- 'lib/glossarist.rb'
|
|
179
|
+
- 'scripts/migrate_dataset.rb'
|
|
166
180
|
|
|
167
|
-
# Offense count:
|
|
181
|
+
# Offense count: 3
|
|
168
182
|
# Configuration parameters: Max.
|
|
169
183
|
Style/SafeNavigationChainLength:
|
|
170
184
|
Exclude:
|
|
171
185
|
- 'lib/glossarist/managed_concept.rb'
|
|
172
|
-
- 'lib/glossarist/transforms/concept_to_skos_transform.rb'
|
|
173
186
|
- 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
|
|
187
|
+
- 'lib/glossarist/validation/rules/source_urn_format_rule.rb'
|
data/glossarist.gemspec
CHANGED
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.require_paths = ["lib"]
|
|
33
33
|
|
|
34
34
|
spec.add_dependency "lutaml-model", "~> 0.8.15"
|
|
35
|
-
spec.add_dependency "lutaml-store", "~> 0.
|
|
35
|
+
spec.add_dependency "lutaml-store", "~> 0.2.0"
|
|
36
36
|
spec.add_dependency "paint", "~> 2.3"
|
|
37
37
|
spec.add_dependency "relaton", ">= 2.0.0", "< 3"
|
|
38
38
|
spec.add_dependency "rubyzip", ">= 2.3", "< 3"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Glossarist
|
|
4
|
+
class BibliographyData < Lutaml::Model::Serializable
|
|
5
|
+
attribute :shortname, :string, default: -> { "bibliography" }
|
|
6
|
+
attribute :entries, BibliographyEntry, collection: true,
|
|
7
|
+
initialize_empty: true
|
|
8
|
+
|
|
9
|
+
key_value do
|
|
10
|
+
map nil, to: :entries,
|
|
11
|
+
with: { from: :entries_from_hash, to: :entries_to_hash }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(citation_key)
|
|
15
|
+
entries.find { |e| e.citation_key == citation_key }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def keys
|
|
19
|
+
entries.map(&:citation_key)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def [](citation_key)
|
|
23
|
+
entry = find(citation_key)
|
|
24
|
+
entry&.data
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def entries_from_hash(model, value)
|
|
28
|
+
return unless value.is_a?(Hash)
|
|
29
|
+
|
|
30
|
+
model.entries = value.map do |key, data|
|
|
31
|
+
BibliographyEntry.new(citation_key: key, data: data || {})
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def entries_to_hash(model, doc)
|
|
36
|
+
model.entries.each do |entry|
|
|
37
|
+
doc[entry.citation_key] = entry.data
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Glossarist
|
|
4
|
+
class BibliographyEntry < Lutaml::Model::Serializable
|
|
5
|
+
attribute :citation_key, :string
|
|
6
|
+
attribute :data, :hash, default: -> { {} }
|
|
7
|
+
|
|
8
|
+
key_value do
|
|
9
|
+
map "citation_key", to: :citation_key
|
|
10
|
+
map "data", to: :data
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/glossarist/citation.rb
CHANGED
|
@@ -56,8 +56,14 @@ module Glossarist
|
|
|
56
56
|
|
|
57
57
|
doc["locality"] = {}
|
|
58
58
|
doc["locality"]["type"] = model.locality.type
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if model.locality.reference_from
|
|
60
|
+
doc["locality"]["reference_from"] =
|
|
61
|
+
model.locality.reference_from
|
|
62
|
+
end
|
|
63
|
+
if model.locality.reference_to
|
|
64
|
+
doc["locality"]["reference_to"] =
|
|
65
|
+
model.locality.reference_to
|
|
66
|
+
end
|
|
61
67
|
end
|
|
62
68
|
end
|
|
63
69
|
end
|
|
@@ -74,14 +74,18 @@ module Glossarist
|
|
|
74
74
|
|
|
75
75
|
def export_jsonld(concepts, name, output_dir)
|
|
76
76
|
require "glossarist/transforms/concept_to_gloss_transform"
|
|
77
|
-
transform = Transforms::ConceptToGlossTransform.new(nil,
|
|
78
|
-
|
|
77
|
+
transform = Transforms::ConceptToGlossTransform.new(nil,
|
|
78
|
+
transform_options)
|
|
79
|
+
File.write(File.join(output_dir, "#{name}.jsonld"),
|
|
80
|
+
transform.to_jsonld(concepts))
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
def export_turtle(concepts, name, output_dir)
|
|
82
84
|
require "glossarist/transforms/concept_to_gloss_transform"
|
|
83
|
-
transform = Transforms::ConceptToGlossTransform.new(nil,
|
|
84
|
-
|
|
85
|
+
transform = Transforms::ConceptToGlossTransform.new(nil,
|
|
86
|
+
transform_options)
|
|
87
|
+
File.write(File.join(output_dir, "#{name}.ttl"),
|
|
88
|
+
transform.to_turtle(concepts))
|
|
85
89
|
end
|
|
86
90
|
|
|
87
91
|
def export_tbx(concepts, name, output_dir)
|
|
@@ -95,7 +99,8 @@ module Glossarist
|
|
|
95
99
|
require "glossarist/transforms/concept_to_gloss_transform"
|
|
96
100
|
File.open(File.join(output_dir, "#{name}.jsonl"), "w") do |f|
|
|
97
101
|
concepts.each do |concept|
|
|
98
|
-
transform = Transforms::ConceptToGlossTransform.new(concept,
|
|
102
|
+
transform = Transforms::ConceptToGlossTransform.new(concept,
|
|
103
|
+
transform_options)
|
|
99
104
|
f.write(transform.to_jsonl_line)
|
|
100
105
|
f.write("\n")
|
|
101
106
|
end
|
|
@@ -37,7 +37,8 @@ module Glossarist
|
|
|
37
37
|
filled = (current.to_f / total * bar_width).round
|
|
38
38
|
bar = "#{'█' * filled}#{'░' * (bar_width - filled)}"
|
|
39
39
|
|
|
40
|
-
$stderr.print "\r #{Paint['Validating',
|
|
40
|
+
$stderr.print "\r #{Paint['Validating',
|
|
41
|
+
:bold]} #{bar} #{current}/#{total} (#{pct}%)"
|
|
41
42
|
$stderr.flush
|
|
42
43
|
end
|
|
43
44
|
|
|
@@ -96,18 +97,33 @@ module Glossarist
|
|
|
96
97
|
msg_col = 21
|
|
97
98
|
|
|
98
99
|
puts " #{label} #{code} #{issue.message}"
|
|
99
|
-
|
|
100
|
+
if issue.suggestion
|
|
101
|
+
puts "#{' ' * msg_col}#{Paint[issue.suggestion,
|
|
102
|
+
:green]}"
|
|
103
|
+
end
|
|
100
104
|
end
|
|
101
105
|
|
|
102
106
|
def print_summary_line(result)
|
|
103
107
|
error_count = result.issues.count(&:error?)
|
|
104
108
|
warning_count = result.issues.count(&:warning?)
|
|
105
109
|
|
|
106
|
-
status = error_count.positive?
|
|
110
|
+
status = if error_count.positive?
|
|
111
|
+
Paint["INVALID", :red,
|
|
112
|
+
:bold]
|
|
113
|
+
else
|
|
114
|
+
Paint["VALID", :green,
|
|
115
|
+
:bold]
|
|
116
|
+
end
|
|
107
117
|
|
|
108
118
|
details = []
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
if error_count.positive?
|
|
120
|
+
details << Paint["#{error_count} error(s)",
|
|
121
|
+
:red]
|
|
122
|
+
end
|
|
123
|
+
if warning_count.positive?
|
|
124
|
+
details << Paint["#{warning_count} warning(s)",
|
|
125
|
+
:yellow]
|
|
126
|
+
end
|
|
111
127
|
|
|
112
128
|
puts " #{status} #{details.join(', ')}"
|
|
113
129
|
end
|
|
@@ -7,7 +7,7 @@ module Glossarist
|
|
|
7
7
|
class BibliographyCollection < Relaton::Db
|
|
8
8
|
def initialize(_concepts, global_cache, local_cache)
|
|
9
9
|
@version_mismatch = check_cache_version(local_cache) ||
|
|
10
|
-
|
|
10
|
+
check_cache_version(global_cache)
|
|
11
11
|
super(global_cache, local_cache)
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -40,6 +40,7 @@ module Glossarist
|
|
|
40
40
|
concepts.each do |concept|
|
|
41
41
|
concept.default_lang.sources.each do |source|
|
|
42
42
|
next if source.origin.ref.nil?
|
|
43
|
+
|
|
43
44
|
ref_text = source.origin.ref.source
|
|
44
45
|
next if ref_text.nil?
|
|
45
46
|
|
|
@@ -136,25 +136,25 @@ module Glossarist
|
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
def each_v2_concept(dir, &
|
|
139
|
+
def each_v2_concept(dir, &)
|
|
140
140
|
if v2_flat_concepts?(dir)
|
|
141
|
-
each_grouped_v2_concepts(File.join(dir, "concepts"), &
|
|
141
|
+
each_grouped_v2_concepts(File.join(dir, "concepts"), &)
|
|
142
142
|
else
|
|
143
143
|
v2_dir = File.join(dir, "geolexica-v2")
|
|
144
144
|
if File.directory?(File.join(v2_dir, "concepts"))
|
|
145
|
-
each_managed_concept(v2_dir, &
|
|
145
|
+
each_managed_concept(v2_dir, &)
|
|
146
146
|
else
|
|
147
|
-
each_grouped_v2_concepts(v2_dir, &
|
|
147
|
+
each_grouped_v2_concepts(v2_dir, &)
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
def each_grouped_v2_concepts(v2_dir, &
|
|
152
|
+
def each_grouped_v2_concepts(v2_dir, &)
|
|
153
153
|
collection = ManagedConceptCollection.new
|
|
154
154
|
manager = ConceptManager.new(path: v2_dir)
|
|
155
155
|
manager.version = detect_schema_version(v2_dir)
|
|
156
156
|
manager.load_from_files(collection: collection)
|
|
157
|
-
collection.each(&
|
|
157
|
+
collection.each(&)
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def collect_grouped_v2_concepts(v2_dir)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Glossarist
|
|
4
4
|
class ConceptDocument < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
5
6
|
attribute :concept, ManagedConcept
|
|
6
7
|
attribute :localizations, LocalizedConcept, collection: true
|
|
7
8
|
|
|
@@ -9,7 +10,7 @@ module Glossarist
|
|
|
9
10
|
sequence do
|
|
10
11
|
map_document 0, to: :concept, type: ManagedConcept
|
|
11
12
|
map_document 1.., to: :localizations, type: LocalizedConcept,
|
|
12
|
-
|
|
13
|
+
collection: true
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -132,13 +132,12 @@ module Glossarist
|
|
|
132
132
|
if v1_collection?
|
|
133
133
|
File.join(path, "concept-*.{yaml,yml}")
|
|
134
134
|
else
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
concepts_glob
|
|
135
|
+
candidates = [
|
|
136
|
+
File.join(path, "concept", "*.{yaml,yml}"),
|
|
137
|
+
File.join(path, "concepts", "*.{yaml,yml}"),
|
|
138
|
+
File.join(path, "*.{yaml,yml}"),
|
|
139
|
+
]
|
|
140
|
+
candidates.find { |g| !Dir.glob(g).empty? }
|
|
142
141
|
end
|
|
143
142
|
end
|
|
144
143
|
|
|
@@ -26,6 +26,10 @@ module Glossarist
|
|
|
26
26
|
new(concept_id: concept_id, ref_type: "domain")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
def self.section(concept_id)
|
|
30
|
+
new(concept_id: concept_id, ref_type: "section")
|
|
31
|
+
end
|
|
32
|
+
|
|
29
33
|
def local?
|
|
30
34
|
%w[local designation].include?(ref_type) ||
|
|
31
35
|
(ref_type.nil? && (source.nil? || source.empty?))
|
|
@@ -36,7 +36,7 @@ module Glossarist
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def to_latex_from_file(entries_file)
|
|
39
|
-
File.readlines(entries_file).
|
|
39
|
+
File.readlines(entries_file).filter_map do |concept_name|
|
|
40
40
|
concept = concept_map[concept_name.strip.downcase]
|
|
41
41
|
|
|
42
42
|
if concept.nil?
|
|
@@ -44,7 +44,7 @@ module Glossarist
|
|
|
44
44
|
else
|
|
45
45
|
latex_template(concept)
|
|
46
46
|
end
|
|
47
|
-
end.
|
|
47
|
+
end.join("\n")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def read_concepts(concepts)
|
|
@@ -72,9 +72,9 @@ module Glossarist
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def concept_map
|
|
75
|
-
@concept_map ||= concepts.managed_concepts.
|
|
75
|
+
@concept_map ||= concepts.managed_concepts.to_h do |concept|
|
|
76
76
|
[concept.default_designation.downcase, concept]
|
|
77
|
-
end
|
|
77
|
+
end
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
end
|