glossarist 2.8.1 → 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.yml +1 -1
- data/.rubocop_todo.yml +413 -63
- data/CLAUDE.md +1 -1
- data/Gemfile +1 -1
- data/README.adoc +4 -1
- data/glossarist.gemspec +2 -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 -3
- data/lib/glossarist/concept_manager.rb +6 -8
- data/lib/glossarist/concept_set.rb +4 -4
- data/lib/glossarist/concept_store.rb +84 -0
- 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/managed_concept_data.rb +2 -0
- data/lib/glossarist/rdf/gloss_citation.rb +8 -4
- data/lib/glossarist/rdf/gloss_concept.rb +13 -4
- 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 +63 -26
- 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 +79 -0
- data/lib/glossarist/rdf/v3/configuration.rb +0 -2
- data/lib/glossarist/rdf/v3.rb +4 -43
- data/lib/glossarist/rdf.rb +26 -23
- data/lib/glossarist/register_data.rb +68 -18
- data/lib/glossarist/schema_migration.rb +8 -5
- data/lib/glossarist/sts/importer.rb +0 -1
- data/lib/glossarist/transforms/concept_to_gloss_transform.rb +57 -72
- data/lib/glossarist/v2/concept_data.rb +2 -1
- data/lib/glossarist/v2/concept_document.rb +1 -1
- data/lib/glossarist/v2/configuration.rb +0 -2
- data/lib/glossarist/v2/managed_concept_data.rb +1 -0
- data/lib/glossarist/v2.rb +12 -12
- data/lib/glossarist/v3/concept_data.rb +2 -1
- data/lib/glossarist/v3/concept_document.rb +1 -1
- data/lib/glossarist/v3/configuration.rb +0 -2
- data/lib/glossarist/v3/managed_concept_data.rb +1 -0
- data/lib/glossarist/v3.rb +16 -16
- data/lib/glossarist/validation/asset_index.rb +2 -2
- data/lib/glossarist/validation/bibliography_index.rb +11 -8
- 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/validation/rules.rb +18 -49
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +13 -11
- 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 +24 -11
- data/lib/glossarist/rdf/ext/jsonld_transform_ext.rb +0 -208
- data/lib/glossarist/rdf/ext/mapping_ext.rb +0 -37
- data/lib/glossarist/rdf/ext/mapping_rule_ext.rb +0 -27
- data/lib/glossarist/rdf/ext/member_rule_ext.rb +0 -34
- data/lib/glossarist/rdf/ext/turtle_transform_ext.rb +0 -222
- data/lib/glossarist/rdf/ext.rb +0 -39
- data/lib/glossarist/rdf/relationships.rb +0 -19
data/lib/glossarist/v2.rb
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "v2/configuration"
|
|
4
|
-
require_relative "v2/citation"
|
|
5
|
-
require_relative "v2/concept_source"
|
|
6
|
-
require_relative "v2/detailed_definition"
|
|
7
|
-
require_relative "v2/concept_ref"
|
|
8
|
-
require_relative "v2/related_concept"
|
|
9
|
-
require_relative "v2/concept_data"
|
|
10
|
-
require_relative "v2/localized_concept"
|
|
11
|
-
require_relative "v2/managed_concept_data"
|
|
12
|
-
require_relative "v2/managed_concept"
|
|
13
|
-
require_relative "v2/concept_document"
|
|
14
|
-
|
|
15
3
|
module Glossarist
|
|
16
4
|
module V2
|
|
5
|
+
autoload :Configuration, "glossarist/v2/configuration"
|
|
6
|
+
autoload :Citation, "glossarist/v2/citation"
|
|
7
|
+
autoload :ConceptSource, "glossarist/v2/concept_source"
|
|
8
|
+
autoload :DetailedDefinition, "glossarist/v2/detailed_definition"
|
|
9
|
+
autoload :ConceptRef, "glossarist/v2/concept_ref"
|
|
10
|
+
autoload :RelatedConcept, "glossarist/v2/related_concept"
|
|
11
|
+
autoload :ConceptData, "glossarist/v2/concept_data"
|
|
12
|
+
autoload :LocalizedConcept, "glossarist/v2/localized_concept"
|
|
13
|
+
autoload :ManagedConceptData, "glossarist/v2/managed_concept_data"
|
|
14
|
+
autoload :ManagedConcept, "glossarist/v2/managed_concept"
|
|
15
|
+
autoload :ConceptDocument, "glossarist/v2/concept_document"
|
|
16
|
+
|
|
17
17
|
Configuration.register_model(Citation, id: :citation)
|
|
18
18
|
Configuration.register_model(ConceptSource, id: :concept_source)
|
|
19
19
|
Configuration.register_model(DetailedDefinition, id: :detailed_definition)
|
|
@@ -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
|
|
@@ -15,6 +15,7 @@ module Glossarist
|
|
|
15
15
|
map %i[localized_concepts localizedConcepts], to: :localized_concepts
|
|
16
16
|
map %i[domains groups], to: :domains,
|
|
17
17
|
with: { from: :domains_from_yaml, to: :domains_to_yaml }
|
|
18
|
+
map :tags, to: :tags
|
|
18
19
|
map :sources, to: :sources
|
|
19
20
|
map :localizations, to: :localizations,
|
|
20
21
|
with: { from: :localizations_from_yaml, to: :localizations_to_yaml }
|
data/lib/glossarist/v3.rb
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "v3/configuration"
|
|
4
|
-
require_relative "v3/citation"
|
|
5
|
-
require_relative "v3/concept_source"
|
|
6
|
-
require_relative "v3/detailed_definition"
|
|
7
|
-
require_relative "v3/concept_ref"
|
|
8
|
-
require_relative "v3/related_concept"
|
|
9
|
-
require_relative "v3/concept_data"
|
|
10
|
-
require_relative "v3/localized_concept"
|
|
11
|
-
require_relative "v3/managed_concept_data"
|
|
12
|
-
require_relative "v3/managed_concept"
|
|
13
|
-
require_relative "v3/concept_document"
|
|
14
|
-
require_relative "v3/bibliography_entry"
|
|
15
|
-
require_relative "v3/bibliography_file"
|
|
16
|
-
require_relative "v3/image_entry"
|
|
17
|
-
require_relative "v3/image_file"
|
|
18
|
-
|
|
19
3
|
module Glossarist
|
|
20
4
|
module V3
|
|
5
|
+
autoload :Configuration, "glossarist/v3/configuration"
|
|
6
|
+
autoload :Citation, "glossarist/v3/citation"
|
|
7
|
+
autoload :ConceptSource, "glossarist/v3/concept_source"
|
|
8
|
+
autoload :DetailedDefinition, "glossarist/v3/detailed_definition"
|
|
9
|
+
autoload :ConceptRef, "glossarist/v3/concept_ref"
|
|
10
|
+
autoload :RelatedConcept, "glossarist/v3/related_concept"
|
|
11
|
+
autoload :ConceptData, "glossarist/v3/concept_data"
|
|
12
|
+
autoload :LocalizedConcept, "glossarist/v3/localized_concept"
|
|
13
|
+
autoload :ManagedConceptData, "glossarist/v3/managed_concept_data"
|
|
14
|
+
autoload :ManagedConcept, "glossarist/v3/managed_concept"
|
|
15
|
+
autoload :ConceptDocument, "glossarist/v3/concept_document"
|
|
16
|
+
autoload :BibliographyEntry, "glossarist/v3/bibliography_entry"
|
|
17
|
+
autoload :BibliographyFile, "glossarist/v3/bibliography_file"
|
|
18
|
+
autoload :ImageEntry, "glossarist/v3/image_entry"
|
|
19
|
+
autoload :ImageFile, "glossarist/v3/image_file"
|
|
20
|
+
|
|
21
21
|
Configuration.register_model(Citation, id: :citation)
|
|
22
22
|
Configuration.register_model(ConceptSource, id: :concept_source)
|
|
23
23
|
Configuration.register_model(DetailedDefinition, id: :detailed_definition)
|
|
@@ -21,8 +21,8 @@ module Glossarist
|
|
|
21
21
|
@entries.keys
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def each_entry(&
|
|
25
|
-
@entries.each_value(&
|
|
24
|
+
def each_entry(&)
|
|
25
|
+
@entries.each_value(&)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def self.build_from_concepts(concepts, dataset_path: nil)
|
|
@@ -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) }
|
|
@@ -85,14 +86,14 @@ module Glossarist
|
|
|
85
86
|
|
|
86
87
|
def register_origin_text(index, origin)
|
|
87
88
|
ref = origin.ref
|
|
88
|
-
return unless ref
|
|
89
|
+
return unless ref&.source && !ref.source.strip.empty?
|
|
89
90
|
|
|
90
91
|
index.register(ref.source, origin)
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def register_origin_ref(index, origin)
|
|
94
95
|
ref = origin.ref
|
|
95
|
-
return unless ref
|
|
96
|
+
return unless ref&.source && ref.id
|
|
96
97
|
|
|
97
98
|
key = "#{ref.source} #{ref.id}"
|
|
98
99
|
index.register(key, origin)
|
|
@@ -108,9 +109,10 @@ module Glossarist
|
|
|
108
109
|
return unless bib
|
|
109
110
|
|
|
110
111
|
Array(bib.entries).each do |entry|
|
|
111
|
-
next unless entry
|
|
112
|
+
next unless entry&.id
|
|
113
|
+
|
|
112
114
|
index.register(entry.id, entry)
|
|
113
|
-
index.register(entry.reference, entry) if entry.
|
|
115
|
+
index.register(entry.reference, entry) if entry.reference
|
|
114
116
|
end
|
|
115
117
|
rescue StandardError
|
|
116
118
|
nil
|
|
@@ -125,7 +127,8 @@ module Glossarist
|
|
|
125
127
|
return unless images
|
|
126
128
|
|
|
127
129
|
Array(images.entries).each do |entry|
|
|
128
|
-
next unless entry
|
|
130
|
+
next unless entry&.id
|
|
131
|
+
|
|
129
132
|
index.register(entry.id, entry)
|
|
130
133
|
end
|
|
131
134
|
rescue StandardError
|
|
@@ -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
|
|