glossarist 2.6.2 → 2.6.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/.gitignore +2 -1
- data/.rubocop_todo.yml +58 -16
- data/Gemfile +3 -19
- data/README.adoc +117 -0
- data/glossarist.gemspec +1 -0
- data/lib/glossarist/cli/import_command.rb +54 -0
- data/lib/glossarist/cli.rb +29 -8
- data/lib/glossarist/designation/expression.rb +1 -2
- data/lib/glossarist/designation/graphical_symbol.rb +1 -1
- data/lib/glossarist/managed_concept.rb +1 -1
- data/lib/glossarist/rdf/skos_concept.rb +0 -1
- data/lib/glossarist/rdf/skos_vocabulary.rb +0 -1
- data/lib/glossarist/sts/extracted_designation.rb +14 -0
- data/lib/glossarist/sts/extracted_lang_set.rb +16 -0
- data/lib/glossarist/sts/extracted_term.rb +13 -0
- data/lib/glossarist/sts/import_result.rb +24 -0
- data/lib/glossarist/sts/importer.rb +253 -0
- data/lib/glossarist/sts/term_extractor.rb +186 -0
- data/lib/glossarist/sts/term_mapper.rb +118 -0
- data/lib/glossarist/sts.rb +87 -0
- data/lib/glossarist/transforms/concept_to_skos_transform.rb +0 -2
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +10 -7
- metadata +25 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: facc3d87fcd7c04944cdb267bd8a0cf5b259bd53b95fe20259b1708b6120fb82
|
|
4
|
+
data.tar.gz: 89676d88ae921c18ad4c932074f3dabe47674ede8f82c3fac2a7c5fa8330d780
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f08e797184f6c4b006c33bb56e61f31de44ab57143697492dc60397eba400b0cde8ce7d6d92a616ef345271d477b77ce94d327b5421c4a335f2282b1d3aafc2
|
|
7
|
+
data.tar.gz: cf150e9819f6a0242fd63617099a5ce34e321a559687e13f9f04c0edfb571972e960603eb35d3df112e68d959f317ee47db844aba0b86b68391414db84e4c421
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,59 +1,93 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-05-
|
|
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: 7
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
|
|
12
|
+
Bundler/OrderedGems:
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'Gemfile'
|
|
15
|
+
|
|
9
16
|
# Offense count: 1
|
|
10
17
|
Gemspec/RequiredRubyVersion:
|
|
11
18
|
Exclude:
|
|
12
19
|
- 'glossarist.gemspec'
|
|
13
20
|
|
|
14
|
-
# Offense count:
|
|
21
|
+
# Offense count: 4
|
|
15
22
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
23
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
17
24
|
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
18
25
|
Layout/ArgumentAlignment:
|
|
19
26
|
Exclude:
|
|
20
|
-
- '
|
|
27
|
+
- 'lib/glossarist/sts/import_result.rb'
|
|
28
|
+
- 'lib/glossarist/sts/importer.rb'
|
|
29
|
+
- 'lib/glossarist/sts/term_mapper.rb'
|
|
21
30
|
|
|
22
|
-
# Offense count:
|
|
31
|
+
# Offense count: 1
|
|
32
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
33
|
+
# Configuration parameters: IndentationWidth.
|
|
34
|
+
Layout/AssignmentIndentation:
|
|
35
|
+
Exclude:
|
|
36
|
+
- 'lib/glossarist/sts/term_mapper.rb'
|
|
37
|
+
|
|
38
|
+
# Offense count: 6
|
|
23
39
|
# This cop supports safe autocorrection (--autocorrect).
|
|
24
40
|
# Configuration parameters: EnforcedStyleAlignWith.
|
|
25
41
|
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
26
42
|
Layout/BlockAlignment:
|
|
27
43
|
Exclude:
|
|
28
|
-
- 'lib/glossarist/
|
|
44
|
+
- 'lib/glossarist/sts/term_extractor.rb'
|
|
45
|
+
- 'spec/unit/sts/term_extractor_spec.rb'
|
|
46
|
+
- 'spec/unit/sts/term_mapper_spec.rb'
|
|
29
47
|
|
|
30
|
-
# Offense count:
|
|
48
|
+
# Offense count: 6
|
|
31
49
|
# This cop supports safe autocorrection (--autocorrect).
|
|
32
50
|
Layout/BlockEndNewline:
|
|
33
51
|
Exclude:
|
|
34
|
-
- 'lib/glossarist/
|
|
52
|
+
- 'lib/glossarist/sts/term_extractor.rb'
|
|
53
|
+
- 'spec/unit/sts/term_extractor_spec.rb'
|
|
54
|
+
- 'spec/unit/sts/term_mapper_spec.rb'
|
|
35
55
|
|
|
36
|
-
# Offense count:
|
|
56
|
+
# Offense count: 1
|
|
57
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
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:
|
|
63
|
+
Exclude:
|
|
64
|
+
- 'lib/glossarist/sts/importer.rb'
|
|
65
|
+
|
|
66
|
+
# Offense count: 12
|
|
37
67
|
# This cop supports safe autocorrection (--autocorrect).
|
|
38
68
|
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
39
69
|
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
40
70
|
Layout/IndentationWidth:
|
|
41
71
|
Exclude:
|
|
42
|
-
- 'lib/glossarist/
|
|
72
|
+
- 'lib/glossarist/sts/term_extractor.rb'
|
|
73
|
+
- 'spec/unit/sts/term_extractor_spec.rb'
|
|
74
|
+
- 'spec/unit/sts/term_mapper_spec.rb'
|
|
43
75
|
|
|
44
|
-
# Offense count:
|
|
76
|
+
# Offense count: 236
|
|
45
77
|
# This cop supports safe autocorrection (--autocorrect).
|
|
46
78
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
47
79
|
# URISchemes: http, https
|
|
48
80
|
Layout/LineLength:
|
|
49
81
|
Enabled: false
|
|
50
82
|
|
|
51
|
-
# Offense count:
|
|
83
|
+
# Offense count: 7
|
|
52
84
|
# This cop supports safe autocorrection (--autocorrect).
|
|
53
85
|
# Configuration parameters: AllowInHeredoc.
|
|
54
86
|
Layout/TrailingWhitespace:
|
|
55
87
|
Exclude:
|
|
56
|
-
- '
|
|
88
|
+
- 'lib/glossarist/sts/import_result.rb'
|
|
89
|
+
- 'lib/glossarist/sts/importer.rb'
|
|
90
|
+
- 'lib/glossarist/sts/term_mapper.rb'
|
|
57
91
|
|
|
58
92
|
# Offense count: 1
|
|
59
93
|
# Configuration parameters: AllowedMethods.
|
|
@@ -106,12 +140,12 @@ Metrics/CyclomaticComplexity:
|
|
|
106
140
|
- 'lib/glossarist/transforms/concept_to_skos_transform.rb'
|
|
107
141
|
- 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
|
|
108
142
|
|
|
109
|
-
# Offense count:
|
|
143
|
+
# Offense count: 47
|
|
110
144
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
111
145
|
Metrics/MethodLength:
|
|
112
146
|
Max: 42
|
|
113
147
|
|
|
114
|
-
# Offense count:
|
|
148
|
+
# Offense count: 4
|
|
115
149
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
116
150
|
Metrics/ParameterLists:
|
|
117
151
|
Max: 6
|
|
@@ -145,7 +179,7 @@ Naming/VariableNumber:
|
|
|
145
179
|
Exclude:
|
|
146
180
|
- 'spec/unit/rdf/skos_vocabulary_spec.rb'
|
|
147
181
|
|
|
148
|
-
# Offense count:
|
|
182
|
+
# Offense count: 9
|
|
149
183
|
# This cop supports safe autocorrection (--autocorrect).
|
|
150
184
|
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
151
185
|
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
@@ -154,7 +188,9 @@ Naming/VariableNumber:
|
|
|
154
188
|
# AllowedMethods: lambda, proc, it
|
|
155
189
|
Style/BlockDelimiters:
|
|
156
190
|
Exclude:
|
|
157
|
-
- 'lib/glossarist/
|
|
191
|
+
- 'lib/glossarist/sts/term_extractor.rb'
|
|
192
|
+
- 'spec/unit/sts/term_extractor_spec.rb'
|
|
193
|
+
- 'spec/unit/sts/term_mapper_spec.rb'
|
|
158
194
|
|
|
159
195
|
# Offense count: 6
|
|
160
196
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -163,6 +199,12 @@ Style/BlockDelimiters:
|
|
|
163
199
|
Style/FormatStringToken:
|
|
164
200
|
EnforcedStyle: unannotated
|
|
165
201
|
|
|
202
|
+
# Offense count: 2
|
|
203
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
204
|
+
Style/MultilineIfModifier:
|
|
205
|
+
Exclude:
|
|
206
|
+
- 'lib/glossarist/sts/importer.rb'
|
|
207
|
+
|
|
166
208
|
# Offense count: 1
|
|
167
209
|
# Configuration parameters: AllowedClasses.
|
|
168
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"
|
|
15
|
-
gem "tbx", "~> 0.1"
|
|
16
17
|
|
|
17
|
-
|
|
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"
|
|
18
|
+
|
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.
|
data/glossarist.gemspec
CHANGED
|
@@ -32,6 +32,7 @@ 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"
|
|
35
36
|
spec.add_dependency "relaton", ">= 2.0.0", "< 3"
|
|
36
37
|
spec.add_dependency "rubyzip", ">= 2.3", "< 3"
|
|
37
38
|
spec.add_dependency "tbx", "~> 0.1"
|
|
@@ -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
|
data/lib/glossarist/cli.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Glossarist
|
|
4
|
+
module Sts
|
|
5
|
+
ExtractedLangSet = Struct.new(
|
|
6
|
+
:language_code,
|
|
7
|
+
:definition_text,
|
|
8
|
+
:note_texts,
|
|
9
|
+
:example_texts,
|
|
10
|
+
:source_texts,
|
|
11
|
+
:domain,
|
|
12
|
+
:designations,
|
|
13
|
+
keyword_init: true,
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Glossarist
|
|
4
|
+
module Sts
|
|
5
|
+
DuplicateConflict = Struct.new(:new_concept, :existing_concept, :key,
|
|
6
|
+
keyword_init: true)
|
|
7
|
+
|
|
8
|
+
class ImportResult
|
|
9
|
+
attr_reader :concepts, :conflicts, :source_files, :skipped_count
|
|
10
|
+
|
|
11
|
+
def initialize(concepts:, conflicts: [], source_files: [],
|
|
12
|
+
skipped_count: 0)
|
|
13
|
+
@concepts = concepts
|
|
14
|
+
@conflicts = conflicts
|
|
15
|
+
@source_files = source_files
|
|
16
|
+
@skipped_count = skipped_count
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def conflict?
|
|
20
|
+
!conflicts.empty?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|