glossarist 2.6.4 → 2.6.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 +4 -4
- data/.github/workflows/release.yml +1 -4
- data/.rubocop_todo.yml +25 -74
- data/CLAUDE.md +27 -2
- data/Gemfile +0 -2
- data/README.adoc +650 -29
- data/config.yml +68 -1
- data/glossarist.gemspec +1 -1
- data/lib/glossarist/asset_reference.rb +16 -0
- data/lib/glossarist/bibliographic_reference.rb +16 -0
- data/lib/glossarist/concept.rb +1 -1
- data/lib/glossarist/concept_data.rb +4 -0
- data/lib/glossarist/concept_enricher.rb +1 -0
- data/lib/glossarist/concept_reference.rb +14 -17
- data/lib/glossarist/concept_validator.rb +27 -56
- data/lib/glossarist/dataset_validator.rb +30 -34
- data/lib/glossarist/designation/abbreviation.rb +0 -2
- data/lib/glossarist/designation/base.rb +21 -1
- data/lib/glossarist/designation/expression.rb +3 -0
- data/lib/glossarist/designation/letter_symbol.rb +0 -4
- data/lib/glossarist/designation/symbol.rb +0 -2
- data/lib/glossarist/gcr_validator.rb +26 -101
- data/lib/glossarist/glossary_definition.rb +5 -0
- data/lib/glossarist/managed_concept_data.rb +21 -2
- data/lib/glossarist/non_verb_rep.rb +21 -6
- data/lib/glossarist/pronunciation.rb +32 -0
- data/lib/glossarist/reference_extractor.rb +78 -10
- data/lib/glossarist/reference_resolver.rb +1 -0
- data/lib/glossarist/urn_resolver.rb +13 -1
- data/lib/glossarist/v1/concept.rb +7 -0
- data/lib/glossarist/validation/asset_index.rb +114 -0
- data/lib/glossarist/validation/bibliography_index.rb +121 -0
- data/lib/glossarist/validation/rules/asciidoc_xref_rule.rb +60 -0
- data/lib/glossarist/validation/rules/authoritative_source_rule.rb +47 -0
- data/lib/glossarist/validation/rules/base.rb +46 -0
- data/lib/glossarist/validation/rules/bibliography_yaml_rule.rb +37 -0
- data/lib/glossarist/validation/rules/citation_completeness_rule.rb +63 -0
- data/lib/glossarist/validation/rules/concept_context.rb +45 -0
- data/lib/glossarist/validation/rules/concept_count_rule.rb +34 -0
- data/lib/glossarist/validation/rules/concept_id_rule.rb +29 -0
- data/lib/glossarist/validation/rules/concept_id_uniqueness_rule.rb +42 -0
- data/lib/glossarist/validation/rules/concept_mention_rule.rb +44 -0
- data/lib/glossarist/validation/rules/concept_status_rule.rb +36 -0
- data/lib/glossarist/validation/rules/concept_uri_rule.rb +30 -0
- data/lib/glossarist/validation/rules/dataset_context.rb +99 -0
- data/lib/glossarist/validation/rules/date_type_rule.rb +54 -0
- data/lib/glossarist/validation/rules/date_validity_rule.rb +66 -0
- data/lib/glossarist/validation/rules/definition_content_rule.rb +41 -0
- data/lib/glossarist/validation/rules/designation_status_rule.rb +45 -0
- data/lib/glossarist/validation/rules/designation_type_rule.rb +55 -0
- data/lib/glossarist/validation/rules/duplicate_term_rule.rb +63 -0
- data/lib/glossarist/validation/rules/entry_status_rule.rb +39 -0
- data/lib/glossarist/validation/rules/filename_id_rule.rb +35 -0
- data/lib/glossarist/validation/rules/gcr_context.rb +92 -0
- data/lib/glossarist/validation/rules/image_reference_rule.rb +73 -0
- data/lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb +40 -0
- data/lib/glossarist/validation/rules/language_code_format_rule.rb +39 -0
- data/lib/glossarist/validation/rules/language_coverage_rule.rb +37 -0
- data/lib/glossarist/validation/rules/language_list_rule.rb +46 -0
- data/lib/glossarist/validation/rules/localization_presence_rule.rb +25 -0
- data/lib/glossarist/validation/rules/orphaned_bibliography_rule.rb +64 -0
- data/lib/glossarist/validation/rules/orphaned_images_rule.rb +68 -0
- data/lib/glossarist/validation/rules/orphaned_l10n_files_rule.rb +39 -0
- data/lib/glossarist/validation/rules/preferred_term_rule.rb +41 -0
- data/lib/glossarist/validation/rules/registry.rb +42 -0
- data/lib/glossarist/validation/rules/related_concept_cycle_rule.rb +102 -0
- data/lib/glossarist/validation/rules/related_concept_rule.rb +40 -0
- data/lib/glossarist/validation/rules/related_concept_symmetry_rule.rb +87 -0
- data/lib/glossarist/validation/rules/source_type_rule.rb +63 -0
- data/lib/glossarist/validation/rules/terms_presence_rule.rb +39 -0
- data/lib/glossarist/validation/rules.rb +85 -0
- data/lib/glossarist/validation/validation_issue.rb +39 -0
- data/lib/glossarist/validation.rb +12 -0
- data/lib/glossarist/validation_result.rb +26 -9
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +4 -0
- metadata +62 -16
data/config.yml
CHANGED
|
@@ -26,23 +26,90 @@ designation:
|
|
|
26
26
|
base:
|
|
27
27
|
normative_status:
|
|
28
28
|
- preferred
|
|
29
|
-
- deprecated
|
|
30
29
|
- admitted
|
|
30
|
+
- deprecated
|
|
31
|
+
- superseded
|
|
31
32
|
- <símbolo> # in iev-data => '<symbol>'
|
|
32
33
|
- 티에스 # in iev-data => translates to 'TS' I think it is a synonym and not status.
|
|
33
34
|
- prąd startowy # in iev-data => 'starting current' I think it is a synonym and not status.
|
|
35
|
+
relationship_type:
|
|
36
|
+
# Term-level (designation-to-designation within the same concept entry)
|
|
37
|
+
- abbreviated_form_for
|
|
38
|
+
- short_form_for
|
|
34
39
|
|
|
35
40
|
related_concept:
|
|
36
41
|
type:
|
|
42
|
+
# Lifecycle (ISO 10241-1)
|
|
37
43
|
- deprecates
|
|
38
44
|
- supersedes
|
|
39
45
|
- superseded_by
|
|
46
|
+
# Hierarchical (ISO 10241-1 / ISO 25964)
|
|
40
47
|
- narrower
|
|
41
48
|
- broader
|
|
49
|
+
# Hierarchical sub-types — ISO 25964 generic (BTG/NTG)
|
|
50
|
+
- broader_generic
|
|
51
|
+
- narrower_generic
|
|
52
|
+
# Hierarchical sub-types — ISO 25964 partitive (BTP/NTP)
|
|
53
|
+
- broader_partitive
|
|
54
|
+
- narrower_partitive
|
|
55
|
+
# Hierarchical sub-types — ISO 25964 instantial (BTI/NTI)
|
|
56
|
+
- broader_instantial
|
|
57
|
+
- narrower_instantial
|
|
58
|
+
# Equivalence (ISO 10241-1 / ISO 25964 exactMatch / SKOS)
|
|
42
59
|
- equivalent
|
|
60
|
+
# Approximate equivalence (ISO 25964 closeMatch / SKOS)
|
|
61
|
+
- close_match
|
|
62
|
+
# Cross-vocabulary mapping (SKOS)
|
|
63
|
+
- broad_match
|
|
64
|
+
- narrow_match
|
|
65
|
+
- related_match
|
|
66
|
+
# Comparative (ISO 10241-1)
|
|
43
67
|
- compare
|
|
44
68
|
- contrast
|
|
69
|
+
# Associative (ISO 10241-1 / ISO 25964 RT / TBX crossReference)
|
|
45
70
|
- see
|
|
71
|
+
# Associative sub-types (ISO 25964 / TBX)
|
|
72
|
+
- related_concept
|
|
73
|
+
- related_concept_broader
|
|
74
|
+
- related_concept_narrower
|
|
75
|
+
# Associative — spatial/temporal (ISO 25964 / TBX)
|
|
76
|
+
- sequentially_related_concept
|
|
77
|
+
- spatially_related_concept
|
|
78
|
+
- temporally_related_concept
|
|
79
|
+
# Lexical (ISO 12620 / TBX)
|
|
80
|
+
- homograph
|
|
81
|
+
- false_friend
|
|
82
|
+
|
|
83
|
+
iso12620:
|
|
84
|
+
term_type:
|
|
85
|
+
# ISO 12620 term type classification for designations.
|
|
86
|
+
# Orthographic / structural:
|
|
87
|
+
- abbreviation
|
|
88
|
+
- acronym
|
|
89
|
+
- clipped_term
|
|
90
|
+
- full_form
|
|
91
|
+
- initialism
|
|
92
|
+
- short_form
|
|
93
|
+
- transliterated_form
|
|
94
|
+
- transcribed_form
|
|
95
|
+
- variant
|
|
96
|
+
# Symbolic / formulaic:
|
|
97
|
+
- equation
|
|
98
|
+
- formula
|
|
99
|
+
- logical_expression
|
|
100
|
+
- symbol
|
|
101
|
+
# Usage / provenance:
|
|
102
|
+
- common_name
|
|
103
|
+
- entry_term
|
|
104
|
+
- internationalism
|
|
105
|
+
- international_scientific_term
|
|
106
|
+
- part_number
|
|
107
|
+
- phraseological_unit
|
|
108
|
+
- shortcut
|
|
109
|
+
- sku
|
|
110
|
+
- standard_text
|
|
111
|
+
- synonym
|
|
112
|
+
- synonymous_phrase
|
|
46
113
|
|
|
47
114
|
abbreviation:
|
|
48
115
|
type:
|
data/glossarist.gemspec
CHANGED
|
@@ -32,9 +32,9 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.require_paths = ["lib"]
|
|
33
33
|
|
|
34
34
|
spec.add_dependency "lutaml-model", "~> 0.8.5"
|
|
35
|
-
spec.add_dependency "sts", "~> 0.5.6"
|
|
36
35
|
spec.add_dependency "relaton", ">= 2.0.0", "< 3"
|
|
37
36
|
spec.add_dependency "rubyzip", ">= 2.3", "< 3"
|
|
37
|
+
spec.add_dependency "sts", "~> 0.5.6"
|
|
38
38
|
spec.add_dependency "tbx", "~> 0.1"
|
|
39
39
|
spec.add_dependency "thor"
|
|
40
40
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Glossarist
|
|
4
|
+
class BibliographicReference
|
|
5
|
+
attr_reader :anchor, :location
|
|
6
|
+
|
|
7
|
+
def initialize(anchor:, location: nil)
|
|
8
|
+
@anchor = anchor
|
|
9
|
+
@location = location
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def dedup_key
|
|
13
|
+
anchor
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/glossarist/concept.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Glossarist
|
|
|
4
4
|
attribute :id, :string
|
|
5
5
|
attribute :uuid, :string
|
|
6
6
|
attribute :subject, :string
|
|
7
|
-
attribute :non_verb_rep, :
|
|
7
|
+
attribute :non_verb_rep, NonVerbRep, collection: true
|
|
8
8
|
attribute :extension_attributes, :string
|
|
9
9
|
attribute :lineage_source, :string
|
|
10
10
|
attribute :localizations, :hash
|
|
@@ -30,6 +30,8 @@ module Glossarist
|
|
|
30
30
|
# Language code should be exactly 3 char long.
|
|
31
31
|
# TODO: use min_length, max_length once added in lutaml-model
|
|
32
32
|
attribute :language_code, :string, pattern: /^.{3}$/
|
|
33
|
+
attribute :script, :string
|
|
34
|
+
attribute :system, :string
|
|
33
35
|
attribute :entry_status, :string
|
|
34
36
|
|
|
35
37
|
key_value do
|
|
@@ -48,6 +50,8 @@ module Glossarist
|
|
|
48
50
|
map :references, to: :references
|
|
49
51
|
map :domain, to: :domain
|
|
50
52
|
map %i[language_code languageCode], to: :language_code
|
|
53
|
+
map :script, to: :script
|
|
54
|
+
map :system, to: :system
|
|
51
55
|
map %i[entry_status entryStatus], to: :entry_status
|
|
52
56
|
map %i[review_date reviewDate], to: :review_date
|
|
53
57
|
map %i[review_decision_date reviewDecisionDate], to: :review_decision_date
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Glossarist
|
|
4
|
+
# A typed reference to another concept, either local (within the same
|
|
5
|
+
# glossary) or external (in another concept registry).
|
|
6
|
+
#
|
|
7
|
+
# Local references use +concept_id+ without +source+. External references
|
|
8
|
+
# use +source+ (a registry URN prefix) and +concept_id+ to identify the
|
|
9
|
+
# target concept, or a direct +urn+ field for formal URN references.
|
|
4
10
|
class ConceptReference < Lutaml::Model::Serializable
|
|
5
11
|
attribute :term, :string
|
|
6
12
|
attribute :concept_id, :string
|
|
7
13
|
attribute :source, :string
|
|
8
14
|
attribute :ref_type, :string
|
|
15
|
+
attribute :urn, :string
|
|
9
16
|
|
|
10
17
|
key_value do
|
|
11
18
|
map :term, to: :term
|
|
12
19
|
map :concept_id, to: :concept_id
|
|
13
20
|
map :source, to: :source
|
|
14
21
|
map :ref_type, to: :ref_type
|
|
22
|
+
map :urn, to: :urn
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.domain(concept_id)
|
|
26
|
+
new(concept_id: concept_id, ref_type: "domain")
|
|
15
27
|
end
|
|
16
28
|
|
|
17
29
|
def local?
|
|
@@ -23,23 +35,8 @@ module Glossarist
|
|
|
23
35
|
!local?
|
|
24
36
|
end
|
|
25
37
|
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
return nil unless source && concept_id
|
|
29
|
-
|
|
30
|
-
case source
|
|
31
|
-
when /\Aurn:iec/ then "#{source}-#{concept_id}"
|
|
32
|
-
when /\Aurn:iso/ then "#{source}:term:#{concept_id}"
|
|
33
|
-
else "#{source}/#{concept_id}"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def to_gcr_hash
|
|
38
|
-
h = { "term" => term }
|
|
39
|
-
h["concept_id"] = concept_id if concept_id
|
|
40
|
-
h["source"] = source if source
|
|
41
|
-
h["ref_type"] = ref_type if ref_type
|
|
42
|
-
h.compact
|
|
38
|
+
def dedup_key
|
|
39
|
+
concept_id ? [source, concept_id] : [source, concept_id, term]
|
|
43
40
|
end
|
|
44
41
|
end
|
|
45
42
|
end
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module Glossarist
|
|
4
4
|
class ConceptValidator
|
|
5
|
-
LANG_CODES = Glossarist::LANG_CODES
|
|
6
|
-
VALID_ENTRY_STATUSES = %w[valid superseded withdrawn draft].freeze
|
|
7
|
-
|
|
8
5
|
attr_reader :path, :errors, :warnings
|
|
9
6
|
|
|
10
7
|
def initialize(path)
|
|
@@ -14,23 +11,46 @@ module Glossarist
|
|
|
14
11
|
end
|
|
15
12
|
|
|
16
13
|
def validate_all
|
|
17
|
-
|
|
14
|
+
result = ValidationResult.new
|
|
15
|
+
context = Validation::Rules::DatasetContext.new(@path)
|
|
16
|
+
concept_rules = Validation::Rules::Registry.for_scope(:concept)
|
|
18
17
|
file_idx = 0
|
|
19
18
|
|
|
20
19
|
ConceptCollector.each_concept(@path) do |concept|
|
|
21
20
|
fname = concept_file_name(concept, file_idx)
|
|
22
|
-
|
|
21
|
+
concept_context = Validation::Rules::ConceptContext.new(
|
|
22
|
+
concept, file_name: fname, collection_context: context
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
concept_rules.each do |rule|
|
|
26
|
+
next unless rule.applicable?(concept_context)
|
|
27
|
+
|
|
28
|
+
rule.check(concept_context).each { |i| result.add_issue(i) }
|
|
29
|
+
end
|
|
30
|
+
|
|
23
31
|
file_idx += 1
|
|
24
32
|
end
|
|
25
33
|
|
|
26
34
|
if file_idx.zero?
|
|
27
35
|
yaml_files = find_yaml_files
|
|
28
36
|
if yaml_files.any?
|
|
29
|
-
|
|
37
|
+
result.add_error("YAML files found but no parseable concepts")
|
|
30
38
|
end
|
|
31
39
|
end
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
# Run collection-level rules
|
|
42
|
+
collection_rules = Validation::Rules::Registry.for_scope(:collection)
|
|
43
|
+
collection_rules.each do |rule|
|
|
44
|
+
next unless rule.applicable?(context)
|
|
45
|
+
|
|
46
|
+
rule.check(context).each { |i| result.add_issue(i) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Sync legacy arrays for backward compatibility
|
|
50
|
+
@errors = result.errors
|
|
51
|
+
@warnings = result.warnings
|
|
52
|
+
|
|
53
|
+
result
|
|
34
54
|
end
|
|
35
55
|
|
|
36
56
|
private
|
|
@@ -48,54 +68,5 @@ module Glossarist
|
|
|
48
68
|
id = concept.data&.id
|
|
49
69
|
id ? "concept-#{id}.yaml" : "concept-#{idx}.yaml"
|
|
50
70
|
end
|
|
51
|
-
|
|
52
|
-
def validate_concept(concept, fname, seen_ids)
|
|
53
|
-
validate_id(concept, fname, seen_ids)
|
|
54
|
-
validate_localizations(concept, fname)
|
|
55
|
-
validate_entry_statuses(concept, fname)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def validate_id(concept, fname, seen_ids)
|
|
59
|
-
id = concept.data&.id
|
|
60
|
-
unless id
|
|
61
|
-
@errors << "#{fname}: missing concept id"
|
|
62
|
-
return
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
id_str = id.to_s
|
|
66
|
-
if seen_ids[id_str]
|
|
67
|
-
@errors << "#{fname}: duplicate id '#{id_str}' (first seen in #{seen_ids[id_str]})"
|
|
68
|
-
else
|
|
69
|
-
seen_ids[id_str] = fname
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def validate_localizations(concept, fname)
|
|
74
|
-
l10ns = concept.localizations&.values || []
|
|
75
|
-
if l10ns.empty?
|
|
76
|
-
@errors << "#{fname}: no localizations found"
|
|
77
|
-
return
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
l10ns.each do |l10n|
|
|
81
|
-
lang = l10n.language_code || "unknown"
|
|
82
|
-
terms = l10n.data&.terms
|
|
83
|
-
unless terms.is_a?(Array) && terms.any?
|
|
84
|
-
@errors << "#{fname}/#{lang}: must have at least 1 term"
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def validate_entry_statuses(concept, fname)
|
|
90
|
-
(concept.localizations&.values || []).each do |l10n|
|
|
91
|
-
lang = l10n.language_code || "unknown"
|
|
92
|
-
status = l10n.data&.entry_status
|
|
93
|
-
next unless status
|
|
94
|
-
|
|
95
|
-
unless VALID_ENTRY_STATUSES.include?(status)
|
|
96
|
-
@errors << "#{fname}/#{lang}: invalid entry_status '#{status}' (expected one of: #{VALID_ENTRY_STATUSES.join(', ')})"
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
71
|
end
|
|
101
72
|
end
|
|
@@ -3,43 +3,53 @@
|
|
|
3
3
|
module Glossarist
|
|
4
4
|
class DatasetValidator
|
|
5
5
|
def validate(path, strict: false, reference_path: nil)
|
|
6
|
-
|
|
6
|
+
if File.extname(path).downcase == ".gcr"
|
|
7
|
+
validate_gcr(path, reference_path: reference_path)
|
|
8
|
+
else
|
|
9
|
+
validate_directory(path, reference_path: reference_path)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def validate_gcr(path, reference_path: nil)
|
|
16
|
+
result = GcrValidator.new.validate(path)
|
|
7
17
|
|
|
8
18
|
if reference_path
|
|
9
|
-
ref_result =
|
|
19
|
+
ref_result = validate_gcr_cross_references(path, reference_path)
|
|
10
20
|
result.merge(ref_result)
|
|
11
21
|
end
|
|
12
22
|
|
|
13
23
|
result
|
|
14
24
|
end
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
def validate_directory(path, reference_path: nil)
|
|
27
|
+
result = ConceptValidator.new(path).validate_all
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
else
|
|
22
|
-
validate_directory(path)
|
|
29
|
+
if reference_path
|
|
30
|
+
ref_result = validate_directory_cross_references(path, reference_path)
|
|
31
|
+
result.merge(ref_result)
|
|
23
32
|
end
|
|
24
|
-
end
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
GcrValidator.new.validate(path)
|
|
34
|
+
result
|
|
28
35
|
end
|
|
29
36
|
|
|
30
|
-
def
|
|
31
|
-
|
|
37
|
+
def validate_gcr_cross_references(path, reference_path)
|
|
38
|
+
extractor = ReferenceExtractor.new
|
|
39
|
+
resolver = build_resolver(reference_path)
|
|
40
|
+
pkg = GcrPackage.load(path)
|
|
41
|
+
uri_prefix = pkg.metadata&.dig("uri_prefix") || pkg.metadata&.dig("shortname")
|
|
42
|
+
resolver.register_self(pkg.concepts)
|
|
43
|
+
resolver.register_package(pkg, uri_prefix: uri_prefix)
|
|
44
|
+
resolver.validate_all(pkg, extractor: extractor)
|
|
32
45
|
end
|
|
33
46
|
|
|
34
|
-
def
|
|
47
|
+
def validate_directory_cross_references(path, reference_path)
|
|
35
48
|
extractor = ReferenceExtractor.new
|
|
36
49
|
resolver = build_resolver(reference_path)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
else
|
|
41
|
-
validate_directory_refs(resolver, path, extractor)
|
|
42
|
-
end
|
|
50
|
+
concepts = ConceptCollector.collect(path)
|
|
51
|
+
resolver.register_self(concepts)
|
|
52
|
+
resolver.validate_all(concepts, extractor: extractor)
|
|
43
53
|
end
|
|
44
54
|
|
|
45
55
|
def build_resolver(reference_path)
|
|
@@ -51,19 +61,5 @@ module Glossarist
|
|
|
51
61
|
end
|
|
52
62
|
resolver
|
|
53
63
|
end
|
|
54
|
-
|
|
55
|
-
def validate_gcr_refs(resolver, path, extractor)
|
|
56
|
-
pkg = GcrPackage.load(path)
|
|
57
|
-
uri_prefix = pkg.metadata&.dig("uri_prefix") || pkg.metadata&.dig("shortname")
|
|
58
|
-
resolver.register_self(pkg.concepts)
|
|
59
|
-
resolver.register_package(pkg, uri_prefix: uri_prefix)
|
|
60
|
-
resolver.validate_all(pkg, extractor: extractor)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def validate_directory_refs(resolver, path, extractor)
|
|
64
|
-
concepts = ConceptCollector.collect(path)
|
|
65
|
-
resolver.register_self(concepts)
|
|
66
|
-
resolver.validate_all(concepts, extractor: extractor)
|
|
67
|
-
end
|
|
68
64
|
end
|
|
69
65
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module Glossarist
|
|
2
2
|
module Designation
|
|
3
3
|
class Abbreviation < Expression
|
|
4
|
-
attribute :international, :boolean
|
|
5
4
|
attribute :type, :string, default: -> { "abbreviation" }
|
|
6
5
|
|
|
7
6
|
Glossarist::GlossaryDefinition::ABBREVIATION_TYPES.each do |name|
|
|
@@ -9,7 +8,6 @@ module Glossarist
|
|
|
9
8
|
end
|
|
10
9
|
|
|
11
10
|
key_value do
|
|
12
|
-
map :international, to: :international
|
|
13
11
|
map :type, to: :type, render_default: true
|
|
14
12
|
Glossarist::GlossaryDefinition::ABBREVIATION_TYPES.each do |name|
|
|
15
13
|
map name.to_sym, to: name.to_sym
|
|
@@ -6,12 +6,30 @@ module Glossarist
|
|
|
6
6
|
attribute :normative_status, :string,
|
|
7
7
|
values: Glossarist::GlossaryDefinition::DESIGNATION_BASE_NORMATIVE_STATUSES
|
|
8
8
|
attribute :type, :string
|
|
9
|
+
attribute :language, :string
|
|
10
|
+
attribute :script, :string
|
|
11
|
+
attribute :system, :string
|
|
12
|
+
attribute :international, :boolean
|
|
13
|
+
attribute :absent, :boolean
|
|
14
|
+
attribute :pronunciation, Pronunciation, collection: true
|
|
15
|
+
attribute :sources, ConceptSource, collection: true
|
|
16
|
+
attribute :term_type, :string
|
|
17
|
+
attribute :related, RelatedConcept, collection: true
|
|
9
18
|
|
|
10
19
|
key_value do
|
|
11
20
|
map :type, to: :type
|
|
12
21
|
map %i[normative_status normativeStatus], to: :normative_status
|
|
13
22
|
map %i[geographical_area geographicalArea], to: :geographical_area
|
|
14
23
|
map :designation, to: :designation
|
|
24
|
+
map :language, to: :language
|
|
25
|
+
map :script, to: :script
|
|
26
|
+
map :system, to: :system
|
|
27
|
+
map :international, to: :international
|
|
28
|
+
map :absent, to: :absent
|
|
29
|
+
map :pronunciation, to: :pronunciation
|
|
30
|
+
map :sources, to: :sources
|
|
31
|
+
map %i[term_type termType], to: :term_type
|
|
32
|
+
map :related, to: :related
|
|
15
33
|
end
|
|
16
34
|
|
|
17
35
|
def self.of_yaml(hash, options = {})
|
|
@@ -34,7 +52,9 @@ module Glossarist
|
|
|
34
52
|
end
|
|
35
53
|
|
|
36
54
|
def self.infer_designation_type(hash)
|
|
37
|
-
if hash["
|
|
55
|
+
if hash["abbreviation_type"]
|
|
56
|
+
"abbreviation"
|
|
57
|
+
elsif hash["international"]
|
|
38
58
|
"symbol"
|
|
39
59
|
else
|
|
40
60
|
"expression"
|
|
@@ -5,6 +5,7 @@ module Glossarist
|
|
|
5
5
|
class Expression < Base
|
|
6
6
|
attribute :prefix, :string
|
|
7
7
|
attribute :usage_info, :string
|
|
8
|
+
attribute :field_of_application, :string
|
|
8
9
|
|
|
9
10
|
attribute :gender, :string
|
|
10
11
|
attribute :plurality, :string
|
|
@@ -16,6 +17,8 @@ module Glossarist
|
|
|
16
17
|
map :type, to: :type, render_default: true
|
|
17
18
|
map :prefix, to: :prefix
|
|
18
19
|
map %i[usage_info usageInfo], to: :usage_info
|
|
20
|
+
map %i[field_of_application fieldOfApplication],
|
|
21
|
+
to: :field_of_application
|
|
19
22
|
map %i[grammar_info grammarInfo], to: :grammar_info
|
|
20
23
|
end
|
|
21
24
|
|
|
@@ -2,13 +2,9 @@ module Glossarist
|
|
|
2
2
|
module Designation
|
|
3
3
|
class LetterSymbol < Symbol
|
|
4
4
|
attribute :text, :string
|
|
5
|
-
attribute :language, :string
|
|
6
|
-
attribute :script, :string
|
|
7
5
|
|
|
8
6
|
key_value do
|
|
9
7
|
map :text, to: :text
|
|
10
|
-
map :language, to: :language
|
|
11
|
-
map :script, to: :script
|
|
12
8
|
end
|
|
13
9
|
|
|
14
10
|
def self.of_yaml(hash, options = {})
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
module Glossarist
|
|
2
2
|
module Designation
|
|
3
3
|
class Symbol < Base
|
|
4
|
-
attribute :international, :boolean
|
|
5
4
|
attribute :type, :string, default: -> { "symbol" }
|
|
6
5
|
|
|
7
6
|
key_value do
|
|
8
|
-
map :international, to: :international
|
|
9
7
|
map :type, to: :type, render_default: true
|
|
10
8
|
end
|
|
11
9
|
|