glossarist 2.6.1 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4e48f1d237829b78cd052e39afdd7c952c468be894e25856f79f93471ea2dc6
4
- data.tar.gz: f6502f7012e30138193c4c28eee2ab551020edf27ff0c6e08cc39939e5d0c0c3
3
+ metadata.gz: 1f3a8ec372c1c3e7a93ed7c2bad8ed2837f8f5bcd5ce4ae340bbb9f3b5ddaa75
4
+ data.tar.gz: e7c0672fc648ea748cff12bfc00a1ea62665aeaa20e4cf8a86dde1419a6094df
5
5
  SHA512:
6
- metadata.gz: bcfb39fe52138d23d489cfbff45f62b0f00161d3183ef66dbb5718fcbc30694ef5e426bc9f7797329480dddb01a7c96b8f6e1dfc43e392032441bb62487c723a
7
- data.tar.gz: 289911c5a5851389cb5e37fbc07bd45825b00cdd51fa8cac5679168af3ec9e2b7313f6afbd7093fb93b35384bfc7318dcb97a22d72869f78a321883f4ab299a4
6
+ metadata.gz: 5a3654b99b5137104e26830fe77b1b6bad3eb2e0ce4ffa45d479b909399c469c41edbd7460ede72dc4f10bf94cc2f40649e78ce8510113ea9d97f0715750af15
7
+ data.tar.gz: eec5c75fd4a6a434999830038642ce387d74c2b7df976343d4b342aa919d1aaf7c4beccff4f92fbb18a0f0a4acf762885bf837edad7f16dd9889a93b33ed5613
data/.gitignore CHANGED
@@ -16,8 +16,9 @@
16
16
  .rubocop-http---*
17
17
  .rubocop-https---*
18
18
 
19
- # Relaton local cache directory
19
+ # Relaton cache directories
20
20
  localcache
21
+ spec/fixtures/relaton_cache/
21
22
 
22
23
  .vscode
23
24
 
data/.rubocop_todo.yml CHANGED
@@ -1,12 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-05-06 18:35:41 UTC using RuboCop version 1.86.1.
3
+ # on 2026-05-12 04:13:45 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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 5
9
+ # Offense count: 7
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
11
  # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
12
  Bundler/OrderedGems:
@@ -18,27 +18,77 @@ Gemspec/RequiredRubyVersion:
18
18
  Exclude:
19
19
  - 'glossarist.gemspec'
20
20
 
21
+ # Offense count: 4
22
+ # This cop supports safe autocorrection (--autocorrect).
23
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
24
+ # SupportedStyles: with_first_argument, with_fixed_indentation
25
+ Layout/ArgumentAlignment:
26
+ Exclude:
27
+ - 'lib/glossarist/sts/import_result.rb'
28
+ - 'lib/glossarist/sts/importer.rb'
29
+ - 'lib/glossarist/sts/term_mapper.rb'
30
+
21
31
  # Offense count: 1
22
32
  # This cop supports safe autocorrection (--autocorrect).
23
- Layout/ClosingParenthesisIndentation:
33
+ # Configuration parameters: IndentationWidth.
34
+ Layout/AssignmentIndentation:
24
35
  Exclude:
25
- - 'spec/unit/concept_set_spec.rb'
36
+ - 'lib/glossarist/sts/term_mapper.rb'
37
+
38
+ # Offense count: 6
39
+ # This cop supports safe autocorrection (--autocorrect).
40
+ # Configuration parameters: EnforcedStyleAlignWith.
41
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
42
+ Layout/BlockAlignment:
43
+ Exclude:
44
+ - 'lib/glossarist/sts/term_extractor.rb'
45
+ - 'spec/unit/sts/term_extractor_spec.rb'
46
+ - 'spec/unit/sts/term_mapper_spec.rb'
47
+
48
+ # Offense count: 6
49
+ # This cop supports safe autocorrection (--autocorrect).
50
+ Layout/BlockEndNewline:
51
+ Exclude:
52
+ - 'lib/glossarist/sts/term_extractor.rb'
53
+ - 'spec/unit/sts/term_extractor_spec.rb'
54
+ - 'spec/unit/sts/term_mapper_spec.rb'
26
55
 
27
56
  # Offense count: 1
28
57
  # This cop supports safe autocorrection (--autocorrect).
29
- # Configuration parameters: EnforcedStyle, IndentationWidth.
30
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
31
- Layout/FirstArgumentIndentation:
58
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
59
+ # SupportedHashRocketStyles: key, separator, table
60
+ # SupportedColonStyles: key, separator, table
61
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
62
+ Layout/HashAlignment:
32
63
  Exclude:
33
- - 'spec/unit/concept_set_spec.rb'
64
+ - 'lib/glossarist/sts/importer.rb'
34
65
 
35
- # Offense count: 202
66
+ # Offense count: 12
67
+ # This cop supports safe autocorrection (--autocorrect).
68
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
69
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
70
+ Layout/IndentationWidth:
71
+ Exclude:
72
+ - 'lib/glossarist/sts/term_extractor.rb'
73
+ - 'spec/unit/sts/term_extractor_spec.rb'
74
+ - 'spec/unit/sts/term_mapper_spec.rb'
75
+
76
+ # Offense count: 236
36
77
  # This cop supports safe autocorrection (--autocorrect).
37
78
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
38
79
  # URISchemes: http, https
39
80
  Layout/LineLength:
40
81
  Enabled: false
41
82
 
83
+ # Offense count: 7
84
+ # This cop supports safe autocorrection (--autocorrect).
85
+ # Configuration parameters: AllowInHeredoc.
86
+ Layout/TrailingWhitespace:
87
+ Exclude:
88
+ - 'lib/glossarist/sts/import_result.rb'
89
+ - 'lib/glossarist/sts/importer.rb'
90
+ - 'lib/glossarist/sts/term_mapper.rb'
91
+
42
92
  # Offense count: 1
43
93
  # Configuration parameters: AllowedMethods.
44
94
  # AllowedMethods: enums
@@ -54,7 +104,7 @@ Lint/UnusedMethodArgument:
54
104
  Exclude:
55
105
  - 'lib/glossarist/dataset_validator.rb'
56
106
 
57
- # Offense count: 23
107
+ # Offense count: 24
58
108
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
59
109
  Metrics/AbcSize:
60
110
  Exclude:
@@ -73,12 +123,6 @@ Metrics/AbcSize:
73
123
  - 'lib/glossarist/utilities/uuid.rb'
74
124
  - 'spec/unit/concept_collector_spec.rb'
75
125
 
76
- # Offense count: 1
77
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
78
- # AllowedMethods: refine
79
- Metrics/BlockLength:
80
- Max: 28
81
-
82
126
  # Offense count: 19
83
127
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
84
128
  Metrics/CyclomaticComplexity:
@@ -96,7 +140,7 @@ Metrics/CyclomaticComplexity:
96
140
  - 'lib/glossarist/transforms/concept_to_skos_transform.rb'
97
141
  - 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
98
142
 
99
- # Offense count: 35
143
+ # Offense count: 47
100
144
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
101
145
  Metrics/MethodLength:
102
146
  Max: 42
@@ -135,6 +179,19 @@ Naming/VariableNumber:
135
179
  Exclude:
136
180
  - 'spec/unit/rdf/skos_vocabulary_spec.rb'
137
181
 
182
+ # Offense count: 9
183
+ # This cop supports safe autocorrection (--autocorrect).
184
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
185
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
186
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
187
+ # FunctionalMethods: let, let!, subject, watch
188
+ # AllowedMethods: lambda, proc, it
189
+ Style/BlockDelimiters:
190
+ Exclude:
191
+ - 'lib/glossarist/sts/term_extractor.rb'
192
+ - 'spec/unit/sts/term_extractor_spec.rb'
193
+ - 'spec/unit/sts/term_mapper_spec.rb'
194
+
138
195
  # Offense count: 6
139
196
  # This cop supports safe autocorrection (--autocorrect).
140
197
  # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
@@ -142,6 +199,12 @@ Naming/VariableNumber:
142
199
  Style/FormatStringToken:
143
200
  EnforcedStyle: unannotated
144
201
 
202
+ # Offense count: 2
203
+ # This cop supports safe autocorrection (--autocorrect).
204
+ Style/MultilineIfModifier:
205
+ Exclude:
206
+ - 'lib/glossarist/sts/importer.rb'
207
+
145
208
  # Offense count: 1
146
209
  # Configuration parameters: AllowedClasses.
147
210
  Style/OneClassPerFile:
data/Gemfile CHANGED
@@ -6,29 +6,13 @@ gemspec
6
6
 
7
7
  gem "canon"
8
8
  gem "lutaml-model", "~> 0.8.0"
9
+ gem "nokogiri"
9
10
  gem "rake", "~> 13.0"
11
+ gem "relaton", "~> 2.1.0"
10
12
  gem "rspec", "~> 3.0"
11
13
  gem "rubocop"
12
14
  gem "rubocop-performance"
13
15
  gem "rubocop-rake"
14
16
  gem "rubocop-rspec"
17
+ gem "sts", "~> 0.5.6"
15
18
  gem "tbx", "~> 0.1"
16
-
17
- # Override relaton gems with lutaml-model 0.8 compatible versions.
18
- # Released 2.0.0 gems have untyped lutaml-model attributes that fail with 0.8+.
19
- # lutaml-integration branches have typed attributes and relaton-bib ~> 2.1.0.
20
- # TODO: Remove once relaton gems release versions with lutaml-model 0.8 support.
21
- gem "relaton-3gpp", github: "relaton/relaton-3gpp",
22
- branch: "lutaml-integration"
23
- gem "relaton-bib", github: "relaton/relaton-bib", branch: "lutaml-integration"
24
- gem "relaton-bipm", github: "relaton/relaton-bipm",
25
- branch: "lutaml-integration"
26
- gem "relaton-bsi", github: "relaton/relaton-bsi", branch: "lutaml-integration"
27
- gem "relaton-calconnect", github: "relaton/relaton-calconnect",
28
- branch: "lutaml-integration"
29
- gem "relaton-ccsds", github: "relaton/relaton-ccsds",
30
- branch: "lutaml-integration"
31
- gem "relaton-cen", github: "relaton/relaton-cen", branch: "lutaml-integration"
32
- gem "relaton-iec", github: "relaton/relaton-iec", branch: "lutaml-integration"
33
- gem "relaton-iso", github: "relaton/relaton-iso", branch: "lutaml-integration"
34
- gem "relaton-itu", github: "relaton/relaton-itu", branch: "lutaml-integration"
data/README.adoc CHANGED
@@ -507,6 +507,123 @@ puts skos.to_jsonld
507
507
  puts skos.to_turtle
508
508
  ----
509
509
 
510
+ === import
511
+
512
+ Import terminology concepts from STS XML files into a new or existing dataset.
513
+
514
+ [,bash]
515
+ ----
516
+ # Import one or more STS XML files into a new dataset directory
517
+ glossarist import iso-8373.xml -o output_dir
518
+
519
+ # Import into a new GCR package (--shortname and --version required)
520
+ glossarist import iso-8373.xml -o iso-8373.gcr \
521
+ --shortname iso-8373 --version 1.0.0 --title "ISO 8373 Robotics"
522
+
523
+ # Import multiple files into a new dataset
524
+ glossarist import iso-8373.xml iso-9000.xml -o combined_dataset
525
+
526
+ # Import into an existing dataset (dedup by designation + domain)
527
+ glossarist import iso-8373.xml --into existing_dataset/
528
+
529
+ # Import into an existing GCR (re-packages automatically)
530
+ glossarist import iso-8373.xml --into existing.gcr
531
+
532
+ # Control duplicate handling
533
+ glossarist import iso-8373.xml --into existing_dataset/ --on-duplicate replace
534
+ ----
535
+
536
+ Deduplication is based on **designation + domain** (case-insensitive). When
537
+ duplicates are found, the `--on-duplicate` strategy determines the behavior:
538
+
539
+ [cols="1,2"]
540
+ |===
541
+ |`skip` (default)
542
+ |Keep the existing concept, skip the new one
543
+
544
+ |`replace`
545
+ |Replace the existing concept with the new one
546
+
547
+ |`merge`
548
+ |Add new localizations to the existing concept (e.g. add French to an English-only concept)
549
+ |===
550
+
551
+ Options:
552
+ [cols="1,1"]
553
+ |===
554
+ |o, --output
555
+ |Output directory or `.gcr` file path (new dataset)
556
+
557
+ |--into
558
+ |Path to existing dataset directory or `.gcr` file to merge into
559
+
560
+ |--shortname
561
+ |Dataset shortname (required for GCR output)
562
+
563
+ |--version
564
+ |Dataset version (required for GCR output)
565
+
566
+ |--title
567
+ |Dataset title
568
+
569
+ |--description
570
+ |Dataset description
571
+
572
+ |--owner
573
+ |Dataset owner
574
+
575
+ |--uri-prefix
576
+ |URI prefix for the dataset
577
+
578
+ |--on-duplicate
579
+ |How to handle duplicates: `skip`, `replace`, or `merge`
580
+ |===
581
+
582
+ Ruby API:
583
+ [,ruby]
584
+ ----
585
+ require "glossarist/sts"
586
+
587
+ importer = Glossarist::Sts::Importer.new
588
+
589
+ # Import into a new dataset directory
590
+ result = importer.import_new(
591
+ ["iso-8373.xml", "iso-9000.xml"],
592
+ output: "output_dir",
593
+ )
594
+ puts result.concepts.length # total concepts imported
595
+ puts result.conflicts.length # duplicates detected
596
+ puts result.skipped_count # skipped (strategy: skip)
597
+
598
+ # Import into a new GCR package
599
+ result = importer.import_new(
600
+ ["iso-8373.xml"],
601
+ output: "iso-8373.gcr",
602
+ shortname: "iso-8373",
603
+ version: "1.0.0",
604
+ title: "ISO 8373 Robotics Vocabulary",
605
+ )
606
+
607
+ # Import into an existing dataset with merge strategy
608
+ importer = Glossarist::Sts::Importer.new(duplicate_strategy: :merge)
609
+ result = importer.import_into_existing(
610
+ ["french_supplement.xml"],
611
+ "existing_dataset/",
612
+ )
613
+ result.concepts.each do |mc|
614
+ puts "#{mc.data.id}: #{mc.localizations.keys.join(', ')}"
615
+ end
616
+ ----
617
+
618
+ ==== Import result
619
+
620
+ `import_new` and `import_into_existing` return an `ImportResult` with:
621
+
622
+ concepts:: `Array<ManagedConcept>` — the imported concepts
623
+ conflicts:: `Array<DuplicateConflict>` — duplicate pairs detected by designation + domain
624
+ source_files:: `Array<String>` — the input file paths
625
+ skipped_count:: `Integer` — concepts skipped due to duplicates (strategy: skip)
626
+
510
627
  === validate
511
628
 
512
629
  Validate a dataset directory or `.gcr` file for schema compliance.
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ class CLI
5
+ class ImportCommand
6
+ def initialize(files, options)
7
+ @files = files
8
+ @options = options
9
+ end
10
+
11
+ def run
12
+ importer = Sts::Importer.new(
13
+ duplicate_strategy: @options[:on_duplicate]&.to_sym || :skip,
14
+ )
15
+
16
+ result = if @options[:into]
17
+ importer.import_into_existing(@files, @options[:into])
18
+ else
19
+ importer.import_new(@files, **import_new_args)
20
+ end
21
+
22
+ print_summary(result)
23
+ rescue ArgumentError => e
24
+ warn "Error: #{e.message}"
25
+ exit 1
26
+ end
27
+
28
+ private
29
+
30
+ def import_new_args
31
+ {
32
+ output: @options[:output],
33
+ shortname: @options[:shortname],
34
+ version: @options[:version],
35
+ title: @options[:title],
36
+ description: @options[:description],
37
+ owner: @options[:owner],
38
+ uri_prefix: @options[:uri_prefix],
39
+ }
40
+ end
41
+
42
+ def print_summary(result) # rubocop:disable Metrics/AbcSize
43
+ dest = @options[:into] || @options[:output]
44
+ puts "Imported #{result.concepts.length} concepts to #{dest}"
45
+ puts " Source files: #{@files.join(', ')}" if @files.any?
46
+ return unless result.conflict?
47
+
48
+ puts " #{result.conflicts.length} duplicate(s) detected " \
49
+ "(strategy: #{@options[:on_duplicate] || 'skip'})"
50
+ puts " #{result.skipped_count} concept(s) skipped" if result.skipped_count.positive?
51
+ end
52
+ end
53
+ end
54
+ end
@@ -4,6 +4,11 @@ require "thor"
4
4
 
5
5
  module Glossarist
6
6
  class CLI < Thor
7
+ autoload :UpgradeCommand, "#{__dir__}/cli/upgrade_command"
8
+ autoload :PackageCommand, "#{__dir__}/cli/package_command"
9
+ autoload :ValidateCommand, "#{__dir__}/cli/validate_command"
10
+ autoload :ImportCommand, "#{__dir__}/cli/import_command"
11
+ autoload :ExportCommand, "#{__dir__}/cli/export_command"
7
12
  desc "generate_latex", "Convert Concepts to Latex format"
8
13
 
9
14
  option :concepts_path, aliases: :p, required: true,
@@ -38,8 +43,7 @@ module Glossarist
38
43
  option :dry_run, type: :boolean, default: false,
39
44
  desc: "Show what would change without writing"
40
45
  def upgrade(source_dir)
41
- require_relative "cli/upgrade_command"
42
- Glossarist::CLI::UpgradeCommand.new(source_dir, options).run
46
+ CLI::UpgradeCommand.new(source_dir, options).run
43
47
  end
44
48
 
45
49
  desc "package DIR", "Create a .gcr ZIP archive from a schema v1 dataset"
@@ -62,8 +66,7 @@ module Glossarist
62
66
  option :concept_uri_template, type: :string,
63
67
  desc: "URI template for concept URIs"
64
68
  def package(dir)
65
- require_relative "cli/package_command"
66
- Glossarist::CLI::PackageCommand.new(dir, options).run
69
+ CLI::PackageCommand.new(dir, options).run
67
70
  end
68
71
 
69
72
  desc "validate PATH",
@@ -76,8 +79,27 @@ module Glossarist
76
79
  option :reference_path, type: :string,
77
80
  desc: "Path to directory of .gcr files for cross-dataset reference validation"
78
81
  def validate(path)
79
- require_relative "cli/validate_command"
80
- Glossarist::CLI::ValidateCommand.new(path, options).run
82
+ CLI::ValidateCommand.new(path, options).run
83
+ end
84
+
85
+ desc "import FILES...", "Import terms from STS XML files"
86
+ option :output, aliases: :o, type: :string,
87
+ desc: "Output directory or .gcr file path (new dataset)"
88
+ option :into, type: :string,
89
+ desc: "Path to existing dataset directory or .gcr file to merge into"
90
+ option :shortname, type: :string,
91
+ desc: "Dataset shortname (required for GCR output)"
92
+ option :version, type: :string,
93
+ desc: "Dataset version (required for GCR output)"
94
+ option :title, type: :string, desc: "Dataset title"
95
+ option :description, type: :string, desc: "Dataset description"
96
+ option :owner, type: :string, desc: "Dataset owner"
97
+ option :uri_prefix, type: :string, desc: "URI prefix for the dataset"
98
+ option :on_duplicate, type: :string, default: "skip",
99
+ enum: %w[skip replace merge],
100
+ desc: "How to handle duplicate concepts (designation + domain)"
101
+ def import(*files)
102
+ CLI::ImportCommand.new(files, options).run
81
103
  end
82
104
 
83
105
  desc "export PATH", "Export concepts in machine-readable formats"
@@ -95,8 +117,7 @@ module Glossarist
95
117
  option :title, type: :string,
96
118
  desc: "Dataset title for document header"
97
119
  def export(path)
98
- require_relative "cli/export_command"
99
- Glossarist::CLI::ExportCommand.new(path, options).run
120
+ CLI::ExportCommand.new(path, options).run
100
121
  end
101
122
 
102
123
  def method_missing(*args)
@@ -41,13 +41,35 @@ module Glossarist
41
41
  def v1_concepts?(dir)
42
42
  concepts_dir = File.join(dir, "concepts")
43
43
  File.directory?(concepts_dir) &&
44
+ !v2_flat_concepts?(dir) &&
45
+ !managed_concepts?(dir) &&
44
46
  Dir.glob(File.join(concepts_dir, "*.yaml")).any? do |f|
45
47
  V1::Concept.from_file(f)&.termid?
46
48
  end
47
49
  end
48
50
 
49
51
  def v2_concepts?(dir)
50
- File.directory?(File.join(dir, "geolexica-v2"))
52
+ File.directory?(File.join(dir, "geolexica-v2")) ||
53
+ v2_flat_concepts?(dir)
54
+ end
55
+
56
+ def v2_flat_concepts?(dir)
57
+ return false if managed_concepts?(dir)
58
+
59
+ concepts_dir = File.join(dir, "concepts")
60
+ return false unless File.directory?(concepts_dir)
61
+
62
+ Dir.glob(File.join(concepts_dir, "*.yaml")).first(5).any? do |f|
63
+ v2_flat_concept_file?(f)
64
+ end
65
+ end
66
+
67
+ def v2_flat_concept_file?(path)
68
+ raw = File.read(path, encoding: "utf-8")
69
+ doc = ConceptDocument.from_yamls(raw)
70
+ !!doc.concept&.data&.id
71
+ rescue StandardError
72
+ false
51
73
  end
52
74
 
53
75
  def managed_concepts?(dir)
@@ -74,24 +96,32 @@ module Glossarist
74
96
  end
75
97
 
76
98
  def collect_v2_concepts(dir)
77
- v2_dir = File.join(dir, "geolexica-v2")
78
- if File.directory?(File.join(v2_dir, "concepts"))
79
- collect_managed_concepts(v2_dir)
99
+ if v2_flat_concepts?(dir)
100
+ collect_grouped_v2_concepts(File.join(dir, "concepts"))
80
101
  else
81
- collect_grouped_v2_concepts(v2_dir)
102
+ v2_dir = File.join(dir, "geolexica-v2")
103
+ if File.directory?(File.join(v2_dir, "concepts"))
104
+ collect_managed_concepts(v2_dir)
105
+ else
106
+ collect_grouped_v2_concepts(v2_dir)
107
+ end
82
108
  end
83
109
  end
84
110
 
85
111
  def each_v2_concept(dir, &block)
86
- v2_dir = File.join(dir, "geolexica-v2")
87
- if File.directory?(File.join(v2_dir, "concepts"))
88
- each_managed_concept(v2_dir, &block)
112
+ if v2_flat_concepts?(dir)
113
+ each_grouped_v2_concepts(File.join(dir, "concepts"), &block)
89
114
  else
90
- each_grouped_v2_concept(v2_dir, &block)
115
+ v2_dir = File.join(dir, "geolexica-v2")
116
+ if File.directory?(File.join(v2_dir, "concepts"))
117
+ each_managed_concept(v2_dir, &block)
118
+ else
119
+ each_grouped_v2_concepts(v2_dir, &block)
120
+ end
91
121
  end
92
122
  end
93
123
 
94
- def each_grouped_v2_concept(v2_dir, &block)
124
+ def each_grouped_v2_concepts(v2_dir, &block)
95
125
  collection = ManagedConceptCollection.new
96
126
  manager = ConceptManager.new(path: v2_dir)
97
127
  manager.load_from_files(collection: collection)
@@ -1,5 +1,4 @@
1
- require_relative "base"
2
- require_relative "grammar_info"
1
+ # frozen_string_literal: true
3
2
 
4
3
  module Glossarist
5
4
  module Designation
@@ -1,4 +1,4 @@
1
- require_relative "symbol"
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Glossarist
4
4
  module Designation