glossarist 2.8.2 → 2.8.4
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 +413 -63
- data/Gemfile +1 -0
- 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_set.rb +4 -4
- data/lib/glossarist/concept_store.rb +38 -48
- data/lib/glossarist/dataset_validator.rb +2 -1
- data/lib/glossarist/gcr_package_definition.rb +37 -0
- data/lib/glossarist/gcr_statistics.rb +2 -2
- data/lib/glossarist/glossary_definition.rb +1 -1
- data/lib/glossarist/glossary_store.rb +201 -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 +68 -18
- data/lib/glossarist/schema_migration.rb +8 -5
- data/lib/glossarist/transforms/concept_to_gloss_transform.rb +23 -10
- 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 +4 -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 +13 -5
|
@@ -63,7 +63,9 @@ module Glossarist
|
|
|
63
63
|
|
|
64
64
|
def to_jsonld(concepts_or_concept = nil)
|
|
65
65
|
if concepts_or_concept.is_a?(Array)
|
|
66
|
-
gloss_concepts = concepts_or_concept.map
|
|
66
|
+
gloss_concepts = concepts_or_concept.map do |c|
|
|
67
|
+
build_gloss_concept(c)
|
|
68
|
+
end
|
|
67
69
|
doc = Rdf::GlossDocument.new(concepts: gloss_concepts)
|
|
68
70
|
Rdf::GlossDocument.to_jsonld(doc)
|
|
69
71
|
else
|
|
@@ -103,7 +105,8 @@ module Glossarist
|
|
|
103
105
|
status: status_uri(managed_concept.status),
|
|
104
106
|
localizations: localizations,
|
|
105
107
|
sources: build_gloss_sources(managed_concept.data&.sources),
|
|
106
|
-
domains: build_gloss_domains(managed_concept.data&.domains,
|
|
108
|
+
domains: build_gloss_domains(managed_concept.data&.domains,
|
|
109
|
+
identifier),
|
|
107
110
|
dates: build_gloss_dates(managed_concept.dates, identifier),
|
|
108
111
|
**rel_targets,
|
|
109
112
|
)
|
|
@@ -121,7 +124,8 @@ module Glossarist
|
|
|
121
124
|
notes = build_gloss_definitions(data&.notes)
|
|
122
125
|
examples = build_gloss_definitions(data&.examples)
|
|
123
126
|
sources = build_gloss_sources(data&.sources)
|
|
124
|
-
non_verb_reps = build_gloss_non_verbal_reps(l10n.non_verb_rep,
|
|
127
|
+
non_verb_reps = build_gloss_non_verbal_reps(l10n.non_verb_rep,
|
|
128
|
+
concept_id, lang)
|
|
125
129
|
|
|
126
130
|
Rdf::GlossLocalizedConcept.new(
|
|
127
131
|
concept_id: concept_id.to_s,
|
|
@@ -143,7 +147,8 @@ module Glossarist
|
|
|
143
147
|
|
|
144
148
|
def build_gloss_designation(desig, concept_id, lang, index)
|
|
145
149
|
common_attrs = designation_common_attrs(desig, concept_id, lang, index)
|
|
146
|
-
instance = designation_instance_for(desig, common_attrs, concept_id,
|
|
150
|
+
instance = designation_instance_for(desig, common_attrs, concept_id,
|
|
151
|
+
lang, index)
|
|
147
152
|
|
|
148
153
|
rel_targets = Rdf::RelationshipPredicates.related_targets_by_type(
|
|
149
154
|
desig.related,
|
|
@@ -162,7 +167,8 @@ module Glossarist
|
|
|
162
167
|
when Designation::Expression
|
|
163
168
|
build_gloss_expression(desig, common_attrs, concept_id, lang, index)
|
|
164
169
|
when Designation::GraphicalSymbol
|
|
165
|
-
Rdf::GlossGraphicalSymbol.new(common_attrs.merge(text: desig.text,
|
|
170
|
+
Rdf::GlossGraphicalSymbol.new(common_attrs.merge(text: desig.text,
|
|
171
|
+
image: desig.image))
|
|
166
172
|
when Designation::LetterSymbol
|
|
167
173
|
Rdf::GlossLetterSymbol.new(common_attrs.merge(text: desig.text))
|
|
168
174
|
when Designation::Symbol
|
|
@@ -187,7 +193,8 @@ module Glossarist
|
|
|
187
193
|
concept_id: concept_id.to_s,
|
|
188
194
|
lang_code: (desig.language || lang).to_s,
|
|
189
195
|
index: index.to_s,
|
|
190
|
-
pronunciations: build_gloss_pronunciations(desig.pronunciation,
|
|
196
|
+
pronunciations: build_gloss_pronunciations(desig.pronunciation,
|
|
197
|
+
concept_id, lang, index),
|
|
191
198
|
sources: build_gloss_sources(desig.sources),
|
|
192
199
|
}
|
|
193
200
|
end
|
|
@@ -200,7 +207,9 @@ module Glossarist
|
|
|
200
207
|
acronym: desig.acronym,
|
|
201
208
|
initialism: desig.initialism,
|
|
202
209
|
truncation: desig.truncation,
|
|
203
|
-
grammar_info: build_gloss_grammar_infos(
|
|
210
|
+
grammar_info: build_gloss_grammar_infos(
|
|
211
|
+
desig.grammar_info, concept_id, lang, index
|
|
212
|
+
),
|
|
204
213
|
))
|
|
205
214
|
end
|
|
206
215
|
|
|
@@ -209,7 +218,9 @@ module Glossarist
|
|
|
209
218
|
prefix: desig.prefix,
|
|
210
219
|
usage_info: desig.usage_info,
|
|
211
220
|
field_of_application: desig.field_of_application,
|
|
212
|
-
grammar_info: build_gloss_grammar_infos(
|
|
221
|
+
grammar_info: build_gloss_grammar_infos(
|
|
222
|
+
desig.grammar_info, concept_id, lang, index
|
|
223
|
+
),
|
|
213
224
|
))
|
|
214
225
|
end
|
|
215
226
|
|
|
@@ -255,7 +266,8 @@ module Glossarist
|
|
|
255
266
|
)
|
|
256
267
|
end
|
|
257
268
|
|
|
258
|
-
def build_gloss_pronunciations(pronunciations, concept_id, lang,
|
|
269
|
+
def build_gloss_pronunciations(pronunciations, concept_id, lang,
|
|
270
|
+
_desig_index)
|
|
259
271
|
Array(pronunciations).each_with_index.map do |pron, idx|
|
|
260
272
|
Rdf::GlossPronunciation.new(
|
|
261
273
|
content: pron.content,
|
|
@@ -270,7 +282,8 @@ module Glossarist
|
|
|
270
282
|
end
|
|
271
283
|
end
|
|
272
284
|
|
|
273
|
-
def build_gloss_grammar_infos(grammar_infos, concept_id, lang,
|
|
285
|
+
def build_gloss_grammar_infos(grammar_infos, concept_id, lang,
|
|
286
|
+
desig_index)
|
|
274
287
|
Array(grammar_infos).map do |gi|
|
|
275
288
|
Rdf::GlossGrammarInfo.new(
|
|
276
289
|
gender: Array(gi.gender).map { |g| "gloss:gender/#{g}" },
|
|
@@ -37,7 +37,8 @@ module Glossarist
|
|
|
37
37
|
map :system, to: :system
|
|
38
38
|
map %i[entry_status entryStatus], to: :entry_status
|
|
39
39
|
map %i[review_date reviewDate], to: :review_date
|
|
40
|
-
map %i[review_decision_date reviewDecisionDate],
|
|
40
|
+
map %i[review_decision_date reviewDecisionDate],
|
|
41
|
+
to: :review_decision_date
|
|
41
42
|
map %i[review_decision_event reviewDecisionEvent],
|
|
42
43
|
to: :review_decision_event
|
|
43
44
|
end
|
|
@@ -37,7 +37,8 @@ module Glossarist
|
|
|
37
37
|
map :system, to: :system
|
|
38
38
|
map %i[entry_status entryStatus], to: :entry_status
|
|
39
39
|
map %i[review_date reviewDate], to: :review_date
|
|
40
|
-
map %i[review_decision_date reviewDecisionDate],
|
|
40
|
+
map %i[review_decision_date reviewDecisionDate],
|
|
41
|
+
to: :review_decision_date
|
|
41
42
|
map %i[review_decision_event reviewDecisionEvent],
|
|
42
43
|
to: :review_decision_event
|
|
43
44
|
end
|
|
@@ -35,7 +35,8 @@ module Glossarist
|
|
|
35
35
|
index
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def self.build_from_yaml(concepts, bibliography_yaml: nil,
|
|
38
|
+
def self.build_from_yaml(concepts, bibliography_yaml: nil,
|
|
39
|
+
images_yaml: nil)
|
|
39
40
|
index = new
|
|
40
41
|
|
|
41
42
|
concepts.each { |concept| index_concept_sources(index, concept) }
|
|
@@ -24,6 +24,7 @@ module Glossarist
|
|
|
24
24
|
|
|
25
25
|
l10n.text_content.each do |text|
|
|
26
26
|
next unless text
|
|
27
|
+
|
|
27
28
|
extractor.extract_from_text(text).each do |ref|
|
|
28
29
|
next unless ref.is_a?(BibliographicReference)
|
|
29
30
|
next if context.bibliography_index.resolve?(ref.anchor)
|
|
@@ -33,7 +34,7 @@ module Glossarist
|
|
|
33
34
|
code: code, severity: severity,
|
|
34
35
|
location: "#{fname}/#{lang}",
|
|
35
36
|
suggestion: "add '#{ref.anchor}' as a source, " \
|
|
36
|
-
"or verify it exists in bibliography.yaml"
|
|
37
|
+
"or verify it exists in bibliography.yaml"
|
|
37
38
|
)
|
|
38
39
|
end
|
|
39
40
|
end
|
|
@@ -25,7 +25,7 @@ module Glossarist
|
|
|
25
25
|
"no authoritative source defined",
|
|
26
26
|
code: code, severity: severity,
|
|
27
27
|
location: fname,
|
|
28
|
-
suggestion: "Add at least one source with type: authoritative"
|
|
28
|
+
suggestion: "Add at least one source with type: authoritative"
|
|
29
29
|
)]
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -24,7 +24,7 @@ module Glossarist
|
|
|
24
24
|
"bibliography.yaml is invalid YAML: #{e.message}",
|
|
25
25
|
code: code, severity: severity,
|
|
26
26
|
location: "bibliography.yaml",
|
|
27
|
-
suggestion: "Fix YAML syntax errors in bibliography.yaml"
|
|
27
|
+
suggestion: "Fix YAML syntax errors in bibliography.yaml"
|
|
28
28
|
)]
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -28,7 +28,7 @@ module Glossarist
|
|
|
28
28
|
"source #{idx + 1} has empty origin (no ref source or id)",
|
|
29
29
|
code: "GLS-304", severity: severity,
|
|
30
30
|
location: fname,
|
|
31
|
-
suggestion: "Add at minimum an origin.ref with source or id"
|
|
31
|
+
suggestion: "Add at minimum an origin.ref with source or id"
|
|
32
32
|
)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -10,7 +10,7 @@ module Glossarist
|
|
|
10
10
|
def scope = :collection
|
|
11
11
|
|
|
12
12
|
def applicable?(context)
|
|
13
|
-
context.metadata
|
|
13
|
+
context.metadata&.concept_count
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def check(context)
|
|
@@ -24,11 +24,10 @@ module Glossarist
|
|
|
24
24
|
"but found #{actual} concept files",
|
|
25
25
|
code: code, severity: severity,
|
|
26
26
|
location: "metadata.yaml",
|
|
27
|
-
suggestion: "Update concept_count or add/remove concept files"
|
|
27
|
+
suggestion: "Update concept_count or add/remove concept files"
|
|
28
28
|
)]
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
|
-
|
|
@@ -31,7 +31,7 @@ module Glossarist
|
|
|
31
31
|
code: "GLS-100", severity: severity,
|
|
32
32
|
location: fname,
|
|
33
33
|
suggestion: "add concept '#{ref.concept_id}' to the dataset " \
|
|
34
|
-
"or verify the reference"
|
|
34
|
+
"or verify the reference"
|
|
35
35
|
)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -41,4 +41,3 @@ module Glossarist
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
-
|
|
@@ -26,11 +26,10 @@ module Glossarist
|
|
|
26
26
|
"invalid concept status '#{status}'",
|
|
27
27
|
code: code, severity: severity,
|
|
28
28
|
location: fname,
|
|
29
|
-
suggestion: "Use one of: #{VALID_STATUSES.join(', ')}"
|
|
29
|
+
suggestion: "Use one of: #{VALID_STATUSES.join(', ')}"
|
|
30
30
|
)]
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
|
-
|
|
@@ -21,7 +21,7 @@ module Glossarist
|
|
|
21
21
|
"no concept URI prefix or template defined in metadata",
|
|
22
22
|
code: code, severity: severity,
|
|
23
23
|
location: "metadata.yaml",
|
|
24
|
-
suggestion: "Add uri_prefix or concept_uri_template to metadata.yaml"
|
|
24
|
+
suggestion: "Add uri_prefix or concept_uri_template to metadata.yaml"
|
|
25
25
|
)]
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -13,7 +13,7 @@ module Glossarist
|
|
|
13
13
|
|
|
14
14
|
def applicable?(context)
|
|
15
15
|
concept = context.concept
|
|
16
|
-
|
|
16
|
+
concept.dates&.any? || concept.date_accepted
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def check(context)
|
|
@@ -23,8 +23,9 @@ module Glossarist
|
|
|
23
23
|
|
|
24
24
|
check_date_collection(concept.dates, fname, issues)
|
|
25
25
|
|
|
26
|
-
if concept.date_accepted
|
|
27
|
-
validate_date_type(concept.date_accepted, "date_accepted", fname,
|
|
26
|
+
if concept.date_accepted&.type
|
|
27
|
+
validate_date_type(concept.date_accepted, "date_accepted", fname,
|
|
28
|
+
issues)
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
issues
|
|
@@ -35,6 +36,7 @@ module Glossarist
|
|
|
35
36
|
def check_date_collection(dates, fname, issues)
|
|
36
37
|
(dates || []).each_with_index do |date, idx|
|
|
37
38
|
next unless date.type
|
|
39
|
+
|
|
38
40
|
validate_date_type(date, "date #{idx + 1}", fname, issues)
|
|
39
41
|
end
|
|
40
42
|
end
|
|
@@ -26,7 +26,7 @@ module Glossarist
|
|
|
26
26
|
"definition #{idx + 1} has empty content",
|
|
27
27
|
code: code, severity: severity,
|
|
28
28
|
location: "#{fname}/#{lang}",
|
|
29
|
-
suggestion: "Add definition text or remove the empty entry"
|
|
29
|
+
suggestion: "Add definition text or remove the empty entry"
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -38,4 +38,3 @@ module Glossarist
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
|
-
|
|
@@ -6,7 +6,7 @@ module Glossarist
|
|
|
6
6
|
# Validates that domain references point to concepts that exist in the
|
|
7
7
|
# dataset (for local refs with concept_id) or have a valid URN.
|
|
8
8
|
class DomainTargetRule < Base
|
|
9
|
-
URN_RE = %r{\Aurn:[a-z0-9][a-z0-9-]{0,31}:[a-z0-9()+,\-.:=@;$_!*'%/?#]+\z}i
|
|
9
|
+
URN_RE = %r{\Aurn:[a-z0-9][a-z0-9-]{0,31}:[a-z0-9()+,\-.:=@;$_!*'%/?#]+\z}i
|
|
10
10
|
|
|
11
11
|
def code = "GLS-111"
|
|
12
12
|
def category = :references
|
|
@@ -25,7 +25,7 @@ module Glossarist
|
|
|
25
25
|
"concepts #{ids.join(', ')}",
|
|
26
26
|
code: code, severity: severity,
|
|
27
27
|
location: lang,
|
|
28
|
-
suggestion: "Differentiate the terms or consolidate the concepts"
|
|
28
|
+
suggestion: "Differentiate the terms or consolidate the concepts"
|
|
29
29
|
)
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -60,4 +60,3 @@ module Glossarist
|
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
|
-
|
|
@@ -26,7 +26,7 @@ module Glossarist
|
|
|
26
26
|
"#{fname}/#{lang}: invalid entry_status '#{status}' " \
|
|
27
27
|
"(expected one of: #{VALID_STATUSES.join(', ')})",
|
|
28
28
|
code: code, severity: "error",
|
|
29
|
-
location: "#{fname}/#{lang}"
|
|
29
|
+
location: "#{fname}/#{lang}"
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -36,4 +36,3 @@ module Glossarist
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
|
-
|
|
@@ -17,7 +17,7 @@ module Glossarist
|
|
|
17
17
|
concept = context.concept
|
|
18
18
|
fname = context.file_name
|
|
19
19
|
expected_id = concept.data&.id&.to_s
|
|
20
|
-
actual_name = fname.
|
|
20
|
+
actual_name = fname.delete_suffix(".yaml").delete_prefix("concepts/")
|
|
21
21
|
|
|
22
22
|
return [] unless expected_id && expected_id != actual_name
|
|
23
23
|
|
|
@@ -25,11 +25,10 @@ module Glossarist
|
|
|
25
25
|
"filename '#{actual_name}' does not match concept id '#{expected_id}'",
|
|
26
26
|
code: code, severity: severity,
|
|
27
27
|
location: "concepts/#{fname}",
|
|
28
|
-
suggestion: "Rename the entry or fix the concept id"
|
|
28
|
+
suggestion: "Rename the entry or fix the concept id"
|
|
29
29
|
)]
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
|
|
@@ -24,6 +24,7 @@ module Glossarist
|
|
|
24
24
|
|
|
25
25
|
l10n.text_content.each do |text|
|
|
26
26
|
next unless text
|
|
27
|
+
|
|
27
28
|
extractor.extract_from_text(text).each do |ref|
|
|
28
29
|
next unless ref.is_a?(AssetReference)
|
|
29
30
|
next if context.asset_index.resolve?(ref.path)
|
|
@@ -32,7 +33,7 @@ module Glossarist
|
|
|
32
33
|
"unresolved image reference #{ref.path}",
|
|
33
34
|
code: "GLS-103", severity: severity,
|
|
34
35
|
location: "#{fname}/#{lang}",
|
|
35
|
-
suggestion: "add '#{ref.path}' to the dataset's images/ directory"
|
|
36
|
+
suggestion: "add '#{ref.path}' to the dataset's images/ directory"
|
|
36
37
|
)
|
|
37
38
|
end
|
|
38
39
|
end
|
|
@@ -46,7 +47,7 @@ module Glossarist
|
|
|
46
47
|
"unresolved asset reference #{ref.path}",
|
|
47
48
|
code: "GLS-104", severity: "error",
|
|
48
49
|
location: fname,
|
|
49
|
-
suggestion: "add '#{ref.path}' to the dataset's images/ directory"
|
|
50
|
+
suggestion: "add '#{ref.path}' to the dataset's images/ directory"
|
|
50
51
|
)
|
|
51
52
|
end
|
|
52
53
|
|
|
@@ -27,7 +27,7 @@ module Glossarist
|
|
|
27
27
|
"localized_concepts '#{lang}' => '#{uuid}' has no matching file",
|
|
28
28
|
code: code, severity: severity,
|
|
29
29
|
location: fname,
|
|
30
|
-
suggestion: "Add the missing localization file or remove the UUID"
|
|
30
|
+
suggestion: "Add the missing localization file or remove the UUID"
|
|
31
31
|
)
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -37,4 +37,3 @@ module Glossarist
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
|
|
@@ -27,11 +27,10 @@ module Glossarist
|
|
|
27
27
|
"missing localizations for declared languages: #{missing.join(', ')}",
|
|
28
28
|
code: code, severity: severity,
|
|
29
29
|
location: fname,
|
|
30
|
-
suggestion: "Add localizations for: #{missing.join(', ')}"
|
|
30
|
+
suggestion: "Add localizations for: #{missing.join(', ')}"
|
|
31
31
|
)]
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
|
-
|
|
@@ -24,7 +24,7 @@ module Glossarist
|
|
|
24
24
|
issues << issue(
|
|
25
25
|
"declared languages not found in concepts: #{missing.sort.join(', ')}",
|
|
26
26
|
code: code, severity: severity,
|
|
27
|
-
suggestion: "Update the languages list or add missing localizations"
|
|
27
|
+
suggestion: "Update the languages list or add missing localizations"
|
|
28
28
|
)
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@ module Glossarist
|
|
|
33
33
|
issues << issue(
|
|
34
34
|
"concepts use languages not declared: #{extra.sort.join(', ')}",
|
|
35
35
|
code: code, severity: severity,
|
|
36
|
-
suggestion: "Add these languages to the languages list in metadata"
|
|
36
|
+
suggestion: "Add these languages to the languages list in metadata"
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -43,4 +43,3 @@ module Glossarist
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
|
-
|
|
@@ -48,7 +48,9 @@ module Glossarist
|
|
|
48
48
|
def all_origins(concept)
|
|
49
49
|
origins = []
|
|
50
50
|
concept.localizations.each do |l10n|
|
|
51
|
-
(l10n.data&.sources || []).each
|
|
51
|
+
(l10n.data&.sources || []).each do |s|
|
|
52
|
+
origins << s.origin if s.origin
|
|
53
|
+
end
|
|
52
54
|
end
|
|
53
55
|
origins
|
|
54
56
|
end
|
|
@@ -23,7 +23,7 @@ module Glossarist
|
|
|
23
23
|
issues = []
|
|
24
24
|
|
|
25
25
|
lc_map = concept.data&.localized_concepts || {}
|
|
26
|
-
loaded_langs = concept.localizations&.
|
|
26
|
+
loaded_langs = concept.localizations&.filter_map(&:language_code) || []
|
|
27
27
|
|
|
28
28
|
# Map has entry but no loaded localization
|
|
29
29
|
lc_map.each_key do |lang|
|
|
@@ -22,6 +22,7 @@ module Glossarist
|
|
|
22
22
|
concept.localizations.each do |l10n|
|
|
23
23
|
l10n.text_content.each do |text|
|
|
24
24
|
next unless text
|
|
25
|
+
|
|
25
26
|
extractor.extract_from_text(text).each do |ref|
|
|
26
27
|
if ref.is_a?(BibliographicReference)
|
|
27
28
|
referenced_anchors.add(ref.anchor)
|
|
@@ -40,7 +41,7 @@ module Glossarist
|
|
|
40
41
|
"Orphaned bibliography entry: '#{anchor}'",
|
|
41
42
|
code: code, severity: severity,
|
|
42
43
|
location: "bibliography.yaml",
|
|
43
|
-
suggestion: "Remove the entry or reference it from a concept"
|
|
44
|
+
suggestion: "Remove the entry or reference it from a concept"
|
|
44
45
|
)
|
|
45
46
|
end
|
|
46
47
|
|
|
@@ -21,6 +21,7 @@ module Glossarist
|
|
|
21
21
|
concept.localizations.each do |l10n|
|
|
22
22
|
l10n.text_content.each do |text|
|
|
23
23
|
next unless text
|
|
24
|
+
|
|
24
25
|
extractor.extract_from_text(text).each do |ref|
|
|
25
26
|
if ref.is_a?(AssetReference)
|
|
26
27
|
referenced_paths.add(ref.path)
|
|
@@ -38,6 +39,7 @@ module Glossarist
|
|
|
38
39
|
if images_file
|
|
39
40
|
context.bibliography_index.entries.each_value do |entry|
|
|
40
41
|
next unless entry[:source].is_a?(V3::ImageEntry)
|
|
42
|
+
|
|
41
43
|
path = entry[:source].path
|
|
42
44
|
referenced_paths.add(path) if path
|
|
43
45
|
end
|
|
@@ -51,7 +53,7 @@ module Glossarist
|
|
|
51
53
|
"Orphaned image: #{path} (not referenced by any concept)",
|
|
52
54
|
code: code, severity: severity,
|
|
53
55
|
location: path,
|
|
54
|
-
suggestion: "Remove the image or reference it from a concept"
|
|
56
|
+
suggestion: "Remove the image or reference it from a concept"
|
|
55
57
|
)
|
|
56
58
|
end
|
|
57
59
|
|
|
@@ -61,10 +63,10 @@ module Glossarist
|
|
|
61
63
|
private
|
|
62
64
|
|
|
63
65
|
def load_images_file(context)
|
|
64
|
-
return @
|
|
66
|
+
return @load_images_file if defined?(@load_images_file)
|
|
65
67
|
|
|
66
|
-
@
|
|
67
|
-
File.join(context.path, "images.yaml")
|
|
68
|
+
@load_images_file = V3::ImageFile.from_file(
|
|
69
|
+
File.join(context.path, "images.yaml"),
|
|
68
70
|
)
|
|
69
71
|
end
|
|
70
72
|
end
|
|
@@ -26,7 +26,7 @@ module Glossarist
|
|
|
26
26
|
"(not referenced by any concept)",
|
|
27
27
|
code: code, severity: severity,
|
|
28
28
|
location: File.basename(path),
|
|
29
|
-
suggestion: "Delete the file or add a reference from a managed concept"
|
|
29
|
+
suggestion: "Delete the file or add a reference from a managed concept"
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -36,4 +36,3 @@ module Glossarist
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
|
-
|
|
@@ -28,7 +28,7 @@ module Glossarist
|
|
|
28
28
|
"has #{terms.size} term(s) but none are preferred",
|
|
29
29
|
code: code, severity: severity,
|
|
30
30
|
location: "#{fname}/#{lang}",
|
|
31
|
-
suggestion: "Set normative_status: preferred on the primary term"
|
|
31
|
+
suggestion: "Set normative_status: preferred on the primary term"
|
|
32
32
|
)
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -38,4 +38,3 @@ module Glossarist
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
|
-
|
|
@@ -66,7 +66,7 @@ module Glossarist
|
|
|
66
66
|
stack = Set.new
|
|
67
67
|
cycles = []
|
|
68
68
|
|
|
69
|
-
graph.
|
|
69
|
+
graph.each_key do |node|
|
|
70
70
|
next if visited.include?(node)
|
|
71
71
|
|
|
72
72
|
dfs(node, graph, visited, stack, [], cycles)
|
|
@@ -80,7 +80,7 @@ module Glossarist
|
|
|
80
80
|
|
|
81
81
|
if stack.include?(node)
|
|
82
82
|
cycle_start = path.index(node)
|
|
83
|
-
cycles << path[cycle_start..] + [node] if cycle_start
|
|
83
|
+
cycles << (path[cycle_start..] + [node]) if cycle_start
|
|
84
84
|
return
|
|
85
85
|
end
|
|
86
86
|
|
|
@@ -26,7 +26,7 @@ module Glossarist
|
|
|
26
26
|
"related concept #{idx + 1} has invalid type '#{rel.type}'",
|
|
27
27
|
code: code, severity: severity,
|
|
28
28
|
location: fname,
|
|
29
|
-
suggestion: "Use one of: #{VALID_TYPES.join(', ')}"
|
|
29
|
+
suggestion: "Use one of: #{VALID_TYPES.join(', ')}"
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -37,4 +37,3 @@ module Glossarist
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
|
|
@@ -40,7 +40,7 @@ module Glossarist
|
|
|
40
40
|
next unless target_id
|
|
41
41
|
|
|
42
42
|
targets = index[target_id]
|
|
43
|
-
next if targets
|
|
43
|
+
next if targets&.any? { |r| r.type == inverse }
|
|
44
44
|
|
|
45
45
|
issues << issue(
|
|
46
46
|
"#{concept_id}: #{rel.type} #{target_id} but #{target_id} has no #{inverse} back-link",
|